LG Smart TV 2012+ Integration

I think that is the current problem I am having.

Most likely same as meā€¦ :frowning:

Can also try my implementation of UDAP for LG SmartTVs. For sure not done but has been lying around on my repo for months. Somehow no time to finish it or fix it. Didnā€™t know that there were also other people working on that, so good job and good luck! :slight_smile:

Hi @Mikey887, I believe I am having the same problem you had, unexpected error when I try to enter the pairing code. I see you figured this out, but I donā€™t know what you mean by ā€œtweaked the name of the device handlerā€. Iā€™m very novice with SmartThings but I did manage to add the device handler and smart app to the IDE. What, exactly, did you change to get this to work?

@whafa if you look in the logs when attempting to pair the TV you may see an error about not finding child device type, to fix it I shortened the device type name to LG smart tv

@Mikey887, thank you sir! I found the Live Logs and proceeded from there. I can now tell google to turn off the television. The future is here.

Iā€™d love to get this to workā€¦but Iā€™ve, having the same issues as a few above with no tvā€™s found, no error code, debug log just gives ā€œLooking for TVā€™sā€. Has anyone resolved this? Seems like Iā€™ve only seen those with the pairing error have success.

Iā€™ve successfully paired and re-paired the connect app, so I know the tvā€™s is available on the network, even tried static and an assigned ip via DHCP, wifi and wired.

TV model is OLED65C7P, software version 04.70.36. Willing to test ā€¦

Worked for my LG 47lm6400 smart tv. It can only turn off the Tv. Can anyone get it working for more option like source change, turning on tv and othersā€¦

Turning on will never work. Just not possible. Changing input is possible with my dth, still very rough overall though and have no time to work on it.

No the LG TV can be turned on by a Wake UP on Lan command.
I have mine working but I hardcoded the mac address.

def myWOLCommand() {
def result = new physicalgraph.device.HubAction (
ā€œwake on lan <your mac address w/o ā€˜:ā€™>ā€,
physicalgraph.device.Protocol.LAN,
null,
[secureCode: ā€œ111122223333ā€]
)
return result
}

Just with a LAN cable, no wifi right?

WoW ! exquisite.
Amazing is what youā€™re building. I canā€™t just wait to use your application on my Smart Tv. I have been using Kodi on smart tv. it would be really nice to use this app to control it.
Thanks in advance.

I can turn off the tv with this app but can not turn on. I found a fairly easy way to turn on the tv with chrome cast and google home. I changed the tv name in google home as TV and smart things recognize the same tv as LG smart tv. I can turn on the tv asking to play something on youtube or netflix. I can turn off the tv by asking turn off lg smart tvā€¦

I am having the discovery issue as well. Logs below. It seems to find the TV, but it never shows up on the SmartThings app. Model is a 49UJ6300. I assume that running the SmartApp is the first step. I also tried creating the device manually, but that doesnā€™t seem to be correct.

