LGWebOS Binding (for LG WebOS TVs)

and values under “volume” correspond to what is displayed on the TV

“volume”:6

6 in a circle, and not just a “+” when you press vol up

“volume”:5

5 in a circle, and not just a “-” when you press vol down

?

yes,the values under “volume” correspond to what is displayed on the TV

Pull Request #6411 should take care of this

Is there anyone that can tell me how Openhab can discover a LG TV in another VLAN (other subnet)?
Now openhab can’t find my TV.
I have a firewall rule that allows all traffic from my openhab IP address to the IP address of the TV.

Hi guys,

is it normal that the on/off status of the TV is set delayed? I mean, using the new binding, it always takes some minutes before the status of the OH item changes.

Can I do something about this? I use the power item to switch some lights in the room, and the delay is a bit ugly…

Thank you :blush:

a delay is normal, since the tv‘s operating system has to boot up in order to respond on the network

it should however connect quicker than in the old version. the binding is actually attempting to connect every 10secs.

Hmm, no, for me it is much slower than the old binding. The response takes about two to five minutes after I used the remote control to switch the TV on or off.

That is strange.

Note, I have no error or something in the logs. It simply comes very late.

Regarding the delay of the on/off status of the TV I would like to share my experiences:

TV ON switches on the power item within 10 sec. - this works perfectly for me, see also below.

But with TV OFF command the item LG_TV0_Power only becomes status OFF directly after the binding sets the thing status to OFFLINE which in average takes about 5 min. after the TV power OFF command:

2019-11-21 19:01:50.002 [ome.event.ItemCommandEvent] - Item 'LG_TV0_Power' received command OFF
2019-11-21 19:06:50.045 [hingStatusInfoChangedEvent] - 'lgwebos:WebOSTV:5f80e631-ea31-93bf-35ab-ebfda4d33abf' changed from ONLINE: Connected to OFFLINE (COMMUNICATION_ERROR): Connection Failed: java.util.concurrent.TimeoutException: Idle timeout expired: 300000/300000 ms
2019-11-21 19:06:50.050 [hingStatusInfoChangedEvent] - 'lgwebos:WebOSTV:5f80e631-ea31-93bf-35ab-ebfda4d33abf' changed from OFFLINE (COMMUNICATION_ERROR): Connection Failed: java.util.concurrent.TimeoutException: Idle timeout expired: 300000/300000 ms to OFFLINE: TV is off
2019-11-21 19:06:50.070 [vent.ItemStateChangedEvent] - LG_TV0_Power changed from ON to OFF

For me, this delay has an unwanted side effect after I updated from OH 2.4 to 2.5M4 which also comes with new Alexa Version 3 API, relevant for me because I control TV also via Alexa:
If item LG_TV0_Power had status OFF before, the Alexa command “TV ON” works properly. But if the item had status ON before, this command doesn’t work. The log shows warning

Only accept OnOffType. Type was class org.eclipse.smarthome.core.library.types.OnOffTyp

Due to the TV OFF delay the situation occurred several times that “TV ON” command didn’t work.
Here my item definition:

Switch  LG_TV0_Power   "TV [MAP(de.map):%s]"   [ "Switchable" ]   { autoupdate="false", channel="lgwebos:WebOSTV:5f80e631-ea31-93bf-35ab-ebfda4d33xxx:power" } 

@Tobi77 As reference for further analysis I provide the TV ON log too:

==> /var/log/openhab2/events.log <==
2019-11-21 18:57:03.347 [ome.event.ItemCommandEvent] - Item 'LG_TV0_Power' received command ON
==> /var/log/openhab2/openhab.log <=
2019-11-21 18:57:03.364 [INFO ] [nhab.binding.wol.internal.WolBinding] - Wake-on-LAN packet sent [broadcastIp=192.168.2.255, macaddress=14c913d98xxx]
==> /var/log/openhab2/events.log <==
2019-11-21 18:57:03.365 [ome.event.ItemCommandEvent] - Item 'LG_TV0_WOL' received command ON
2019-11-21 18:57:03.375 [vent.ItemStateChangedEvent] - LG_TV0_WOL changed from OFF to ON
2019-11-21 18:57:13.128 [me.event.ThingUpdatedEvent] - Thing 'lgwebos:WebOSTV:5f80e631-ea31-93bf-35ab-ebfda4d33abf' has been updated.
2019-11-21 18:57:13.161 [hingStatusInfoChangedEvent] - 'lgwebos:WebOSTV:5f80e631-ea31-93bf-35ab-ebfda4d33abf' changed from OFFLINE: TV is off to ONLINE: Registering - You may need to confirm pairing on TV.
2019-11-21 18:57:13.203 [me.event.ThingUpdatedEvent] - Thing 'lgwebos:WebOSTV:5f80e631-ea31-93bf-35ab-ebfda4d33abf' has been updated.
2019-11-21 18:57:13.215 [hingStatusInfoChangedEvent] - 'lgwebos:WebOSTV:5f80e631-ea31-93bf-35ab-ebfda4d33abf' changed from ONLINE: Registering - You may need to confirm pairing on TV. to ONLINE: Connected
2019-11-21 18:57:13.281 [vent.ItemStateChangedEvent] - LG_TV0_Power changed from OFF to ON
2019-11-21 18:57:13.326 [vent.ItemStateChangedEvent] - LG_TV0_Application changed from  to com.webos.app.livetv

Thanks.
Indeed, OFF takes much longer than ON. Glad to hear it’s not only me, so this is no faulty network or so…

Hi,

can reproduce the OFF situation as well.
I’ll see what I can do about it.

The tricky piece is: if I set status OFF, but the TV is still shutting down, how will/should it behave.
I suspect if we send an ON command shortly after it will be ignored. But I’ll investigate.

Kind Regards
Sebastian

my PR for this fixed was just merged

1 Like

Turning ON: not much choice, the binding can only detect the TV once it’s interface is up.
Turning OFF: I tested with my setup. It takes approx. up to 30 seconds for the binding to detect the TV shutdown. again, there is no way to subscribe to the shutdown stated (tried it).

For those cases where change is initiated via openhab we could post the state directly by removing autoupdate=“false” from the item definition. But it will not help if the TV is turned on or off via remote control.

So, I am sorry, but I don’t find a smarter way at the moment.

2 Likes

Anyways, thanks for trying :slight_smile:

@sprehn Thank you for doing research - then we take it as it is (works as designed).

Hello is it possible to set the Picture mode somehow via this binding automatically?

What I want to do is when I start my Gaming console it should automatically change the picture mode to GAME. If possible even the HDR picture mode to game aswell.

Could something like this be achieved somehow?

@sprehn
At this moment I’ve got the binding working (2.5M5) and it is possible to set the TV OFF with openhab.
The problem I have is that the power item not changes to ON when I turn ON the TV with the remote.

my thing:

//Thing lgwebos:WebOSTV:TV_1 [host="10.0.30.25", key="a14aadf8cee820bb72470447ee85c38f"]

my item:

Switch LG_TV_1_Power "TV Power" {channel="lgwebos:WebOSTV:TV_1:power"}

another question:
Is it realy required to put the key in the thing config?
Because I wasn’t able to get the binding working I placed my TV in the same subnet as openhab.
I first configurated the thing without the key (because at that point I didnt know it yet).
After I saved the thing file, there was a webos thing with key a14aadf8cee820bb72470447ee85c38f in the thing overview (key was visible in paperUI CONFIG > THINGS > EDIT > WEBOS).
I placed that key in my thing config file and saved that again.
But in the paperUI INBOX there was also a discovery of an webos thing with key 763e2cc5-ba9d-4cf8-2600-7b768c4eedfa?
So with key I need to use in my config file? and with notation I need to use? (with dashes or without?)

maybe the key is the reason that my item don’t get a update to ON when my TV is turned ON with the remote?

this means you are properly connected and paired. The binding will try to the TV every 10 seconds. It should actually work.

Your approach to configure it without key first and then add it later makes absolutely sense. the key is the value without dashes. the one with dashes is the device id as published by the tv. we use it to generate the thing id.

You could enable debug logging in karaf console to see what is going on.

log:set debug org.openhab.binding.lgwebos

Using the lasted snapshot build seems to solved my problem.
Thanks for your help.

@sprehn After OH update to 2.5M4 I’m just trying out launchBrowser action. Very nice feature on the TV, however even using it in the simplest way is generating a warning in the log:

==> /var/log/openhab2/openhab.log <==
2019-11-25 17:49:15.087 [WARN ] [bos.internal.handler.LGWebOSTVSocket] - Error while processing message: {"type":"response","id":25,"payload":{"returnValue":true}} - in response to request: ServiceCommand [requestId=-1, type=request, target=ssap://system.launcher/open, payload={"target":"https://www.openhab.org"}] - Error Message: null

Here the relevant snippet of my rule:

// Rule action access
val actions = getActions("lgwebos","lgwebos:WebOSTV:5f80e631-ea31-93bf-35ab-ebfda4d33xxx")
if(actions !== null) {
	actions.launchBrowser("https://www.openhab.org")
}

What I’m doing wrong?
Nevertheless, TV shows browser with URL called via actions command.

Regards,
Andy

Thx, just tried it quickly myself. For me it did not produce this error.

However, it seems like “sessionId” is not contained in the response you received:

{"type":"response","id":25,"payload":{"returnValue":true}}

The code assumes it is always there. Wonder what we should do, Currently, it is probably irrelevant to capture it even.