I’m trying to develop a DTH for my TV and have a few bits of functionality working. The one I can’t work out is to send a simple string to the TV on a specific TCP port.
Data: 1012
IP: tv_IP
Port: 4660
I’m tried the following but with no luck:
def on() {
log.debug "Executing ‘on’"
def result = new physicalgraph.device.HubAction(“1012”, physicalgraph.device.Protocol.LAN, “C0A8003C:1234”)
log.debug result.toString()
sendHubCommand(result);
}
def off() {
log.debug "Executing ‘off’"
def result = new physicalgraph.device.HubAction(“1012”, physicalgraph.device.Protocol.LAN, “192.168.0.60:4660”)
log.debug result.toString()
sendHubCommand(result);
}
I was trying every combination so the On function uses the HEX version of the IP and the off version uses the decimal equivalent. I’ve even changed this to be the MAC address of the TV.
I did penetration testing on 16 different models as part of a full security analysis for a client and the software on the newer smart tv’s sees this as an attack.
I don’t have any problems with my Samsung 65" curved SUHD, but I don’t have any other brands (all my tv’s are Samsung) to test on and while most tv’s ir frame data field length is 8 bits Samsungs is 12. You would think the ir frame wouldn’t have any effect but it does. So my test might be irrelevant.
Only other things I can think of are hex translation or authentication issues but its working from laptop.
If all else fails a simple workaround is an arduino board with ir controller connected to ST via shield. Use Teensy ++ to send all commands to tv from arduino
I ended up sending this as a remote code, using the same code I use for HDMI switching etc, and that worked. What’s weird is that in my packet captures this isn’t how the smartapp on my phone does it.
Sorry I didn’t get back to you right away but I see you figured it out.
What I did was send the ir codes via hex and worked fine for me. For that though you have to know the encryption of each code and correct length for each manufacturer…which is usually pretty easy to figure out. Then you send the same data to the correct port depending on manufacturer.
Those are the ports that will accept commands, obviously a port scanner will help find any open ports but you need to know the correct ones along with correct hex length and encryption.
Code should look similar to this:
Samsung 65 Curved SUHD over IP
Samsung http://www.Samsung.com
Samsung TV over IP Interface
UN65KS9800FXZA
1.0
crlf
<implementationList>
<implementationFile>I_Samsung.xml</implementationFile>
</implementationList> <settings>
<protocol>crlf</protocol>
<ioPort>65531</ioPort>
</settings>
...
function tvStartup(lul_device)
luup.log("Running I_Samsung.xml")
end
…Off
– Power off
sendCommand("POWR0 ")
<action>
<serviceId>urn:com:serviceId:DiscretePower1</serviceId>
<name>On</name>
<run>
-- Power on
sendCommand("POWR1 ")
</run>
</action>
Obviously just fill in appropriate service id, correct tv, xml, and port