This forum uses cookies
This forum makes use of cookies to store your login information if you are registered, and your last visit if you are not. Cookies are small text documents stored on your computer; the cookies set by this forum can only be used on this website and pose no security risk. Cookies on this forum also track the specific topics you have read and when you last read them. Please confirm that you accept these cookies being set.

Sony Simple IP Protocol
#9
Above doesn't work for me, so i used this:

Code:
-- tv standby
require('user.sony')
sendCmd('192.168.x.xxx', cmd_OFF) -- define your ip

and the library
Code:
--http://www.openremote.org/display/forums/Sony+TV+HTTP+control
--https://www.domoticz.com/forum/viewtopic.php?t=8301
--https://medium.com/@philw_/talking-to-your-sony-bravia-tv-over-http-with-google-now-tasker-xbmc-and-roku-7b71fe634966#.xwswvjd0p

-- wol(mac, ip, '60', port) --mac = '00:a0:96:7c:76:dd'

require('socket')

port = 80

--command
cmd_HDMI1 = 'AAAAAgAAABoAAABaAw=='
cmd_CH6 = 'AAAAAQAAAAEAAAAFAw=='
cmd_MUTE = 'AAAAAQAAAAEAAAAUAw=='
cmd_OFF = 'AAAAAQAAAAEAAAAvAw=='


function sendCmd(ip, ircmd)
 soap = '<?xml version="1.0" encoding="utf-8"?><s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/" s:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"><s:Body><u:X_SendIRCC xmlns:u="urn:schemas-sony-com:service:IRCC:1"><IRCCCode>'..ircmd..'</IRCCCode></u:X_SendIRCC></s:Body></s:Envelope>'

 -- http request  
 reqs = 'POST /IRCC HTTP/1.1\r\n' ..
        'CONNECTION: close\r\n' ..
        'HOST: ' .. ip .. ':' .. port .. '\r\n' ..
        'CONTENT-LENGTH: ' .. soap:len() .. '\r\n' ..
        'CONTENT-TYPE: text/xml; charset="utf-8"\r\n' ..
         '\r\n' .. soap

 sock = socket.tcp()
 sock:settimeout(3)

 res, err = sock:connect(ip, port)
 if res then
   res, err = sock:send(reqs)

   if res then
     --log('send OK')
   else
     --log('send failed: ' .. tostring(err))
   end
 else
   --log('connect failed: ' .. tostring(err))
 end

 sock:close()
end
Reply


Messages In This Thread
Sony Simple IP Protocol - by josep - 24.02.2016, 09:23
RE: Sony Simple IP Protocol - by admin - 24.02.2016, 11:45
RE: Sony Simple IP Protocol - by DarthPaul - 13.07.2018, 07:04
RE: Sony Simple IP Protocol - by josep - 24.02.2016, 14:39
RE: Sony Simple IP Protocol - by admin - 25.02.2016, 09:37
RE: Sony Simple IP Protocol - by josep - 25.02.2016, 19:53
RE: Sony Simple IP Protocol - by phongvucba - 22.05.2017, 15:46
RE: Sony Simple IP Protocol - by buuuudzik - 08.06.2017, 16:24
RE: Sony Simple IP Protocol - by phongvucba - 14.07.2017, 10:51
RE: Sony Simple IP Protocol - by gjniewenhuijse - 17.07.2017, 07:06

Forum Jump: