[ST Edge] LG WebOS TV

Okay, it was an early report. Right after that, the device went offline and came back online in the morning. However, I’m currently unable to turn it on, even though the interface indicates it’s ‘On.’
I’ll test the Wake on Lan feature today.
Looking forward to the new version driver, and thank you!

** DRIVER UPDATE NOTICE **

Version: 2023-12-03T00:21:24.639026562

Working with @skinnypope, I’ve been able to make some good enhancements to the LG TV driver:

  • on/off switch will better reflect the status of the TV, going off whenever the TV can’t be reached. Once the TV powers back on and the driver can reconnect with it, the next auto-refresh cycle the switch will go back on. The switch will also stay on if the TV goes into screensaver mode
  • addition of HDMI4 and LIVE TV options in the media input source button
    • Note: Live TV can be selected either from the media input source button or the Channel App button
  • Addition of new Current Channel field, showing the channel number and name
  • Addition of a current channel number field available for automations only
  • External Speaker Volume: we discovered that the volume slider does not work with external speakers (you can’t set a specific volume, just like you can’t with the TV remote). So I have added Volume Up & Down buttons which will work for external speakers. There is also a new device Setting option where you can set the volume change interval (1-20) when those buttons are activated. This is like hitting the volume up/down button on your TV remote multiple times.

IMPORTANT NOTE: You will need to delete and then recreate your TV device(s) in the SmartThings app in order for this new driver to work properly. Once you’ve confirmed the new driver version is on your hub, use the app to remove any existing LG TV from devices from this driver, then do an Add device / Scan for nearby devices to get your TV devices recreated. Don’t forget to re-enter your refresh frequency, volume change interval, and MAC address in device Settings.

Thanks again to @skinnypope for his feedback, testing, and logs!

Over all this works much better than any other app/driver I have previously used, but I have never had any success with turning on the TV
I use Ethernet and assume that that is the MAC address that I use in the settings? I have tried using the WiFi and Ethernet MAC address with no luck.

I have Quick Start+ turned off.

Does anyone have any suggestions for how to fix this?

Sometimes there may be a label on the back of the device that includes the MAC address. It’s not the Ethernet address which is something different.

If you have any kind of network scanning app on your phone, that might be another way to find out the MAC address.

Sorry I didn’t word that very well.
I have both MAC numbers one for the wireless and one for the wired connection. Which one should I use in the settings?

Likely you want the one that reflects how your TV is connected to your network - whether you are hardwired with Ethernet or connected wirelessly.

just tested a new driver and the on/off feature is off. I have Quick Start+ on and the Mac address is in the settings.

My findings :

My findings are as follows:

I am able to turn off the TV using the ST app. However, sometimes there is a delay in the event, resulting in the TV turning off second time immediately after I have turned it on using the remote.

When I use the remote to turn off the TV, the app loses connection and remains in the “on” state for about a minute, then displaying an Offline status.

It is not possible to turn on the TV using the ST app, regardless of whether or not the MAC address is entered in the settings.

However, I can still turn on the TV using the LG app and the Apple Home kit.

@TAustin I can now report using this new driver I can turn both of my LG TV’s on and off using the SmartThings app, by tile, settings or routine. For anyone having trouble like I did with not being able to turn ON the TV what appeared to solve it was a network reboot (hubs, router, and pi-hole). I have the driver installed on a Smart Station, and just rebooting it did not solve the inability to turn on the TV.

I can change the volume using routines but as others reported I can not change channels using routines.

It also appears that the tile/settings do take a little longer than the time set in the frequency settings to update, I set mine to 10 seconds.

I have Quick Start+ OFF @veonua

Thanks very much your your report. Sounds like it is working as expected.

@veonua - are things still working the same for you?


Regarding changing the channel via routines: this is an odd omission in the SmartThings support for the tvChannel control. There is a possible way around this, but it will require some extra work. If you monitor the driver log using the CLI, you can see the data returned by the TV whenever the driver requests state updates from the TV. In that data is the current channel, including a channel ID, which is a long string of characters (example below). You can use this channel ID to change to a specific channel via the ‘Then’ portion of a routine: find in the list of actions where it lists ‘Channel’, tap it, then turn on the switch and then in the empty field presented, type in that channel ID string.

An example of what this channel ID string looks like is:

1_30_103_103_16516_17604_9018

And where you’ll see it in the log is where you see the returned data for current channel, for example:

