[RELEASE] LGTV with webOS

Well, that sucks! I feel for you man... here's a hug from me :hugs:

I believe that this is not caused by the driver, most likely there is something at the network level that doesn't work quite right.

What you can try:

  • In the Hubitat UI, go to Settings -> Network Setup -> Network Test, then ping and traceroute the TV IP. With the TV on, try the commands multiple times to see if the results are consistent:

  • If you have a Windows PC, download wol.exe from this website. With the TV off, run the following command against it's MAC address. Again, try it multiple times to see if results are consistent:

    {AF649233-7FCC-476B-95AF-547936DDBD37}

I don't know much about networking, this is way above my pay grade. Maybe more knowledgeable folks here can help you pinpoint the consistency problem.

I'm sure I know less about networking than you do. I tried Ping host and Traceroute and everything looked normal. I used wol and the TV turned on. I don't think it's a networking issue as the thinq app always turns the TV on. I'm going to keep using wol for a while to see if it works 100% of the time. If it does then it's probably a Hubitat issue.

Another question. The only two Alexa commands recognized on my Echo device is Power on and Power off. For example if I ask Alexa to to increase the volume she responds "LGTV doesn't support that" Do you know if there's any way to add more commands? Thanks

What model do you have, my LG TV has Alexa built in.

27LQ625S-PU that I use in the Kitchen. It does have Alexa built in but as I said the only two commands that are recognized are power on and power off ( no volume, mute, or channels).

This driver implements the required official capabilities: "Switch", "TV", and "AudioVolume". I believe that the Alexa integration exposes only a subset of capabilities to Alexa, and probably "TV" and "AudioVolume" were not included.

I can add the "SwitchLevel" capability, and Alexa will probably see the TV as a dimmable light, but I'm not sure if "Alexa, increase the TV volume!" will work, even with this change.

I don't use any voice assistents in my house, so I reaaly can't test this.

1 Like

That's it! When I look at the device list in Alexa the TV is shown as a switch so only on and off is available. Don't worry about it I'll just use the thinq skill in Alexa to control the volume. Thanks.

1 Like

Once again, awesome work @dandanache. Works great with my 75UN7070PUC.

All the commands seem to work, except:

  • Set Channel: seems like the argument should be a string instead of a number for DTV channels to work (attribute gets set to e.g. '2-1', '3-5' or '6-1' when using channel up/down).
  • Set Picture Mode: I get Received error message: category, picture doesn't support the key(s): undefined"

In case anyone is looking for this info, I enabled Network IP Control the following way on this model: first, go to "All Settings"

Then move the cursor to Connections but do not select it.

Type 82888 on the remote to get to a hidden menu

2 Likes

Released version 1.5.0 with the following changes:

Added

  • Add "SpeechSynthesis/Speak" command for TTS announcements

Fixed

  • Changed "Set Channel" to accept string channel number - @hubitrep

The "Speak" command implementation is a bit of a hack: it briefly starts the "Media Player" app on TV to play the mp3 file (generated on the Hubitat hub), so it disrupts the app that is currently running on TV.

Have fun!

If it works 100% from the PC but only 50% from Hubitat, I would look more closely at the network path between Hubitat and TV. What does traceroute utility from Hubitat say?

Thank you for trying it out!

I should probably collect these instructions in the readme file. Thank you for sharing!

1 Like

A few additional observations:

  • I am noticing that the driver wrongly thinks an 'on' command failed some of the time. It seems it may have to do with the 7 second delay after wake-on-lan packets are sent, before attempting to connect the websocket, as the next ping will succeed and show the TV as on and online. I tried changing the delay to 15 seconds and it's more reliable now. Maybe this delay should be configurable as a parameter?
void on() {
    log_debug '🎬 Powering on ...'
    util_wakeOnLan(getDataValue('wifiMacAddress'))
    util_wakeOnLan(getDataValue('wiredMacAddress'))
    if (ipAddr) util_wakeOnLan(getMACFromIP(ipAddr))

    // Start websocket in 7 seconds
    runIn 15, 'connect'  // I guess my model doesn't haul ■■■ as much as Dan's
}
  • When the TV is off, the networkStatus attribute gets set to offline, leading to the "device offline" icon to show up in the device list, home screen and dashboards. I admit I am not a fan of this new hub feature (lots of false positives); here it doesn't feel like it's conveying the right idea... Not sure what to suggest. I might pay more attention if it reflected the failure of the last on command (wake on lan).
    image

  • More of an FYI than feedback, but 'Set Volume' has no effect when the audio output isn't the TV speaker - well, tbh I only tested toggling between internal speaker and HDMI ARC. Volume up/down works as expected.

  • Probably unnecessary: command to enable/disable ping from RM (e.g. when away) ?

FYI - this new command, like Start Video, fails on my model with Received error message: not exist.

Thanks! works perfectly.

Tested model:

1 Like

Can you please first run the "Get All Activities" command, then paste the "Activities" state variable? I suspect that the "Media Player" app has a different id than the one I hardcoded.

{"lgchannels.ca":"LG Channels","com.webos.app.miracast":"Miracast","netflix":"Netflix","ca.bellmedia.tsn":"TSN","com.corusent.lg.globaltv":"Global TV","com.webos.app.browser":"Web Browser","com.plutotv.app":"Pluto TV - Live TV and Movies","com.webos.app.sportsteamsettings":"Sports Alert","com.apple.appletv":"Apple TV","com.webos.app.music":"Music","com.webos.app.livetv":"Live TV","tv.tou.ici.webos":"ICI TOU.TV","com.webos.app.photovideo":"Photo & Video","com.webos.app.externalinput.component":"Component","com.webos.app.externalinput.av1":"AV","com.disney.disneyplus-prod":"Disney+","amazon":"Prime Video","com.webos.app.home":"Home","com.webos.app.roomconnect":"Room to Room Share","com.webos.app.hdmi2":"HDMI 2","com.tubitv.ott.tubi":"Tubi","com.webos.app.hdmi3":"HDMI 3","youtube.leanback.v4":"YouTube","com.webos.app.discovery":"LG Content Store","com.webos.app.hdmi1":"HDMI 1","com.webos.app.homeconnect":"Home Dashboard","cineplexstore201":"Cineplex Store"}

1 Like

Looks like it should be photovideo for my version of webos (matches the info at the link you have in the code comment, and it is in the list)

1 Like

Here is my activity list as requested a few days ago...

1 Like

Released version 1.5.1 with the following fixes:

Fixed

  • Improve the detection of TV startup using a fast-ping mechanism - @hubitrep
  • Fix the "Start Video" and "Speak" commands for webOS 5 - @hubitrep

Have fun!

1 Like

Tried turning on the TV this morning using wol first and then the the driver. Both failed. Turning on the TV using the LG thinq app (which uses the network) works 100% of the time. Not sure what's going on.

Start Video now works, but still no luck with Speak. Changing the activity to 'Music' makes it work (line 287):

        id: state.activities.find { it.value == 'Media Player' || it.value == 'Music' }?.key ?: 'com.webos.app.mediadiscovery',
1 Like

Will add it to the next release, thank you for the debug and fix :hugs:

Just curious, what happens when the Speak command reaches the TV? Does it open the Music app, the resumes Live TV or Netflix, etc?

Opens the music app and plays the file, nothing else. It doesn’t go back to the previous activity on its own.

1 Like

Uff, pretty useless then. On mine it resumes the previous app, unless you were actually using the Media Player app, of course.