Issue with LG smart tv

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

Iā€™m able to turn my LG TV on and off from the deviceā€™s settings page in the Hubitat user interface.

Interesting. I used a WOL app on my phone that I use for my PC's, and it woke the TV up and turned it on.

So I suppose I could add WOL to Hubitat, but I'd much rather just have the TV device work properly.

In either case, how do I use my LG TV device in automations? I want to push a button and have the TV turn on and go to a specific input, depending on the button pushed. But I couldn't figure out how to do it.

I have 2 2023 LG C3 TVs and would like to set this up. I used HPM to load Syepes discovery. It does find the TVs but when i look at the device and try initialize, nothing seems to happen. I seem to be missing a step. TV on with WIFI and BT are both set to on.

Never seems to get pairing key. is there a way to force or find the key?

Thanks for help!

1 Like

You can use the Button Controller app to turn a TV on and set the input. ā€œOnā€ is a switch action, and setting the input can be done under ā€œcustom actions.ā€

However, Iā€™d suggest first trying to get the TV to function as intended directly from its Hubitat device page.

How did you add the device driver? Was it one of the updated versions posted earlier in this thread?

If you read above in this thread, youā€™ll see it no longer works without making an update to the driver code manually. With the update to enable secure websockets, it should still function.

Thanks that did fix it.
I did copy the first one back in the list and it had some errors. I went a couple back from that and no errors.
It is working now!!

1 Like

I went to Driver code, clicked New driver, and pasted the code from earlier in this thread. I don't remember which version I copied, though. The error with the additional parenthesis was throwing me off for a bit. Maybe I'll try updating the code.

I looked at the button controller rules, and I'm confused. Is setting the input an HTTP request? When I choose custom action, run custom action, it just gives me a big long list of stuff that I don't know how to relate to the TV device.

I tried to add a picture to this, but it gives me an error...

Looking at the live logs, this is what shows when I click the On button in the device page:

dev:33 2024-03-13 09:45:26.620 PMinfoLiving Room TV powerEvent() - is off [physical]
dev:33 2024-03-13 09:45:26.618 PMinfoLiving Room TV webSocketStatus() - WebSocket is closed
dev:33 2024-03-13 09:45:23.547 PMinfoLiving Room TV initialize() - Connecting secure websocket to: wss://192.168.0.38:3001/
dev:33 2024-03-13 09:45:23.545 PMerrorLiving Room TV getMouseChild() - Failed to get mouse dev: com.hubitat.app.exception.UnknownDeviceTypeException: Device type 'LG WebOS Mouse' in namespace 'syepes' not found
dev:33 2024-03-13 09:45:10.364 PMinfoLiving Room TV on() - Sending Magic Packet to: 48:8D:36:F2:B1:05
dev:33 2024-03-13 09:45:10.351 PMinfoLiving Room TV powerEvent() - is on [digital]

Is there a way to manually add the Mac and IP instead of doing the discovery? I only ask because my habitat and my TV are not on the same vlan.

@mo.hesham When I paste your code I get this error

expecting '}', found ')' @ line 331, column 87.