Issue with LG smart tv

Also, anyway to get media controls working for example Play, Pause, Stop?

here's a workaround for Live TV

in the external input box try typing
com.webos.app.livetv

Hey @stevkevdyl. Thanks for the suggestion. I just tried this but it didn't work for me.

Sorry I messed up. I've edited my original post with the correct entry. Give it another try with that

com.webos.app.livetv

NICE ONE. That Works!

I've had this integration working for a long time until a couple months ago it suddenly stopped. I have it installed through HPM so everything should be up to date (I've even uninstalled and reinstalled it). It finds the TV and creates the device, but it doesn't include the pairing key. I tried using the key from my original install but I always see the same error message in the logs:
dev:23472023-11-26 09:06:58.277 AMerrorjava.lang.NullPointerException: Cannot invoke method multiply() on null object on line 389 (method webSocketStatus)

dev:23472023-11-26 09:06:58.082 AMinfoLG WebOS TV - 192.168.0.22 initialize() - Connecting websocket to: ws://192.168.0.22:3000/

I've looked at line 389, but I'm not sure what I'm looking at. Anyone have an idea?

The HPM is out of date (technically), if you look above, you can copy and paste the driver code and after a while it started working for me and at least 2 others I've seen in this thread

Thanks Biggsboi! I'm not sure why I didn't do that, but it worked! This one integration is used in many different rules for me.
So we're up to at least 4 of us this has worked for now.

1 Like

Not sure if I have understood the above correctly. I have updated to the version of driver given above, but I continue to receive "No route to host (Host unreachable)" in my logs from it. TV is off, so I can do WOL via RM scripts. I seem to be getting it every few seconds. What do i need to change. Otherwise, driver is working as intended.

I'm having issues getting the pairing key. I installed the code from HPM, did the camera discovery and it created the device. It found the IP and MAC Addresses but not the pairing key. After selecting "Initialize" from the device page, nothing happened on the hub or LG TV.

I then updated the driver code from one of the posts above, fixed line 331 and saved.

Went back to the device, hit initialize, same result - no pairing key.

Figured I'd delete the device and run the LG discovery app again, but I cannot remove the LG device - the Remove button is grayed out.

I suppose I could restore a backup and start from scratch but before I do that, just wondering if there is something I'm missing here.

Here is the log output

Thanks!

From what I remember, it filled in the pairing key itself - when you install it and set it up on the Hubitat, you'll need the TV on and the TV should prompt for permission for the Hubitat to connect to the TV.
I think it took a while as well (just started working by itself after a few hours)

OK, I had the TV on when hitting the Initialize button. From what you are saying, I'l have to leave the TV on for a few hours. The TV turns itself off after about 20 minutes, I'll have to find that setting and figure out how to disable it.

My use-cae is not to control the TV, but to have the TV state act as a trigger to execute rules. For example, if it is about 10 PM, if I turn off the TV, turn off some lights and set the thermostat for the night.

Thanks for the advice!

Sorry - the message on the TV should have come up pretty quickly.

I remember struggling with this a while back and I might be remembering poorly - as I thought that the pairing key took a while to come up but I'm doubting myself now and I might just be remembering what other people wrote in another thread! (The misery of getting this TV paired kind of melds into one :rofl: )

Yeah, I understand…. I tried again today, no luck. I wasn’t sure if the TV just sends a message to the screen regardless of what you have the input set to. I tried leaving it on the home screen but that didn’t work either.

I created the TV device on a windows laptop again from scratch using Chrome. Do you just let it sit there after hitting the initialize button or is there something else you need to do? You cannot save the device unless a pairing code is entered. That’s why the remove menu was greyed out in my prior post. I had to enter a bogus pairing code and save the device in order to delete it.

Let me know if any of this prompts any other suggestions.

Thx!

Thank you so much for this! I have been trying to figure this out for 2 days from the original thread on the driver - I wish it wasn't locked so you could update there! Appreciate the help!

Dear driver experts on this thread,

I successfully installed the driver and got the TV to respond. Then I noticed in the log that when the TV is off, the driver keeps "initialize()" every second or so. See log below. Is this an expected behavior? Is there a way to calm down these initialize cycles? Thank you very much for your help.

