[PORT] LG Smart TV Discovery 2012+

Does turning it on via hardwired Ethernet work via the LG Smartify app?

No, LG Smartify can't turn it ON either :thinking:

I can see the TV in my Unifi dashboard so the TV is still connected to the network.

In the log it says failure to route to host:

dev:12922019-10-08 13:55:43.020 debugScheduling reconnect in 60 seconds

dev:12922019-10-08 13:55:43.016 infowebsocket reconnect - delay = 60

dev:12922019-10-08 13:55:43.012 debugsendPowerEvent: sending state.power = OFF event

dev:12922019-10-08 13:55:43.009 debugfailure: No route/connect timeout/no pong for websocket protocol

dev:12922019-10-08 13:55:43.006 debugsetPaired: setting state.paired = FALSE

dev:12922019-10-08 13:55:43.003 debugfailure message from web socket failure: No route to host (Host unreachable)

dev:12922019-10-08 13:55:43.000 debugwebSocketStatus: State: [initialize] Reported Status: [failure: No route to host (Host unreachable)]

dev:12922019-10-08 13:55:39.852 debugConnecting websocket to: "ws://192.168.102.96:3000/"

dev:12922019-10-08 13:55:39.803 debugsetPower: setting state.power = OFF

dev:12922019-10-08 13:55:39.791 debugsetPaired: setting state.paired = FALSE

dev:12922019-10-08 13:55:39.781 debugLG Smart TV Driver - initialize - settings:['televisionIp':'192.168.102.96', 'debug':true, 'descriptionText':true, 'channelDetail':false, 'retryDelay':'60', 'televisionType':'WEBOS', 'televisionMac':'c8:08:e9:bb:65:8b', 'pairingKey':'5b4bf895abae4380b6c5a180f514adba']

dev:12922019-10-08 13:55:39.777 debugLG Smart TV Driver - initialize - ip: 192.168.102.96 mac: c8:08:e9:bb:65:8b type: WEBOS key: 5b4bf895abae4380b6c5a180f514adba debug: true logText: true

dev:12922019-10-08 13:55:01.304 infoSending Magic Packet to: wake on lan c8:08:e9:bb:65:8b

dev:12922019-10-08 13:55:01.301 debugSending Magic Packet to: c8:08:e9:bb:65:8b

dev:12922019-10-08 13:55:01.298 debugsendPowerEvent: sending state.power = ON state change event

dev:12922019-10-08 13:55:01.293 debugExecuting 'Power On'

Can you use a change in the input as a trigger? I currently use a change in input to trigger the corresponding Harmony Activity (to ensure my Harmony remote stays in sync if a different remote or Alexa is used) using HomeAssistant and wondering if I can move all that logic into Hubitat.

1 Like

Change in input source I believe sends an event so I thin you can.

Speaking of change in input....

Can this app be used to switch between LG apps....say, between a streaming app and the web browser and a different streaming app back to the antenna? Separately, I have my AVR integrated with HE by way of the Denon driver, so I can switch inputs NP. What I can't figure out is how to switch between different streaming apps or between streaming and the web browser.

For background, I have this app and driver set up for my LG OLED55C8PUA TV. Can turn on/off, change channels, volume up/down, etc. A beautiful app to be sure!

That's the ONE thing I want. When I ask for that, it replies permission denied. The remote LG app can do it, but it does a more complicated pairing, it requires you to enter a pin. So I need to investigate asking for more permissions and see if it's possible. I've kind of strayed off into other areas at the moment but I need to come back to the humble LG app.

1 Like

What kind of BULL**** is this???

You've "strayed off"??? You "need to come back"????

There is nothing to come back to... You were never even near!!!

You did not contribute to the driver... It was created for NETCAST by Sam Lalor (on the ST forums), ported to HE by @ekimmagrann and updated for WebOS by myself...

The only thing you did... You literally took other peoples code and put it on your github repository!!

Currently... You can't...

