LG TV's IP control
George Krietsepis
Posts: 284
Dear All,
I'm trying to find a way to control LG TV's through IP but I have neither found the related protocol
(not the RS232 one which is very known ) nor a module made from AMX.
Can I ask if anyone of you has ever managed to do something about that? Do you have the IP protocol for the LG's?
I very well know that Crestron and Control4 are able to control such TV's through IP modules.
George
0
Comments
Here's the deal...
The RS232 and IP protocol are the same. So that's not a problem. But, here's the issues:
1) not all models support IP control. I have yet to find a comprehensive list to let you know which do and which don't. Appart from just going into the menu of the TV and seeing there's really no way I know of knowing ahead of time.
2) Some TVs feature their "Web Based" control - which allows you to use a smart phone app to control it. This protocol is closed. There are some TVs that support this feature and then turn of the 3rd Part IP control. Some still do both. Here again - trial and error on models...
3) Now - if you have a TV that does IP control - it will need an additional power on command. You must send it a Wake On LAN before powering it on. You can eaisly Google how to build the WOL command. I'ts pretty simple. You just need to know the MAC Address of each TV you need to control.
From then on it works fine.
e
Oh, I forgot. It communicates on ports 9760 for network commands and 9761 for general control. Most commands will use 9761.
For my case, both ports ( 9760-9761 ) refuse the connection. There is really a smart phone app to control them but it initially needs a key number to pair with TV's.
Does this mean that they only use a closed protocol ?
As Eric noted, not all LG TVs support IP control. For those models that do support it, IP control is DISABLED by default. You will need to enable IP control. The other vendor products that support IP control describe the IP enabling sequence as follows:
Use the TV’s IR remote to enter the TVs hidden menu as follows to enable IP control for the TV. Note that the LG Magic Remote can not be used. Instead, a non-magic remote or universal remote with LG TV codes must be used.
a. Power the TV ON and set the input to an unused source such as CATV.
b. Wait for the TV to display the “snow” no channel static on the screen and all other menus have disappeared.
c. Press and hold the Settings button (looks like a gear) on the TVs IR remote until the channel number is displayed on the TV then release the settings button.
d. Press 828 then the OK button to bring up the hidden IP Control Setup Menu.
e. Set IP Control to ON.
NOTE: Entering this menu may be tricky and take a few tries. If the TV you are using does not have this menu then it may not support IP control.
OK, I'm having to get my first one of these LG units set up via IP. I've gotten to the point where I can connect to the TV from the controller, but it won't accept any commands, it just disconnects after a timeout, or as soon as I try to send it a power query command.
Is there a specific connect sequence like the ESC/VP sequence for epson projectors?
Anyone willing to give me another hint? I can't quite crack it.
Only port 9761 reports as open on the TV. Using terminal commands, I can connect to that port, but it closes as soon as I try to send anything to it. I can't connect to any other port via telnet command.
I can specify IP ports 6, 7, 9, 9760, or 9761 in my controller code, and the TV will come online with an IP_CLIENT_OPEN request on any of those ports.
I can send the special "6 x $FF + 16 MacAddr" to any of those opened ports, either immediately after IP_CLIENT_OPEN, or inside a DATA_EVENT - ONLINE event. I've seen it both ways in examples here, but neither one appears to make any difference.
I can send pretty much any data to whatever port I open on the TV; the "fw 1 01" WOL command, power on, power off, etc., and the controller-opened port stays open, but won't respond. The only way it seems that I can get the port to close when I've opened it via controller command, is to close it via controller command.
If anyone is willing to give me any more hints about the process here, I'd appreciate it. I'd rather get the IP connection figured out, but if I can't, I'll convert to RS232 and carry on.
I actually ran in to the same thing with a UK6300PUE model last night. Using any terminal client, I can open a socket to port 9761 on the display, but as soon as I send a byte to the display, the socket is closed. I have a request in to LG support and have received an initial response, but will update when I get more info.
When I turned on the IP control in the hidden menu on mine, a 55UK6090PUA, it lit up a "generate keycode" button. I did that, and have the keycode, and am guessing it's got to be used somehow in an initial handshake. I tried the obvious sending just the keycode, auth:keycode, but kinda ran out of gas from there.
Well darn. I think I'm sunk. This particular model doesn't even have a 3.5mm RS232 port, it's only got USB. The manual states explicitly that the USB version only works when TV power is already on.
LG reps say, "IP Control is Only thru the App" for this model. No discreet 3rd party IP control. I'd need to wireshark the app traffic to reverse engineer the protocol. That's kinda out of scope for this project. It was supposed to be a simple little TV addition to an already existing system. Oh well. Not the TV I would have ordered had I been able to order it myself.
I've been working with RS-232 control on LG TV's for years now, including newer models with the mini phone jack. (Note that some or all of the newest models no longer have the phone jack, but they still have IP control but with a catch: IP control apparently is, and has been, only available on US models, and that means NOT available in the rest of the world including Canada.) So I have RS-232 working in every day use on a variety of models going back 10 years (including a B6 OLED and a UH610A non-OLED).
So far, there has been no urgency for me to get IP control working since RS-232 works fine. But now I have a new UK6300 that does not have the RS-232 mini-jack.
I had already managed to send individual IP commands successfully, so I can point out one thing. The whole protocol for IP control is TOTALLY different from RS-232. (And I tried the RS-232 protocol with out success.) It IS documented, but it can be hard to find. It is pages 34-37 of a 48 page manual that covers the UH series. But here's the problem: Most manuals that are available on the Internet (especially on LG sites) do NOT have these pages (even when they DO have the pages on RS-232 control). I don't even remember how I found this so it make take some effort to find it.
I can set up my new UK6300 for IP control using the same method as always, with one exception. I saw the same "generate keycode" button mentioned above. I have no idea how this would fit into the protocol and I'm not looking forward to figuring it out.
I'll try to report on further progress.
Have you tried using a 'USB to serial' converter on a USB port on the TV ? I haven't on a LG TV, but on many other devices this 'just works'. Could be worth a try.
The problem is the USB goes dead when the TV powers off. You can't turn it back on via the USB when the TV is powered down.
Not very familiar with LG TV's, is there no menu entry to keep power to the USB port while in standby (like the Sony display's)? I guess that still would't mean the internal USB circuitry is powered on, but worth a try? If LG didn't design it to work this way, you're probably out of luck.
I cannot understand why LG is keeping the IP protocol as guarded secret
When I called LG about support for this problem, I talked to them about using the USB, but the support techs from LG insisted that the USB would power down when the TV was shut off, and not listen to power-on commands, even when the RS-232 was set to work that way. But, I never tested it myself, I just took their word for it.
I don't understand keeping the protocol secret, either. We could reverse-engineer the basics of the protocol with Wireshark. If I needed to do 50 TVs, I would. But just one? After discussing the issue with the client and coming to the conclusion that we either needed to spend a lot of time on this, replace the LG with a different TV, or they could just use the remote to control the TV, they chose the remote. Not my favorite solution, but simple and it works.
And then, stay away from non-commercial LG TVs. Actually using commercial displays instead of consumer displays in general is always a nice idea, but it's a hard sell in our very budget-conscious, "hey I can get that from Amazon for X" environment sometimes.
If you're not actually using that keycode, but have successfully sent it some IP commands anyway, that keycode is probably a red herring. Let us know what you find. Thanks!
I have the LG TV IP protocol, extracted from one of their OLED TV manuals, but for some reason I do not have the icon on the forum post dashboard that allows me to post a PDF. The protocol is very simple (and less complete than the RS232 protocol) and seems to be unidirectional (no feedback). If I get file attachment privileges in the future, I will post the PDF that includes both the RS232 and IP external control protocols. In the meantime, I have uploaded the PDF to my DropBox so anyone can download it (see link below).
I have not verified the protocol as all my LG TV models support RS232. At some point down the road, I will have to cross this bridge and get IP control to work. Some observations, it appears the TV must be powered on in order to accept commands. It would appear WOL is the only way to accomplish this programmatically. Secondly, there does not appear to be any feedback from commands other than OK or Error. If someone uses a remote control or manually changes input, volume, mute state, etc. on the TV, you will not be notified asynchronously through the protocol. Thirdly, the manual does not indicate whether an IP connection to the TV can remain open for an indefinite period of time. If it is necessary to open an IP connection to the TV each time you want to control it, this will be less than efficient not to mention slow. Lastly, an opinion and not an observation, the IP protocol (IP control of the TV) does not appear well thought out and seems to be a significant step backward from RS232 control.
https://www.dropbox.com/s/693o4n6wsq6gjot/LG TV External Control (RS232 and IP).pdf?dl=0
I will leave the DropBox link active until 2/28/19 at which time the link will expire.
Reading that PDF... there is NO "ON" command for IP control. Only OFF for power. There is this note:
You can turn on the TV, after setting the ‘Mobile TV On’ submenu (Setting > General > Mobile TV On) to
‘On’ and installing the app related with WOL (Wake On Lan) through iOS or Google Play on your mobile
phone.
So, no joy here.
Thanks for dropping the docs on us, Reese.
We can send Wake on LAN packets from controllers, but I think I was doing that, and it wasn't turning the TV on. It seemed like it needed the WOL packet, and then an immediate power on command, to actually power up. But, it's already been a few weeks since I was working on this. I know I never tried the specific "POWER on" string as a command when I could connect to the TV. However, I didn't keep detailed notes, and I don't really remember for sure anymore.
My impression, consistent with you guys, is that the Wake On LAN should power on the TV so that it can accept commands. The document is a little unclear whether the WOL only works from the apps or if it should work from any source including a Netlinx Master. I am not sure why a properly formatted Wake On LAN packet from a Netlinx Master would be any different than the same from a phone app. I don't have an IP model to test so I can't say for sure. If there is no way to 'wake' the TV from Netlinx so it can accept commands, then the protocol is really useless (for us anyway). If the Wake On LAN needs to be followed by a power ON command, it is neither clear from the document nor defined in the protocol specification. If I get further information, I will of course share.
Couple of questions for those of you that have tried Wake On Lan to the LG TV from Netlinx:
Several people have mentioned that when they enable IP control on the TV, they get a keycode but are unsure what to do with it. Can someone share a sample keycode with me? The reason I ask is that some devices protect Wake On LAN with a passcode and this passcode must be included in the WOL packet in order for the device to wake up. The passcode field in the WOL packet is the last 6 bytes and is $00,$00,$00,$00,$00,$00 if the device does not require a passcode otherwise the field must include the passcode expected by the device. If the keycode generated for the LG TV happens to be a 6 digit code, this might in fact be the passcode required in the WOL packet.
What is clear from the documentation is the ABSENCE of an ON command in the IP command listing, and an almost clear footnote saying you use WAKE ON LAN from a phone app to turn it on.
There IS NO ON COMMAND in the IP command list.
Perhaps you can install said app and wireshark the transaction suggested... if it even works.
Standard WOL - the passcode is optional. Some devices have a 'secure on' mode and require a passcode in order to acknowledge and respond to the WOL request. Not frequently used however. The passcode would follow the MAC address sequence in the WOL packet.
I almost wish it were within my scope to go back and take another swing at the TV I was dealing with. I'd like to try the passcode with the WOL packet and see if that did anything. Unfortunately I've lost track of the passcode the TV gave me, or I could at least share that.
Ha! I just found the scrap of paper I wrote the passcode on: B6pblCHi
It's obviously case sensitive. Not sure how you could translate that into a 6-byte hex string.
I was expecting a 6-character keycode if in fact this is a passcode that needs to be specified in the magic packet to wake the TV. So much for that theory ...
I know it's kind of late now, but I just dealt with this last week. After much fighting with the LG Displays and asking IT if they were blocking WOL packets and such, I finally found out that there is a secret installation menu in the displays we were using, and in the secret menu there was a setting for "Enable WakeOnLan" and after that was enabled I could turn the TVs on via WOL. After the TVs are on, you could control them via TCP port 9761 with the usual LG protocol:
ka 00 00 // power off
xb 00 90 // hdmi 1
xb 00 91 // hdmi 2
The network guy danced a jig around me when we found that menu because he had been racking his brain trying to figure out what in their network switches would be blocking it. I tried both the local broadcast (192.168.0.255) and the global broadcast (255.255.255.255) addresses on UDP port 9 and both worked. 6 bytes of $FF followed by the MAC address 16 times.
"$FF,$FF,$FF,$FF,$FF,$FF,$00,$0C,$7F,$10,$FA,$EB,$00,$0C,$7F,$10,$FA,$EB,$00,$0C,$7F,$10,$FA,$EB..."
LG Installation Menu:
https://www.lg.com/in/support/product-help/CT32003428-20150309396894-others
Thanks for the update & information! Especially the part about the network guy dancing a jig, it cracked me up.