WS Receive TEXT frame payload
2023-11-30T11:47:52.383203765+00:00 DEBUG LG TV V1.0  {"type":"response","id":"59","payload":{"returnValue":true,"channelId":"1_30_103_103_16516_17604_9018","physicalNumber":30,"isScrambled":false,"channelTypeName":"Terrestrial Digital TV","isLocked":false,"dualChannel":{"dualChannelId":null,"dualChannelTypeName":null,"dualChannelTypeId":null,"dualChannelNumber":null},"isChannelChanged":false,"channelModeName":"Terrestrial","channelNumber":"103","isFineTuned":false,"channelTypeId":1,"isDescrambled":false,"isReplaceChannel":false,"isSkipped":false,"isHEVCChannel":false,"hybridtvType":"HBBTV","isInvisible":false,"favoriteGroup":null,"channelName":"ITV1 HD","channelModeId":0,"signalChannelId":"16516_17604_9018"}}
2023-11-30T11:47:52.394220098+00:00 INFO LG TV V1.0  Response message to be handled id=59:
2023-11-30T11:47:52.400354098+00:00 DEBUG LG TV V1.0      isHEVCChannel	false
2023-11-30T11:47:52.402551432+00:00 DEBUG LG TV V1.0      isReplaceChannel	false
2023-11-30T11:47:52.405212098+00:00 DEBUG LG TV V1.0      channelModeId	0
2023-11-30T11:47:52.407339765+00:00 DEBUG LG TV V1.0      isLocked	false
2023-11-30T11:47:52.409820765+00:00 DEBUG LG TV V1.0      channelModeName	Terrestrial
2023-11-30T11:47:52.411151098+00:00 DEBUG LG TV V1.0      channelNumber	103
2023-11-30T11:47:52.412711098+00:00 DEBUG LG TV V1.0      dualChannel	table: 0x208d6d0
2023-11-30T11:47:52.414013098+00:00 DEBUG LG TV V1.0      channelId	1_30_103_103_16516_17604_9018         <<<< HERE!
2023-11-30T11:47:52.417061765+00:00 DEBUG LG TV V1.0      isFineTuned	false
2023-11-30T11:47:52.419655098+00:00 DEBUG LG TV V1.0      channelTypeId	1
2023-11-30T11:47:52.421837098+00:00 DEBUG LG TV V1.0      channelName	ITV1 HD
2023-11-30T11:47:52.424310098+00:00 DEBUG LG TV V1.0      isScrambled	false
2023-11-30T11:47:52.426830765+00:00 DEBUG LG TV V1.0      returnValue	true
2023-11-30T11:47:52.429031098+00:00 DEBUG LG TV V1.0      signalChannelId	16516_17604_9018
2023-11-30T11:47:52.431144432+00:00 DEBUG LG TV V1.0      isInvisible	false
2023-11-30T11:47:52.433579432+00:00 DEBUG LG TV V1.0      hybridtvType	HBBTV
2023-11-30T11:47:52.435862432+00:00 DEBUG LG TV V1.0      isSkipped	false
2023-11-30T11:47:52.438373432+00:00 DEBUG LG TV V1.0      channelTypeName	Terrestrial Digital TV
2023-11-30T11:47:52.440794765+00:00 DEBUG LG TV V1.0      isDescrambled	false
2023-11-30T11:47:52.443144098+00:00 DEBUG LG TV V1.0      isChannelChanged	false
2023-11-30T11:47:52.445693432+00:00 DEBUG LG TV V1.0      physicalNumber	30
2023-11-30T11:47:52.448326098+00:00 PRINT LG TV V1.0  returnValue:	true	boolean

I do not know if these channel IDs are the same for all TVs. If they are, then we may be able to work together to collect a list of them so they can be documented for others to use.

3 Likes

Todd, you never cease to amaze me, thanks that now works

I have only tested with one channel, but wanted to update everyone. I think I do see a pattern to the channel ID I will look into it some more and then comment.

This is what I see:
For Digital OTA stations(Antenna)
18.1 signalChannelId 1_32_18_1_0_0_0
18.2 signalChannelId 1_32_18_2_0_0_0
signalChannelId a_b_c_d_e_f_g
a=channelTypeId 1
b=physicalNumber 32 (as transmitted)
c-d=channelNumber 18-1 or 18-2 (main channel _ sub channel) as displayed on screen
e_f_g=signalChannelId (not sure what this is compossed of)

I have now tested with all major network channels :+1:

WOW thanks again!

1 Like

Thanks, now it mostly works. The commands execute smoothly, but the status is still lagging behind. Even when I control the TV solely through the SmartThings application, the status transitions from ‘off’ to ‘connection lost,’ ‘offline,’ and then to ‘on.’

now it’s offline, but it should be just off

I can’t seem to get this to work, maybe I’m doing something wrong. I have set up a momentary virtual button to change the channel using the long string (I’m using the one you copied to keep it simple). Logs are here:

2023-12-11T14:14:27.213215443+00:00 INFO LG TV V1.0  <Device: 00a75dbb-2648-4e7f-9ea4-78c565b64658 (Living Room TV)> received command: {"component":"livetv","args":{"tvChannel":"1_30_103_103_16516_17604_9018"},"command":"setTvChannel","positional_args":["1_30_103_103_16516_17604_9018"],"capability":"tvChannel"}
2023-12-11T14:14:27.267151777+00:00 TRACE LG TV V1.0  Found CapabilityCommandDispatcher handler in thisDriver
2023-12-11T14:14:27.281287110+00:00 DEBUG LG TV V1.0  Channel set to setTvChannel	1_30_103_103_16516_17604_9018
2023-12-11T14:14:27.294814110+00:00 INFO LG TV V1.0  <Device: 00a75dbb-2648-4e7f-9ea4-78c565b64658 (Living Room TV)> emitting event: {"state":{"value":"setTvChannel"},"attribute_id":"tvChannel","component_id":"livetv","capability_id":"tvChannel"}
2023-12-11T14:14:27.336439443+00:00 INFO LG TV V1.0  Message sent
2023-12-11T14:14:27.340264110+00:00 INFO LG TV V1.0  <Device: 00a75dbb-2648-4e7f-9ea4-78c565b64658 (Living Room TV)> emitting event: {"state":{"value":" "},"attribute_id":"currentChannel","component_id":"livetv","capability_id":"partyvoice23922.lgcurrentchannel"}
2023-12-11T14:14:27.395559777+00:00 DEBUG LG TV V1.0  Living Room TV device thread event handled
2023-12-11T14:14:27.427698110+00:00 DEBUG LG TV V1.0  driver device thread event handled
2023-12-11T14:14:27.428730777+00:00 DEBUG LG TV V1.0  Received opcode=1.0, c=nil, d=nil, err=nil
2023-12-11T14:14:27.430293777+00:00 DEBUG LG TV V1.0  WS Receive TEXT frame payload
2023-12-11T14:14:27.431873443+00:00 DEBUG LG TV V1.0  {"type":"error","id":"939","error":"404 no such service or method","payload":{}}
2023-12-11T14:14:27.433471443+00:00 ERROR LG TV V1.0  Error reported in response: 404 no such service or method - nil

The long string does have some logic to it, which @NickA has touched upon. I believe it works as follows:

a_b_c_d_e_f_g

a = Channel Type - this appears to be “1” for all my channels (maybe someone knows differently)
b = Physical Number - this is the channel band / frequency of the channel (see below)
c+d = Channel ID - this is the LCN (Logical Channel Number) of the channel
e = TSID (Transport System ID) - this is the multiplex number the channel is broadcast on
f = SID (Service ID) - this is the unique number for each channel
g = ONID (Original Network ID) - this varies by the provider e.g. for UK Freeview = 9018

How to find out these values:

  1. Use the CLI and get them there
  2. Use the Digital Bitrate site

Option 2 is a rabbit hole, but if I clicked down to DTT + London / National I can see the 7 multiplexes with the LCNs, TSIDs, SIDs and ONIDs. To get Physical number you need to convert the Mhz frequency to the band see here

Hopefully people in other countries can corroborate that these works for them

1 Like

Hmmm. Not sure why, but the change channel command is being rejected by the TV. You’re sure you have the channel ID correct?

Yes I did copy / paste from the logs to be sure. I tried again a few times to be sure with no luck.

Nick did you get this to work in routines?

It appears you are still on driver 1.0 try it with the new driver 1.1

But yes, I have setup momentary switches to change channels.

1 Like

Ahh bingo! Was still on the old test driver and channel. Fixed and working now, thanks!

Mildly interestingly I note that only using the first arguments in the channel string works, putting the rest to 0 (inspired by Nick’s post)

In my example, no need to use: 1_30_103_103_16516_17604_9018
Instead use: 1_30_103_0_0_0_0

okay, gotta say, @TAustin - Thank you!

I had the ‘old’ LG driver to change the input on the the TV fron ‘Live’ tv to ‘HDMI 1’ when the drive gate was opened

then change back from ‘HDMI 1’ to ‘Live’ TV when the drive gate was closed

yes, it stopped working a while ago, now (with your driver) it works like a dream

Kudos, thanks a lot…

1 Like

@TAustin

So my TV is stuck on this “connect retry”. I have added the MAC address of my TV and even did port forwarding on my router. When I turn it on using the ST app, the icon turns on then flicks back off after few seconds but the TV doesn’t respond.


Now I can turn it on but it auto flicks to off and the TV is still on

I have the LAN Device monitor driver installed for testing. It reflects the TV status accurately but the TV driver, can only turn the tv “On” via “Wake on Lan”.
Any ideas or tips would be very helpful. Thank you for putting this together.

@Tamerfakhry

Hi there - I’m sorry for not responding sooner, but I’ve been focused on a paid project for the last month!

Sorry you were having trouble with the LG driver. Did you ever get it sorted out? If not, I’m happy to help you diagnose it.

A couple questions: is your TV on the same subnet as your SmartThings hub, and did you get through the initial authorization process via the TV?