I'm currently testing additional functions to allow launching apps and the browser...

@cybrmage...

Yes, I created a fork and put it under source control. I never claimed credit for the original app, nor removed headers nor changed the license.

If you'd like a link to what you can do with Apache 2.0 licensed code please have a look here: https://www.apache.org/licenses/LICENSE-2.0

Can I help with testing? Willing to put in the time.....

@asj I just bought a 2019 model and the discovery app is not finding the tv. I was able to use the LG phone app to discover and control my TV. Any suggestions? The driver and app I downloaded was just updated two days ago. It's been searching for over 15 minutes now and is not finding the TV I also used the other versions of the driver and app for Hubitat without success. Thanks for any guidance you can provide.

@joetlawson Hmmm, You can just add the driver by hand (Devices->Add Virtual Device->LG WebOS TV) and set the IP address. Turn on debug logs, and see if it connects and works with the TV.

Note: I've made some pretty big changes recently and I'm planning on making some more. The LG WebOS mouse driver is very much a work in progress, steer clear of using it for now. I'm also changing the name due to feedback I've received so to avoid confusing with the original app/driver. They did great work, and I won't want to take credit or step on toes for their work.

2 Likes

This is what my logs look like I didn't try to add manually with your driver but I did with the previous driver and app and had the same results.

dev:9692019-11-29 09:14:27.003 am errorjava.lang.NullPointerException: Cannot invoke method next() on null object on line 784 (off)

dev:9692019-11-29 09:14:26.949 am debugsendCommand: {"type":"request","id":"command_null","uri":"ssap://system/turnOff"}

dev:9692019-11-29 09:14:26.936 am debugsendPowerEvent: sending state.power off was: null

dev:9692019-11-29 09:14:26.929 am debugExecuting 'Power Off'

dev:9692019-11-29 09:14:26.300 am errorjava.lang.NullPointerException: Cannot invoke method next() on null object on line 790 (ok)

dev:9692019-11-29 09:14:24.585 am infoSending Magic Packet to: wake on lan 2C:2B:F9:ED:DB:8A

dev:9692019-11-29 09:14:24.579 am debugSending Magic Packet to: 2C:2B:F9:ED:DB:8A

dev:9692019-11-29 09:14:24.572 am debugsendPowerEvent: sending state.power on was: null

dev:9692019-11-29 09:14:24.565 am debugExecuting 'Power On'

dev:9692019-11-29 09:14:22.752 am errorcom.hubitat.app.exception.UnknownDeviceTypeException: Device type 'LG Mouse WebSocket Driver' in namespace 'asj' not found on line 302 (initialize)

dev:9692019-11-29 09:14:22.515 am debugsetPower: setting state.power = OFF

dev:9692019-11-29 09:14:22.511 am debugsetPaired: setting state.paired = FALSE

dev:9692019-11-29 09:14:22.489 am debugLG Smart TV Driver - initialize - settings:['televisionIp':'10.1.10.99', 'televisionType':'WEBOS', 'debug':false, 'descriptionText':true, 'channelDetail':false, 'retryDelay':'60', 'televisionMac':'2C:2B:F9:ED:DB:8A']

dev:9692019-11-29 09:14:22.477 am debugLG Smart TV Driver - initialize - ip: 10.1.10.99 mac: 2C:2B:F9:ED:DB:8A type: WEBOS key: null debug: false logText: true

dev:9692019-11-29 09:14:20.513 am errorjava.lang.NullPointerException: Cannot invoke method next() on null object on line 784 (mute)

dev:9692019-11-29 09:14:20.457 am debugsendCommand: {"type":"request","id":"command_null","uri":"ssap://audio/setMute","payload":{"mute":true}}

dev:9692019-11-29 09:14:20.449 am debugExecuting 'mute'

dev:9692019-11-29 09:14:18.240 am errorjava.lang.NullPointerException: Cannot get property 'null' on null object on line 660 (externalInput)

