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 Bravia script
#1
In another post i see a script to control a Sony television, so i try it with my HX850, but it doesn't work.

After some research i see its another way to control. Here my first test code

Code:
require('socket')

-- bravia IP
ip = 'x.x.x.x'
port = 80

-- full commandlist see: http://www.openremote.org/display/forums/Sony+TV+HTTP+control
cmd_HDMI1 = 'AAAAAgAAABoAAABaAw=='
cmd_CH6 = 'AAAAAQAAAAEAAAAFAw=='
cmd_MUTE = 'AAAAAQAAAAEAAAAUAw=='


ircmd = cmd_MUTE
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()
Reply
#2
Thanks for sharing, code in other post uses low-level API while you are using high-level HTTP. In theory both should work the same Smile
Reply
#3
strange, i can't get the low-level code working on my KLD-40HX850.

I receive "connect failed: connection refused" when i connect on port 20060.

I can connect on port 80 but then the commands doesn't work.
Reply
#4
(26.02.2016, 18:23)gjniewenhuijse Wrote: strange, i can't get the low-level code working on my KLD-40HX850.

I receive "connect failed: connection refused" when i connect on port 20060.

I can connect on port 80 but then the commands doesn't work.

Have you try this?


In order to enable this protocol, either one of the following settings needs to be enabled.
Normal Mode
Network > Home Network Setup > IP Control > Simple IP Control
Hotel/Pro Mode
Hotel/Pro Mode > IP Control > Simple IP Control 
Reply
#5
(27.02.2016, 11:23)josep Wrote:
(26.02.2016, 18:23)gjniewenhuijse Wrote: strange, i can't get the low-level code working on my KLD-40HX850.

I receive "connect failed: connection refused" when i connect on port 20060.

I can connect on port 80 but then the commands doesn't work.

Have you try this?


In order to enable this protocol, either one of the following settings needs to be enabled.
Normal Mode
Network > Home Network Setup > IP Control > Simple IP Control
Hotel/Pro Mode
Hotel/Pro Mode > IP Control > Simple IP Control 

For my tv i enabled remote renderer in home network.
Reply
#6
Hello everybody!
Its can work with KD65-X8500D ?
Reply


Forum Jump: