[PORT] LG Smart TV Discovery 2012+

I think if it works with LG Remote then it should work. Can you post your logs when it is in discovery mode? Are you on wired or wireless not that it should matter!

sorry for the delay in response. Here is the requested log:

hub: 1
upnp: [mac:001788A988DE, ip:C0A801FD, ssdpPath:/description.xml, ssdpUSN:uuid:2f402f80-da50-11e1-9b23-001788a988de, ssdpTerm:urn:schemas-upnp-org:device:basic:1]
Found ssdpPath: /description.xml
Device Location Event: mac:001788A988DE, networkAddress:C0A801FD, deviceAddress:50, ssdpPath:/description.xml, ssdpUSN:uuid:2f402f80-da50-11e1-9b23-001788a988de, ssdpTerm:urn:schemas-upnp-org:device:basic:1, ssdpNTS:
hub: 1
upnp: [mac:001788A988DE, ip:C0A801FD, ssdpPath:/description.xml, ssdpUSN:uuid:2f402f80-da50-11e1-9b23-001788a988de, ssdpTerm:uuid:2f402f80-da50-11e1-9b23-001788a988de]
Found ssdpPath: /description.xml
Device Location Event: mac:001788A988DE, networkAddress:C0A801FD, deviceAddress:50, ssdpPath:/description.xml, ssdpUSN:uuid:2f402f80-da50-11e1-9b23-001788a988de, ssdpTerm:uuid:2f402f80-da50-11e1-9b23-001788a988de, ssdpNTS:
hub: 1
upnp: [mac:001788A988DE, ip:C0A801FD, ssdpPath:/description.xml, ssdpUSN:uuid:2f402f80-da50-11e1-9b23-001788a988de::upnp:rootdevice, ssdpTerm:upnp:rootdevice]
Found ssdpPath: /description.xml
Device Location Event: mac:001788A988DE, networkAddress:C0A801FD, deviceAddress:50, ssdpPath:/description.xml, ssdpUSN:uuid:2f402f80-da50-11e1-9b23-001788a988de::upnp:rootdevice, ssdpTerm:upnp:rootdevice, ssdpNTS:
hub: 1
upnp: [mac:001788A988DE, ip:C0A801FD, ssdpPath:/description.xml, ssdpUSN:uuid:2f402f80-da50-11e1-9b23-001788a988de, ssdpTerm:urn:schemas-upnp-org:device:basic:1]
Found ssdpPath: /description.xml
Device Location Event: mac:001788A988DE, networkAddress:C0A801FD, deviceAddress:50, ssdpPath:/description.xml, ssdpUSN:uuid:2f402f80-da50-11e1-9b23-001788a988de, ssdpTerm:urn:schemas-upnp-org:device:basic:1, ssdpNTS:
hub: 1
upnp: [mac:001788A988DE, ip:C0A801FD, ssdpPath:/description.xml, ssdpUSN:uuid:2f402f80-da50-11e1-9b23-001788a988de, ssdpTerm:uuid:2f402f80-da50-11e1-9b23-001788a988de]
Found ssdpPath: /description.xml
Device Location Event: mac:001788A988DE, networkAddress:C0A801FD, deviceAddress:50, ssdpPath:/description.xml, ssdpUSN:uuid:2f402f80-da50-11e1-9b23-001788a988de, ssdpTerm:uuid:2f402f80-da50-11e1-9b23-001788a988de, ssdpNTS:
hub: 1
upnp: [mac:001788A988DE, ip:C0A801FD, ssdpPath:/description.xml, ssdpUSN:uuid:2f402f80-da50-11e1-9b23-001788a988de::upnp:rootdevice, ssdpTerm:upnp:rootdevice]
Found ssdpPath: /description.xml
Device Location Event: mac:001788A988DE, networkAddress:C0A801FD, deviceAddress:50, ssdpPath:/description.xml, ssdpUSN:uuid:2f402f80-da50-11e1-9b23-001788a988de::upnp:rootdevice, ssdpTerm:upnp:rootdevice, ssdpNTS:
Looking for TV's

The device it finds is my HUE bridge. but, no response from the TV.