dev:9692019-11-29 09:14:12.423 am errorcom.hubitat.app.exception.UnknownDeviceTypeException: Device type 'LG Mouse WebSocket Driver' in namespace 'asj' not found on line 302 (updated)

dev:9692019-11-29 09:14:12.054 am debugsetPower: setting state.power = OFF

dev:9692019-11-29 09:14:12.049 am debugsetPaired: setting state.paired = FALSE

dev:9692019-11-29 09:14:11.986 am debugLG Smart TV Driver - initialize - settings:['televisionIp':'10.1.10.99', 'televisionType':'WEBOS', 'debug':false, 'descriptionText':true, 'channelDetail':false, 'retryDelay':'60', 'televisionMac':'2C:2B:F9:ED:DB:8A']

dev:9692019-11-29 09:14:11.973 am debugLG Smart TV Driver - initialize - ip: 10.1.10.99 mac: 2C:2B:F9:ED:DB:8A type: WEBOS key: null debug: false logText: true

dev:9692019-11-29 09:14:11.962 am debugLG Smart TV Driver - updated - ip: 10.1.10.99 mac: 2C:2B:F9:ED:DB:8A type: WEBOS key: null debug: false logText: true state: ['power':'on']

dev:9692019-11-29 09:14:11.951 am debugLG Smart TV Driver - updated - ip: 10.1.10.99 mac: 2C:2B:F9:ED:DB:8A type: WEBOS key: null debug: false logText: true state: ['power':'on']

dev:9692019-11-29 09:13:06.521 am infoSending Magic Packet to: wake on lan null

dev:9692019-11-29 09:13:06.506 am debugSending Magic Packet to: null

dev:9692019-11-29 09:13:06.493 am debugsendPowerEvent: sending state.power on was: null

dev:9692019-11-29 09:13:06.483 am debugExecuting 'Power On'

dev:9692019-11-29 09:13:05.901 am errorjava.lang.NullPointerException: Cannot invoke method next() on null object on line 790 (ok)

dev:9692019-11-29 09:13:04.456 am errorjava.lang.NullPointerException: Cannot invoke method next() on null object on line 790 (ok)

dev:9692019-11-29 09:13:01.709 am errorjava.lang.NullPointerException: Cannot invoke method next() on null object on line 784 (off)

dev:9692019-11-29 09:13:01.650 am debugsendCommand: {"type":"request","id":"command_null","uri":"ssap://system/turnOff"}

dev:9692019-11-29 09:13:01.642 am debugsendPowerEvent: sending state.power off was: null

dev:9692019-11-29 09:13:01.634 am debugExecuting 'Power Off'

dev:9692019-11-29 09:13:00.481 am errorjava.lang.NullPointerException: Cannot invoke method next() on null object on line 784 (myApps)

dev:9692019-11-29 09:13:00.424 am debugsendCommand: {"type":"request","id":"command_null","uri":"ssap://system.launcher/launch","payload":{"id":"com.webos.app.discovery"}}

dev:9692019-11-29 09:12:58.761 am errorjava.lang.NullPointerException: Cannot invoke method next() on null object on line 784 (mute)

dev:9692019-11-29 09:12:58.698 am debugsendCommand: {"type":"request","id":"command_null","uri":"ssap://audio/setMute","payload":{"mute":true}}

dev:9692019-11-29 09:12:58.690 am debugExecuting 'mute'

dev:9692019-11-29 09:12:58.353 am errorcom.hubitat.app.exception.UnknownDeviceTypeException: Device type 'LG Mouse WebSocket Driver' in namespace 'asj' not found on line 302 (initialize)

dev:9692019-11-29 09:12:57.954 am debugsetPower: setting state.power = OFF

dev:9692019-11-29 09:12:57.949 am debugsetPaired: setting state.paired = FALSE

dev:9692019-11-29 09:12:57.929 am debugLG Smart TV Driver - initialize - settings:['televisionIp':'10.1.10.99', 'televisionType':'WEBOS', 'debug':false, 'descriptionText':true, 'channelDetail':false, 'retryDelay':'60']

