25.02.2016, 09:37
You have to send enquiry command, then you can parse the response to get status info.
Code:
require('socket')
-- bravia IP
ip = '192.168.1.23'
-- power-status
cmd = '*SEPOWR################\n'
sock = socket.tcp()
sock:settimeout(3)
res, err = sock:connect(ip, 20060)
if res then
res, err = sock:send(cmd)
if res then
res, err = sock:receive()
if res then
alert('receive OK: ' .. tostring(res))
else
alert('receive failed: ' .. tostring(err))
end
else
alert('send failed: ' .. tostring(err))
end
else
alert('connect failed: ' .. tostring(err))
end
sock:close()