LGWebOS Binding (for LG WebOS TVs)

Tags: #<Tag:0x00007f2fb0962738> #<Tag:0x00007f2fb0962530>

Pull Request is #5966

actually finally found some time :slight_smile:

Hi,

would like to inform the community that I am working on a complete rework of this binding.
Have already removed completely connectsdk library and with that a lot of abstraction layers.
Now this binding will natively communicate with the device and use openHABs on-board means to do UPNP discovery, JSON parsing, websocket communication etc… Tonight I was able to connect and control basic functionality on my local TV.

Changes:

  • Removing the ability to set the local ip. UPNP discovery will rely on OHs on-board UPNP discovery. IP can be set in system settings.
  • ipAddress becomes a configuration parameter. So if UPNP discovery does not work, or users don’t want to use it, this binding should still work. ipAddress will be updated by UPNP if ThingID uses the generated one. This is standard OH behavior. If anybody prefers to set Things up manually (e.g. via file or UI) any Thing ID will do. If the thing ID is different to the one discovered by UPNP ipAddress config parameter won’t be updated.
  • detecting whether device is Online or Offline is now independent from UPNP discovery and based on network connectivity
  • no more lgwebos userdata in the file system to store device information. Using openHAB’s thing registry to store all information.

For anyone interested, development is ongoing on this branch:

3 Likes

Thank you Sebastian :slight_smile: any chance to get pre-release version? I have 3 LG tvs…with webos 2.x, 3.x and 4.x

absolutely
just need to finish at least basic testing for all features.
i’ll publish a link shortly, maybe tonight

First Community Beta Test Candidate released: lgwebos-2.5.0-snapshot-201908262331

1 Like

there will be a warning about weak ciphers used in the log.
It seems the device does not support any non-weak ones, so I enabled all. I need to find how this can be improved and limited to a minimum of weak ones.

Have tested my device’s SSL capability, and it is not performing well at all:
SSL Server Test_ WebOS.pdf (228.2 KB)
OS Release Version 2.2.1, Device OS 4.1, Software Version 4.5.85

Of course, the certificate is self signed and we simply have to trust it, so it will not prevent any man in the middle attack.

It does not support TLS 1.3 and only uses weak cipher suites. This is something which could change in the future with an update, but I doubt that this going to happen.
I could enable some of the weak ciphers, but it will result in a warning in the log. I doubt that in our home environment and for the un-sensitive data we are passing encryption is really required.

NOTE: The only security relevant data could be the client-key. If somebody on the network steals it, he could also connect to the TV’s API.

Thus, I will rework this now to not use encryption (https) and use plain unencrypted communication (http).

Does anyone have any doubts, recommendations, thoughts?

1 Like

Hi i have a problem, when i turn off the tv the status on openhab change to off and then immediatly goes back on, i tried to figure out what’s going on looking at the logs but i haven’t found anything.

I assume you use lgwebos-2.5.0-snapshot-201908262331
does the TV turn off and will it eventually show off in OH? So, just a temporary inconsistency?

I am seeing something similar. If I simply power on or off the “bouncing” of the switch doesn’t cause any negative effects. However, I have a “good night” routine that I run that does various things including turning off the TV via my Harmony Hub “Power Off” rule. If I manually turn off the TV (using the Harmony Remote) and then press the good night button, the TV will turn back on. I believe the switch will toggle even though the TV is off already which sends another WOL command turning the TV back on.

Here are my rules:

rule "Harmony Hub LR - Power Off"
when
    Item HarmonyHubLR received update
then
     if (HarmonyHubLR.state == "PowerOff" ) {
		sendCommand(LG_TV0_Power, OFF)
		sendCommand(zone1Power, OFF)
		sendCommand(LG_TV1_Power, OFF)
		sendCommand(Audio_Zones_Amp_14PR, OFF)
}
end
rule "Good Night Button Extension"
when
    Item GdNght_Flag received update
then
    sendCommand(Lights_FamilyRoom_Angie_LampZWave, OFF)
    sendCommand(Lights_FamilyRoom_Steve_LampZWave, OFF)
    sendCommand(MiscZwaveSwitch, OFF)
    postUpdate(HarmonyHubLR, "PowerOff")
    sendCommand(ZnAllState, OFF)
    sendPushoverMessage(pushoverBuilder("Good Night!"))
end

i’m using the 2.4.0 version and i checked this morning and now it’s working fine…however it was a temporary inconsistency, thank you for your reply and sorry for the inconvenience.

Hi @Roberto2
Hi @HaKuNa
All

any feedback regarding this beta version. I would like to start the pull request to go through code review.

1 Like

Hi Sebastian,

thank you, good work !!!

I have been installing the snapshot for a week. So far, I have not encountered any problems.
Before that I had the ON OFF problem. This does not occur now.
All features works with my WebOS 5.10.10 TV.
The only thing I have seen are OFFLINE messages in the event.log every 10 seconds when the TV is not on.
“changed from OFFLINE: TV is off to OFFLINE (COMMUNICATION_ERROR): Connection Failed: Connect Timeout”
“changed from OFFLINE (COMMUNICATION_ERROR): Connection Failed: Connect Timeout to OFFLINE: TV is off”

Kind Regards
Jens

I cannot wait to see this in the milestone builds :slight_smile:

@sprehn: I’m using milestone 2.5M3 and the toast messages are working again since you removed the default icon on toast messages -> thanks a lot
Regarding beta version:
I have not yet tested your beta version. Will try this as soon I have a little spare time.

thx for your observation - it is now addressed in code

Pull Request Raised #6060

1 Like

Hi @sprehn
Sorry for long delay …
Today I uninstalled lgwebos binding (I am using Openhab 2.4) then
a) copied org.openhab.binding.lgwebos-2.5.0-SNAPSHOT.jar to /usr/share/openhab2/addons/
b) added in file addons.cfg line: binding = lgwebos,…
and received this in Karaf console:

[WARN ] [org.apache.felix.fileinstall ] - Error while starting bundle: file:/usr/share/openhab2/addons/org.openhab.binding.lgwebos-2.5.0-SNAPSHOT.jar
org.osgi.framework.BundleException: Could not resolve module: org.openhab.binding.lgwebos [229]
Unresolved requirement: Import-Package: org.openhab.core.automation.annotation; resolution:=“optional”
Unresolved requirement: Import-Package: org.eclipse.smarthome.config.discovery.upnp

    at org.eclipse.osgi.container.Module.start(Module.java:444) ~[?:?]
    at org.eclipse.osgi.internal.framework.EquinoxBundle.start(EquinoxBundle.java:383) ~[?:?]
    at org.apache.felix.fileinstall.internal.DirectoryWatcher.startBundle(DirectoryWatcher.java:1260) [10:org.apache.felix.fileinstall:3.6.4]
    at org.apache.felix.fileinstall.internal.DirectoryWatcher.startBundles(DirectoryWatcher.java:1233) [10:org.apache.felix.fileinstall:3.6.4]
    at org.apache.felix.fileinstall.internal.DirectoryWatcher.doProcess(DirectoryWatcher.java:520) [10:org.apache.felix.fileinstall:3.6.4]
    at org.apache.felix.fileinstall.internal.DirectoryWatcher.process(DirectoryWatcher.java:365) [10:org.apache.felix.fileinstall:3.6.4]
    at org.apache.felix.fileinstall.internal.DirectoryWatcher.run(DirectoryWatcher.java:316) [10:org.apache.felix.fileinstall:3.6.4]

Can I test your binding in Openhab 2.4? I cannot switch to OH 2.5 since many other errors

Is the pull request in the last snapshot?