dev:9692019-11-29 09:12:57.918 am debugLG Smart TV Driver - initialize - ip: 10.1.10.99 mac: null type: WEBOS key: null debug: false logText: true

dev:9692019-11-29 09:12:56.681 am errorcom.hubitat.app.exception.UnknownDeviceTypeException: Device type 'LG Mouse WebSocket Driver' in namespace 'asj' not found on line 302 (initialize)

dev:9692019-11-29 09:12:56.446 am debugsetPower: setting state.power = OFF

dev:9692019-11-29 09:12:56.442 am debugsetPaired: setting state.paired = FALSE

dev:9692019-11-29 09:12:56.422 am debugLG Smart TV Driver - initialize - settings:['televisionIp':'10.1.10.99', 'televisionType':'WEBOS', 'debug':false, 'descriptionText':true, 'channelDetail':false, 'retryDelay':'60']

dev:9692019-11-29 09:12:56.411 am debugLG Smart TV Driver - initialize - ip: 10.1.10.99 mac: null type: WEBOS key: null debug: false logText: true

dev:9692019-11-29 09:12:53.576 am errorcom.hubitat.app.exception.UnknownDeviceTypeException: Device type 'LG Mouse WebSocket Driver' in namespace 'asj' not found on line 302 (initialize)

dev:9692019-11-29 09:12:53.374 am debugsetPower: setting state.power = OFF

dev:9692019-11-29 09:12:53.369 am debugsetPaired: setting state.paired = FALSE

dev:9692019-11-29 09:12:53.347 am debugLG Smart TV Driver - initialize - settings:['televisionIp':'10.1.10.99', 'televisionType':'WEBOS', 'debug':false, 'descriptionText':true, 'channelDetail':false, 'retryDelay':'60']

dev:9692019-11-29 09:12:53.335 am debugLG Smart TV Driver - initialize - ip: 10.1.10.99 mac: null type: WEBOS key: null debug: false logText: true

dev:9692019-11-29 09:12:52.238 am errorjava.lang.NullPointerException: Cannot invoke method next() on null object on line 790 (home)

dev:9692019-11-29 09:12:52.175 am debugOLD Inputs: null total length: 3

dev:9692019-11-29 09:12:48.545 am errorjava.lang.NullPointerException: Cannot invoke method next() on null object on line 784 (channelUp)

dev:9692019-11-29 09:12:48.348 am debugsendCommand: {"type":"request","id":"command_null","uri":"ssap://tv/channelUp"}

dev:9692019-11-29 09:12:48.332 am debugExecuting 'channelUp'

dev:9692019-11-29 09:12:46.119 am errorjava.lang.NullPointerException: Cannot invoke method next() on null object on line 790 (deviceNotification)

dev:9692019-11-29 09:12:46.054 am errorjava.lang.NullPointerException: Cannot invoke method next() on null object on line 790 (deviceNotification)

dev:9692019-11-29 09:12:32.182 am errorjava.lang.NullPointerException: Cannot get property 'null' on null object on line 660 (externalInput)

dev:9692019-11-29 09:12:26.568 am errorcom.hubitat.app.exception.UnknownDeviceTypeException: Device type 'LG Mouse WebSocket Driver' in namespace 'asj' not found on line 302 (updated)

dev:9692019-11-29 09:12:26.241 am debugsetPower: setting state.power = OFF

dev:9692019-11-29 09:12:26.235 am debugsetPaired: setting state.paired = FALSE

dev:9692019-11-29 09:12:26.217 am debugLG Smart TV Driver - initialize - settings:['televisionIp':'10.1.10.99', 'televisionType':'WEBOS', 'debug':false, 'descriptionText':true, 'channelDetail':false, 'retryDelay':'60']

dev:9692019-11-29 09:12:26.205 am debugLG Smart TV Driver - initialize - ip: 10.1.10.99 mac: null type: WEBOS key: null debug: false logText: true