The TV is connected only via Ethernet and is not connected to WiFi. When I setup the LG Remote, my phone was on WiFi on my home network.

Just trying to figure out if I am missing some magical setting on the TV I don't know about. I felt it was using a different method to communicate because the URLs and such are different in the source code of this app and the python script Home Assistant uses, which worked with my TV.

So not sure why it is not working. I assume your tv is on when you are trying to connect.

Sorry for the long delay in response, but yes, the TV is on.

I still believe it is due to using a different method to communicate, and my TV just doesn't have it. Maybe it was removed from 2018 models. You can clearly see in the code it uses a different method than the Python module used by Home Assistant, and that one worked just fine.

Guess I can wait for someone to port the other method over, or learn how to program in Groovy. Either way, thank you very much for helping and contributing to the community! This will be useful to a lot of people.

Hi

I am getting the same issue as mrunknown....

My old TV was found without any issues but the new TV I bought today to replace it cannot be found. I can find it on the network, ping it and even wake on lan - just cannto get it to work on hubitat.

Sorry guys I am not sure where to look here. I have maybe a 2016 model that works. I have a smaller LG that is newer that won't work but I don't think it would even work with the LG app.

I have modified the port created by @ekimmagrann so that it will work with the 2012-16 NetTV LG Models AND the 2016 and newer WebOS LG models. (I have tested it on a UJ6200 (2017) and UK6190 (2018) - both WebOS models)

I have also managed to fix the two issues that were noted in the release notes... The Wake On Lan feature and the passing of parameters from Application to Driver.

The new application and driver files are available in a handy zip file... [UPDATE AVAILABLE BELOW]

Please Note:
For older (variously refered to as NetTV or NetCast models) TV's, the pairing process has not changed, and is performed in the Discovery application.
For newer (WebOS) TVs, the communications with the TV is done via WebSockets. WebSockets are only available in Drivers, so the pairing in done by the driver. Once you have used the Discovery application to discover and select your TV, the Application gives you a reminder that pairing is done by the Driver. Once the discovery application creates the driver, the driver with attempt to register with the TV, and you will need to use your TV remote to authorize the connection from the driver.

1 Like

Hi @cybrmage
I am trying to get my TV to pair with your updated App/Driver.
The Tv is detected and I get to the " WebOS TVs can not be paired from the application. The driver will attempt to pair with the TV when it is initialized. Please authorize the pairing from the TV using the TV remote control. Please click Done." stage.

At that point, I do not get a request on TV screen for a Pairing Key and nothing happens.
I click on done and there is a new LG Smart TV in Devices with a DNI. when I click on the device, I get the below.

State Variables

  • sequenceNumber : 1
  • reconnectPending : false
  • pairFailCount : 0
  • paired : false
  • Power : true

This doesn't change after time.
It is 2016 WEBOS TV
Logs below Tnx

dev:2572019-07-23 19:09:12.633 warnConnection refused (Connection refused)

dev:2572019-07-23 19:09:12.620 warnhub action: POST /roap/api/auth HTTP/1.1 Accept: / User-Agent: Linux UPnP/1.0 Hubitat HOST: 192.168.100.80:8080 Content-Type: application/atom+xml Content-Length: 90 AuthReqnull

dev:2572019-07-23 19:09:12.614 debugExecuting 'refresh'

dev:382019-07-23 19:08:47.288 infoXiaomi Original Motion Sensor: Detected motion

app:1312019-07-23 19:07:37.471 errorjava.lang.NullPointerException: Cannot get property 'id' on null object on line 171 (updated)

app:1312019-07-23 19:07:37.421 debugDevice with id C0A86450_3CCD93712C3E_WEBOS_0BB8 already created - Updating

app:1312019-07-23 19:07:37.411 debugLG Smart TV Discovery - addDevice - ip: 192.168.100.80 mac: 3CCD93712C3E type: WEBOS pairKey: null dni: C0A86450_3CCD93712C3E_WEBOS_0BB8

app:1312019-07-23 19:07:37.395 debugUpdated with settings: [selectedTv:3CCD93712C3E!C0A86450!1!WEBOS]

app:1312019-07-23 19:06:49.508 debugDiscovered List: device=3CCD93712C3E!C0A86450!1!WEBOS