[dev:70](http://192.168.4.4/logs#)2024-02-17 05:51:16.626 PM[info](http://192.168.4.4/logs#)LG WebOS TV - 192.168.4.10 webSocketStatus() - WebSocket is open

[dev:70](http://192.168.4.4/logs#)2024-02-17 05:51:16.537 PM[info](http://192.168.4.4/logs#)LG WebOS TV - 192.168.4.10 initialize() - Connecting secure websocket to: wss://192.168.4.10:3001/

[dev:70](http://192.168.4.4/logs#)2024-02-17 05:51:14.651 PM[info](http://192.168.4.4/logs#)LG WebOS TV - 192.168.4.10 powerEvent() - is off [digital]

[dev:70](http://192.168.4.4/logs#)2024-02-17 05:51:14.584 PM[info](http://192.168.4.4/logs#)LG WebOS TV - 192.168.4.10 on() - Sending Magic Packet to: D8E35E59B198

[dev:70](http://192.168.4.4/logs#)2024-02-17 05:51:14.565 PM[info](http://192.168.4.4/logs#)LG WebOS TV - 192.168.4.10 powerEvent() - is on [digital]

[dev:70](http://192.168.4.4/logs#)2024-02-17 05:51:14.458 PM[info](http://192.168.4.4/logs#)LG WebOS TV - 192.168.4.10 webSocketStatus() - WebSocket connection closing

[dev:70](http://192.168.4.4/logs#)2024-02-17 05:51:14.424 PM[info](http://192.168.4.4/logs#)LG WebOS TV - 192.168.4.10 handler_getForegroundAppInfo() - Received POWER DOWN notification

[dev:70](http://192.168.4.4/logs#)2024-02-17 05:51:14.301 PM[info](http://192.168.4.4/logs#)LG WebOS TV - 192.168.4.10 powerEvent() - is off [physical]

[dev:70](http://192.168.4.4/logs#)2024-02-17 05:51:14.275 PM[info](http://192.168.4.4/logs#)LG WebOS TV - 192.168.4.10 volume is 32

[dev:70](http://192.168.4.4/logs#)2024-02-17 05:51:14.121 PM[info](http://192.168.4.4/logs#)LG WebOS TV - 192.168.4.10 webSocketStatus() - WebSocket is open

[dev:70](http://192.168.4.4/logs#)2024-02-17 05:51:14.027 PM[info](http://192.168.4.4/logs#)LG WebOS TV - 192.168.4.10 initialize() - Connecting secure websocket to: wss://192.168.4.10:3001/

[dev:70](http://192.168.4.4/logs#)2024-02-17 05:51:12.959 PM[info](http://192.168.4.4/logs#)LG WebOS TV - 192.168.4.10 webSocketStatus() - WebSocket connection closing

[dev:70](http://192.168.4.4/logs#)2024-02-17 05:51:12.937 PM[info](http://192.168.4.4/logs#)LG WebOS TV - 192.168.4.10 handler_getForegroundAppInfo() - Received POWER DOWN notification

[dev:70](http://192.168.4.4/logs#)2024-02-17 05:51:12.826 PM[info](http://192.168.4.4/logs#)LG WebOS TV - 192.168.4.10 powerEvent() - is off [physical]

[dev:70](http://192.168.4.4/logs#)2024-02-17 05:51:12.736 PM[info](http://192.168.4.4/logs#)LG WebOS TV - 192.168.4.10 volume is 32

[dev:70](http://192.168.4.4/logs#)2024-02-17 05:51:12.540 PM[info](http://192.168.4.4/logs#)LG WebOS TV - 192.168.4.10 webSocketStatus() - WebSocket is open

[dev:70](http://192.168.4.4/logs#)2024-02-17 05:51:12.463 PM[info](http://192.168.4.4/logs#)LG WebOS TV - 192.168.4.10 initialize() - Connecting secure websocket to: wss://192.168.4.10:3001/

[dev:70](http://192.168.4.4/logs#)2024-02-17 05:51:11.358 PM[info](http://192.168.4.4/logs#)LG WebOS TV - 192.168.4.10 webSocketStatus() - WebSocket connection closing

[dev:70](http://192.168.4.4/logs#)2024-02-17 05:51:11.339 PM[info](http://192.168.4.4/logs#)LG WebOS TV - 192.168.4.10 handler_getForegroundAppInfo() - Received POWER DOWN notification

[dev:70](http://192.168.4.4/logs#)2024-02-17 05:51:11.228 PM[info](http://192.168.4.4/logs#)LG WebOS TV - 192.168.4.10 powerEvent() - is off [physical]

[dev:70](http://192.168.4.4/logs#)2024-02-17 05:51:11.207 PM[info](http://192.168.4.4/logs#)LG WebOS TV - 192.168.4.10 volume is 32

[dev:70](http://192.168.4.4/logs#)2024-02-17 05:51:11.064 PM[info](http://192.168.4.4/logs#)LG WebOS TV - 192.168.4.10 webSocketStatus() - WebSocket is open

[dev:70](http://192.168.4.4/logs#)2024-02-17 05:51:10.974 PM[info](http://192.168.4.4/logs#)LG WebOS TV - 192.168.4.10 initialize() - Connecting secure websocket to: wss://192.168.4.10:3001/

[dev:70](http://192.168.4.4/logs#)2024-02-17 05:51:09.917 PM[info](http://192.168.4.4/logs#)LG WebOS TV - 192.168.4.10 webSocketStatus() - WebSocket connection closing

[dev:70](http://192.168.4.4/logs#)2024-02-17 05:51:09.892 PM[info](http://192.168.4.4/logs#)LG WebOS TV - 192.168.4.10 handler_getForegroundAppInfo() - Received POWER DOWN notification

[dev:70](http://192.168.4.4/logs#)2024-02-17 05:51:09.774 PM[info](http://192.168.4.4/logs#)LG WebOS TV - 192.168.4.10 powerEvent() - is off [physical]

[dev:70](http://192.168.4.4/logs#)2024-02-17 05:51:09.752 PM[info](http://192.168.4.4/logs#)LG WebOS TV - 192.168.4.10 volume is 32

[dev:70](http://192.168.4.4/logs#)2024-02-17 05:51:09.598 PM[info](http://192.168.4.4/logs#)LG WebOS TV - 192.168.4.10 powerEvent() - is on [physical]

[dev:70](http://192.168.4.4/logs#)2024-02-17 05:51:09.595 PM[info](http://192.168.4.4/logs#)LG WebOS TV - 192.168.4.10 webSocketStatus() - WebSocket is open

[dev:70](http://192.168.4.4/logs#)2024-02-17 05:51:09.523 PM[info](http://192.168.4.4/logs#)LG WebOS TV - 192.168.4.10 initialize() - Connecting secure websocket to: wss://192.168.4.10:3001/

[dev:70](http://192.168.4.4/logs#)2024-02-17 05:51:07.472 PM[info](http://192.168.4.4/logs#)LG WebOS TV - 192.168.4.10 webSocketStatus() - WebSocket connection closing

[dev:70](http://192.168.4.4/logs#)2024-02-17 05:51:07.457 PM[info](http://192.168.4.4/logs#)LG WebOS TV - 192.168.4.10 handler_getForegroundAppInfo() - Received POWER DOWN notification

[dev:70](http://192.168.4.4/logs#)2024-02-17 05:51:07.341 PM[info](http://192.168.4.4/logs#)LG WebOS TV - 192.168.4.10 powerEvent() - is off [physical]

[dev:70](http://192.168.4.4/logs#)2024-02-17 05:51:07.310 PM[info](http://192.168.4.4/logs#)LG WebOS TV - 192.168.4.10 volume is 32

[dev:70](http://192.168.4.4/logs#)2024-02-17 05:51:07.176 PM[info](http://192.168.4.4/logs#)LG WebOS TV - 192.168.4.10 powerEvent() - is on [physical]

[dev:70](http://192.168.4.4/logs#)2024-02-17 05:51:07.166 PM[info](http://192.168.4.4/logs#)LG WebOS TV - 192.168.4.10 webSocketStatus() - WebSocket is open

[dev:70](http://192.168.4.4/logs#)2024-02-17 05:51:07.067 PM[info](http://192.168.4.4/logs#)LG WebOS TV - 192.168.4.10 initialize() - Connecting secure websocket to: wss://192.168.4.10:3001/

On the TV device’s settings page there’s a configurable option for how often the driver attempts to refresh the websocket connection. Change it to something less frequent than 1 second, save preferences. That should do it, I think.

Ran across this thread while thinking about how to add my TV to my automation scheme. Added the driver and I am able to control the TV, but only if it's already on. Clicking the On button in the device page changes the "switch" state, but not the "power" state. How do I turn the TV on from Hubitat?

1 Like

I'd like this feature as well but I don't think it's possible. Currently using the LG ThinQ app to power on the TV.

Use WOL like in this thread