dev:9692019-11-29 09:12:26.195 am debugLG Smart TV Driver - updated - ip: 10.1.10.99 mac: null type: WEBOS key: null debug: false logText: true state: [:]

dev:9692019-11-29 09:12:26.184 am debugLG Smart TV Driver - updated - ip: 10.1.10.99 mac: null type: WEBOS key: null debug: false logText: true state: [:]

dev:9692019-11-29 09:11:39.337 am debugLG Smart TV Driver - installed - settings: ['televisionIp':null, 'televisionMac':null, 'televisionType':null, 'pairingKey':null, 'debug':false, 'descriptionText':true, 'channelDetail':false, 'retryDelay':'60']

Hmm, odd, this is the message I was looking for is the "Connect to websocket..." . I just tried creating a device by hand with the IP address filled in. On() won't work without the mac address, and by default it only polls the TV every 60s trying to connect. So:

  1. Make sure the TV is on
  2. There's no dialogs in the screen. (ex: "Do you want to change input?")
  3. Wait 60s until you see "Connecting..." in the logs. Look for errors after that.
  4. You should then see a pairing dialog asking to allow a connection

If the TV is off in my case it says:

dev:972019-11-29 06:41:19.358 am debug failure: No route/connect timeout/no pong for websocket protocol
dev:972019-11-29 06:41:19.357 am debug setPaired: setting state.paired = FALSE
dev:972019-11-29 06:41:19.353 am debug failure message from web socket failure: No route to host (Host unreachable)
dev:972019-11-29 06:41:19.349 am debug webSocketStatus: State: [initialize]   Reported Status: [failure: No route to host (Host unreachable)]
dev:972019-11-29 06:41:16.207 am debug Connecting websocket to: "ws://192.168.7.36:3000/"

If it's on it should say:

...Lots of messages...
dev:1342019-11-29 07:45:25.603 am debug webosPollStatus - paired = FALSE  currentInput = null
dev:1342019-11-29 07:45:24.582 am info websocket is open
dev:1342019-11-29 07:45:24.579 am debug webSocketStatus: State: [initialize]   Reported Status: [status: open]
dev:1342019-11-29 07:45:24.474 am debug Connecting websocket to: "ws://192.168.7.36:3000/"

Oh @joetlawson make sure you install the LG Mouse Driver, from my repo. My code must be able to add the child device, you can see the error in the logs. If it can't it won't try and connect due to the error.

Yeah I'm not even seeing it ask for the pairing key.

dev:9692019-11-29 06:38:48.495 pm errorjava.lang.NullPointerException: Cannot invoke method next() on null object on line 784 (channelUp)

dev:9692019-11-29 06:38:48.444 pm debugsendCommand: {"type":"request","id":"command_null","uri":"ssap://tv/channelUp"}

dev:9692019-11-29 06:38:48.433 pm debugExecuting 'channelUp'

dev:9692019-11-29 06:38:30.949 pm errorjava.lang.NullPointerException: Cannot get property 'null' on null object on line 660 (externalInput)

dev:9692019-11-29 06:37:08.045 pm errorjava.lang.NullPointerException: Cannot invoke method next() on null object on line 784 (myApps)

dev:9692019-11-29 06:37:07.993 pm debugsendCommand: {"type":"request","id":"command_null","uri":"ssap://system.launcher/launch","payload":{"id":"com.webos.app.discovery"}}

dev:9692019-11-29 06:37:01.885 pm errorcom.hubitat.app.exception.UnknownDeviceTypeException: Device type 'LG Mouse WebSocket Driver' in namespace 'asj' not found on line 302 (updated)

dev:9692019-11-29 06:37:01.591 pm debugsetPower: setting state.power = OFF

dev:9692019-11-29 06:37:01.585 pm debugsetPaired: setting state.paired = FALSE