4530646d-ce94-4152-82ca-b167162596cf 5:48:57 PM: debug hub: 5754332e-1721-4d99-8969-31a801ae8583
4530646d-ce94-4152-82ca-b167162596cf 5:48:57 PM: debug upnp: [devicetype:04, mac:00044B8394CF, ip:C0A80211, ssdpPath:/dev/f6fc3bd7-9835-e4f8-0000-000038b27980/desc.xml, ssdpUSN:uuid:f6fc3bd7-9835-e4f8-0000-000038b27980::urn:schemas-upnp-org:device:MediaRenderer:1, ssdpTerm:urn:schemas-upnp-org:device:MediaRenderer:1]
4530646d-ce94-4152-82ca-b167162596cf 5:48:57 PM: debug Device Location Event: devicetype:04, mac:00044B8394CF, networkAddress:C0A80211, deviceAddress:81D1, stringCount:04, ssdpPath:/dev/f6fc3bd7-9835-e4f8-0000-000038b27980/desc.xml, ssdpUSN:uuid:f6fc3bd7-9835-e4f8-0000-000038b27980::urn:schemas-upnp-org:device:MediaRenderer:1, ssdpTerm:urn:schemas-upnp-org:device:MediaRenderer:1, ssdpNTS:
4530646d-ce94-4152-82ca-b167162596cf 5:48:42 PM: debug hub: 5754332e-1721-4d99-8969-31a801ae8583
4530646d-ce94-4152-82ca-b167162596cf 5:48:42 PM: debug upnp: [devicetype:04, mac:00044B8394CF, ip:C0A80211, ssdpPath:/dev/f6fc3bd7-9835-e4f8-0000-000038b27980/desc.xml, ssdpUSN:uuid:f6fc3bd7-9835-e4f8-0000-000038b27980::urn:schemas-upnp-org:device:MediaRenderer:1, ssdpTerm:urn:schemas-upnp-org:device:MediaRenderer:1]
4530646d-ce94-4152-82ca-b167162596cf 5:48:42 PM: debug Device Location Event: devicetype:04, mac:00044B8394CF, networkAddress:C0A80211, deviceAddress:81D1, stringCount:04, ssdpPath:/dev/f6fc3bd7-9835-e4f8-0000-000038b27980/desc.xml, ssdpUSN:uuid:f6fc3bd7-9835-e4f8-0000-000038b27980::urn:schemas-upnp-org:device:MediaRenderer:1, ssdpTerm:urn:schemas-upnp-org:device:MediaRenderer:1, ssdpNTS:

Doesnā€™t seem to pickup my TV. Any simple way to see if a TV is on?

Has anyone had any luck with this recently? Iā€™ve had the same issue with the smartapp not discovering the TV (LG OLEDB8). Logs show mac address etc.

So I did a little research on this and I think I may have discovered why some TVs are not being discovered. Looking at the LG Developer documentation, I found that there are specific headers required in the M-SEARCH discovery request in order for the TV to respond (See page 8/9 here http://webostv.developer.lge.com/application/files/1214/7919/6747/NetCast_-_UDAP.pdf).

  1. HOST
  2. MAN
  3. MX
  4. ST
  5. USER-AGENT*

After running a packet capture, I found that the M-SEARCH request generated by SmartThings does not include the ā€œUSER-AGENTā€ header (See capture below):

Received 4/25/2019 at 10:56:24 AM (8)

M-SEARCH * HTTP/1.1
MX: 4
MAN: "ssdp:discover"
HOST:239.255.255.250:1900
ST: urn:schemas-udap:service:netrcu:1

I am not entirely sure why the discovery works for some but not others but I believe the culprit could be those of us who may be on later firmware revisions. :man_shrugging:

To get around the discovery all together, I went ahead and manually created the device specifying the device handler ā€œLG Smart TV 2012+ā€.

Example:

Once the device was created, using Postman, I generated a HTTP POST request to the TVā€™s API to bring up the pairing key window on the TV. Make sure the TV is ON:

Example:


Request:

POST /roap/api/auth HTTP/1.1
Host: 10.0.3.237:8080
Content-Type: application/atom+xml
Cache-Control: no-cache
Postman-Token: d45e3994-c74a-228d-70ab-20d0da66e270

<?xml version=\"1.0\" encoding=\"utf-8\"?><auth><type>AuthKeyReq</type></auth>

At this point, you should see the pairing code displayed on the TV. Go back to the IDE and in the device settings, edit the preference section with the IP address of the TV and the pairing code.

Example:

You can now control the device via the SmartThings app.

Hopefully this helps anyone struggling with the discovery issue!

Can someone explain how to do this?

1 Like

For LG Dryer, there seems to be a lag. I shut off my dryer but the Device in Smartthings takes a very long time to show an event for Off. It remains on. Similarly the other way around ā€“ when turned off and then turned on it takes a very long time to show on. (?)

It actually never changes state at all unless I restart the Docker container?