Looks like I messed up the parameter passing...

Try this updated version (update both app and driver)... [updated below]

Once you update the files, remove the app and reinstall it.

1 Like

UPDATE: Added Notifications, status subscription, event propagation, etc... [update below]

Worked Mate. Tnx.
Any recommendations?
Power On doesn't seem to work.

My TV (2014/2015 Model I believe)

  • ModelName : 65LB7500-TE
  • deviceOS : webOS
  • deviceOSVersion : 4.0.3
  • deviceOSReleaseVersion : 1.4.0

Your TV is a 2014 WebOS v1.4 model. WebOS < v3.0 typically do not support wake on lan.

If your TV does not have the "Mobile TV On" option under Settings -> General, and does not have the "LG Connect Apps" option under Settings -> Network, then you will need to use another method to power on your set (CEC control, Chromecast, IR control, etc).

1 Like

I'm using your handler and everything works great except for power on/off state detection when the TV is switched on via remote or other means.

I had a homeassistant integration that accomplished this by pinging the TV periodically to establish whether the TV was on or off. It was still imperfect because these OLED TVs don't really go "off" when you turn it off via the remote - it does a pixel refresh routine while the screen is turned off. While this is running, the TV will respond to ping, so it looks like it's on when it's really not.

This used to really mess up my automations that depended on my TV power state, I eventually just used a power monitoring plug to figure out state changes properly.

The driver will detect a "power off" in one of two ways.... You explicitly send a "power off" command... or the websocket closes (which happens when the TV turns off). It likewise determines power on in one of two ways... You explicitly send a "power on" command, or the websocket is able to reconnect to the TV (a reconnect is attempted every 60 seconds when the websocket is disconnected).

If the TV keeps the network connection active when it is "turned off", I don't know how it would be possible to determine that it is in standby mode... Unless the OLED TV's return extra data that the UHD and SUHD models do not...

To find out... Have the TV on... go to the HE log page... clear the old logs, then turn off the TV with the remote... wait about 60 seconds and them grab the logs and post them so I can see if there is any extra data available.

Hi Mate,
I have the "LG Connect Apps" option under Settings>Network and have enabled it.

What would I need to do from here to enable power on?

FYI: TV does not have the "Mobile TV On" option under Settings>General

Cheers
G

The "LG Connect Apps" option enables the websocket server... The "Mobile TV On" option enabled wake-on-lan.

If you do not have the "Mobile TV On", you can not enable wake-on-lan, and you will need to use some other method to power on the TV.

The only other possibility is the "Secret Network Menu" that was present on some WebOS models...
Set the TV to LiveTV... Using the TV Remote, press and HOLD the setup button until the channel banner appears in the upper left of the screen, then press "8", "2", "8" then "OK". If your set has the secret menu, it will be displayed and there MAY be an option to enable wake-on-lan. This menu is not present on models with the "Mobile TV On" option..

828 doesn't do anything. 1105 gets me into hotel menu. But 828 doesn't get me anywhere.

My sets do not have the secret network menu either... And the hotel menu code, on mine, brings up a "Public Displays" menu... Which has a section for "IP Control" which then has an option to enable wake-on-lan...

What options does the hotel menu give you?

Another possibility is:
Open the full settings menu. Move the cursor to highlight "Network". enter 82888. On some models this brings up the "IP Control" menu.

If there is no "Wake On Lan" or "Mobile TV On" or "Wake over WiFi" option, your TV does not support wake-on-lan, and you will need to use some other option...

Looking at some of the options in the "Public Display"/"Hotel" menu... There is a "Power On Default" menu item, that lets you set the TV to automatically turn on (and optionally select a specific input) after a power failure... If you are unable to use a chromwcast or IP to IR device to power on your TV, then you could enable this option, plug the TV into a smart outlet (Wifi or Zigbee or ZWave) and use rules to cycle the power...

Can't get into service menu or IP control menu.

Can you add a command to the App for EZ_ADJUST
Doing some research, there is Android apps out there that can send commands via IP to access service menu

Please take a look at your code, you have written some kind of loop that closes and reopens the connection every 60 seconds.