dev:9692019-11-29 06:37:01.570 pm debugLG Smart TV Driver - initialize - settings:['televisionIp':'10.1.10.99', 'televisionType':'WEBOS', 'debug':false, 'descriptionText':true, 'channelDetail':false, 'retryDelay':'30', 'televisionMac':'2C:2B:F9:ED:DB:8A']

dev:9692019-11-29 06:37:01.552 pm debugLG Smart TV Driver - initialize - ip: 10.1.10.99 mac: 2C:2B:F9:ED:DB:8A type: WEBOS key: null debug: false logText: true

dev:9692019-11-29 06:37:01.541 pm debugLG Smart TV Driver - updated - ip: 10.1.10.99 mac: 2C:2B:F9:ED:DB:8A type: WEBOS key: null debug: false logText: true state: ['power':'on']

dev:9692019-11-29 06:37:01.528 pm debugLG Smart TV Driver - updated - ip: 10.1.10.99 mac: 2C:2B:F9:ED:DB:8A type: WEBOS key: null debug: false logText: true state: ['power':'on']

dev:9692019-11-29 06:36:31.760 pm errorjava.lang.NullPointerException: Cannot invoke method next() on null object on line 784 (myApps)

dev:9692019-11-29 06:36:31.702 pm debugsendCommand: {"type":"request","id":"command_null","uri":"ssap://system.launcher/launch","payload":{"id":"com.webos.app.discovery"}}

dev:9692019-11-29 06:36:11.445 pm errorjava.lang.NullPointerException: Cannot invoke method next() on null object on line 790 (ok)

dev:9692019-11-29 06:35:44.743 pm errorjava.lang.NullPointerException: Cannot invoke method next() on null object on line 790 (home)

dev:9692019-11-29 06:35:44.675 pm debugOLD Inputs: null total length: 10

dev:9692019-11-29 06:35:12.843 pm errorjava.lang.NullPointerException: Cannot invoke method next() on null object on line 784 (channelDown)

dev:9692019-11-29 06:35:12.791 pm debugsendCommand: {"type":"request","id":"command_null","uri":"ssap://tv/channelDown"}

dev:9692019-11-29 06:35:12.779 pm debugExecuting 'channelDown'

dev:9692019-11-29 06:34:57.864 pm errorjava.lang.NullPointerException: Cannot invoke method next() on null object on line 790 (deviceNotification)

dev:9692019-11-29 06:34:46.458 pm errorjava.lang.NullPointerException: Cannot invoke method next() on null object on line 790 (deviceNotification)

dev:9692019-11-29 06:33:47.888 pm errorjava.lang.NullPointerException: Cannot invoke method next() on null object on line 790 (deviceNotification)

--- Live Log Started, waiting for events ---

I'm wondering if it is something with my network though as I'm not able to discover chromecast devices. Weird though I have a few TCL Roku TV's and have no trouble with them.

@joetlawson So there's at least 2 problems, not network related:

  1. Delete all instances of the LG app, devices and drivers.
  2. There's a bug in the driver, so update my code: go to github link and install the latest code for the app and 2 drivers.
  3. Make sure the TV is on and on the network, this can take 2+ mins after powering up.

Don't click various buttons in the driver, that just adds noise to the logs. It'll either initialize automatically every 60 seconds, or you can help it along and click Initialize, which forces the driver to reconnect the socket.

This line is causing to to not even try and connect since the Mouse driver is not installed, this is fixed in my latest update so it just ignores a missing driver:

The others I don't get exactly, but I think it's just random commands on a driver that hasn't ever connected to a TV once.

I was just starting to tear into the driver again and didn't anticipate someone installing the new code, but it should be ok, and now no worse than what was there before.

1 Like

That worked it was not able to discover the TV but when I added a virtual device I finally got the option to pair with the TV. Thank you so much for your help this is great and love that we can send notifications to the TV. Do you know if this can be setup in rules?

OK this is flipping awesome the TV is listed as a notification device and I just tested it successfully.

Download the Hubitat app