LGWebOS Binding (for LG WebOS TVs)

@sprehn Running snapshot 2.5 now but still, getting an error:
‘launchBrowser’ is not a member of ‘org.eclipse.smarthome.core.thing.binding.ThingActions’

Should I add an import line is script?

Hi Sebastian, here are my debug logs when the tv goes online and offline.
The tv goes offline everytime about one minute after it’s turned on.
openhab.webos.log (15.8 KB)

I can confirm, it is not yet working for me either. The new features are not yet included in 2.5 snapshot. I’ll see if I can find out more.

Yes that one minute obvervation makes sense. The underlying library checks if it gets a response from the tv every minute and otherwise assumes it is offline. I’ll dig deeper into the logs and source code when I get a chance. In the meanwhile, please check if you have any energy savings enabled - according to logs it takes 13mins until the device seems to respond again.

Ok, please give an update when fixed

It is working for me now. I refreshed my snapshot today. Please also clear cache and tmp folder. Here is how I do it using docker:

docker stop openhab-2.5 && \
docker rm openhab-2.5 && \
docker pull openhab/openhab:2.5.0-snapshot-amd64-debian && \
sudo rm -rf /opt/openhab-exp/userdata/cache && \
sudo rm -rf /opt/openhab-exp/userdata/tmp && \
sudo rm -rf /opt/openhab-exp/userdata/logs/* && \
docker run \
        --name openhab-2.5 \
         --tty \
        -v /etc/localtime:/etc/localtime:ro \
        -v /etc/timezone:/etc/timezone:ro \
        -v /opt/openhab-exp/conf:/openhab/conf \
        -v /opt/openhab-exp/userdata:/openhab/userdata \
        -v /opt/openhab-exp/addons:/openhab/addons \
        -e USER_ID=998 \
        -e GROUP_ID=995 \
        --net=dockernet \
        -d \
        --restart=always \
openhab/openhab:2.5.0-snapshot-amd64-debian

Unfortunately, I have no succes in getting the binding operational in OH 2.5.0-SNAPSHOT. I tried to configure everything through configuration files first, but since that didn’t work, I restarted (clean install) with Paper UI, without succes.
The steps taken:

  1. Start clean install of OH 2.5.0-SNAPSHOT in Docker container (with --net=host).
  2. Select ''Standard Setup" in web interface.
  3. Start Paper UI and add ‘LGWebOSTV’ binding in Paper UI.
  4. Nothing appears in the Inbox and no pop-up for approval on the TV.
  5. Manually scan for Things gives no results either.

I run OH in a Docker container, with commands similar to what you (@sprehn) mentioned here, except that I use --net=host:

docker pull openhab/openhab:2.5.0-snapshot-amd64-debian && \
sudo rm -rf /opt/openhab-tst/userdata/cache && \
sudo rm -rf /opt/openhab-tst/userdata/logs/* && \
sudo rm -rf /opt/openhab-tst/userdata/tmp && \
docker run \
        -d \
        --name openhab-tst \
        -v /etc/localtime:/etc/localtime:ro \
        -v /etc/timezone:/etc/timezone:ro \
        -v /opt/openhab-tst/addons:/openhab/addons \
        -v /opt/openhab-tst/conf:/openhab/conf \
        -v /opt/openhab-tst/userdata:/openhab/userdata \
        -e USER_ID=109 \
        -e GROUP_ID=116 \
        -e OPENHAB_HTTP_PORT=9091 \
        -e OPENHAB_HTTPS_PORT=9443 \
        --net=host \
openhab/openhab:2.5.0-snapshot-amd64-debian

What’s wrong with my setup?
Also, as I don’t use Paper UI for my ‘production’ openHAB setup, I really like to know how to get it configured without using Paper UI…

Hi,

looks good "--host=net" works as well and is not the issue. I assume in your services/addons.cfg you have binding = lgwebos , ..... Please note. for ruleengine, you also need to include misc = ruleengine.

I left the addons.cfg untouched for this test since there are reports of issues with OH when mixing addons.cfg settings with Paper UI settings. Adding it the the addons.cfg made no difference, still nothing is discovered. The binding is active as shown in the Karaf console.

With debug enabled, the following is logged on startup of OH:

2019-01-16 21:56:39.698 [WARN ] [g.eclipse.smarthome.core.net.NetUtil] - Found multiple local interfaces - ignoring 192.168.1.2
2019-01-16 21:56:41.187 [INFO ] [.dashboard.internal.DashboardService] - Started Dashboard at http://192.168.1.4:9080
2019-01-16 21:56:41.189 [INFO ] [.dashboard.internal.DashboardService] - Started Dashboard at https://192.168.1.4:9443
2019-01-16 21:56:41.772 [INFO ] [thome.model.lsp.internal.ModelServer] - Started Language Server Protocol (LSP) service on port 6007
2019-01-16 21:56:54.699 [DEBUG] [org.openhab.binding.lgwebos         ] - BundleEvent INSTALLED - org.openhab.binding.lgwebos
2019-01-16 21:56:55.041 [DEBUG] [org.openhab.binding.lgwebos         ] - BundleEvent RESOLVED - org.openhab.binding.lgwebos
2019-01-16 21:56:55.302 [INFO ] [.internal.GenericScriptEngineFactory] - Activated scripting support for ECMAScript
2019-01-16 21:56:55.319 [INFO ] [.internal.GenericScriptEngineFactory] - Activated scripting support for ECMAScript
2019-01-16 21:56:55.641 [DEBUG] [org.openhab.binding.lgwebos         ] - BundleEvent STARTING - org.openhab.binding.lgwebos
2019-01-16 21:56:55.648 [DEBUG] [org.openhab.binding.lgwebos         ] - BundleEvent STARTED - org.openhab.binding.lgwebos
2019-01-16 21:56:55.735 [DEBUG] [.internal.discovery.LGWebOSDiscovery] - Config Parameters: {component.name=org.openhab.binding.lgwebos.internal.discovery.LGWebOSDiscovery, component.id=202}
2019-01-16 21:56:55.752 [DEBUG] [org.openhab.binding.lgwebos         ] - ServiceEvent REGISTERED - {org.eclipse.smarthome.config.discovery.DiscoveryService, org.openhab.binding.lgwebos.internal.discovery.LGWebOSDiscovery}={service.id=345, service.bundleid=210, service.scope=bundle, component.name=org.openhab.binding.lgwebos.internal.discovery.LGWebOSDiscovery, component.id=202} - org.openhab.binding.lgwebos
2019-01-16 21:56:55.784 [DEBUG] [org.openhab.binding.lgwebos         ] - ServiceEvent REGISTERED - {org.eclipse.smarthome.core.thing.binding.ThingHandlerFactory}={service.id=346, service.bundleid=210, service.scope=bundle, component.name=org.openhab.binding.lgwebos.internal.LGWebOSHandlerFactory, component.id=203} - org.openhab.binding.lgwebos
2019-01-16 21:56:56.739 [INFO ] [arthome.ui.paper.internal.PaperUIApp] - Started Paper UI at /paperui

When performing a manual scan for things, nothing is logged…

BTW, an earlier test with OH 2.4.0 did succeed in discovering the TV and creating a Thing in Paper UI. I also tried adding that ID to a Things file in 2.5.0-SNAPSHOT.

EDIT: Is there a way to manually add the TV with configuration files and somehow generate an ID an connection to the TV?

So the binding seems to start just fine.

what about this line? maybe it is ignoring the wrong interface.

the binding will pick the primary interface configured in PaperUI > Configuration > System > Network Settings.

You could alternatively set the local IP explicitly in the bindings configuration.

Should have mentioned that I’ve also tried with localIP to the other NIC.

EDIT: Will try on another Linux system with one interface tomorrow.

Can confirm that it works on another (same Debian version/config) system with just one NIC and without Docker. Will have to dig deeper in the network setup, I suppose…

Still, my question: is it somehow possible to setup without Paper UI or at least without needing the discovery or being able to add it manually after initial discovery? :grinning:

UPDATE: after creating a user-defined bridge for Docker, it now runs in Docker on the multi-NIC system as well. Any suggestions on how to make this work with a .things file? Tried adding the generated ID to the Things definition but it remains in a UNINITIALIZED - HANDLER_CONFIGURATION_PENDING state with this definition:

Thing lgwebos:WebOSTV:tv1 [ id="d8fe390c-d43b-412a-b8fa-578b55b1ba0b" ]

and it results of course in two Things in Paper UI, one for tv1 (uninitialized) and one for d8fe390c-d43b-412a-b8fa-578b55b1ba0b (online).

I am not using .things files myself, but according to the documentation I would think it should be:

Thing lgwebos:WebOSTV:d8fe390c-d43b-412a-b8fa-578b55b1ba0b "Fernseher"

Toast messages are not working on my new TV (LGOLED65B8).
All other channels and actions are working as expected. Also the debug log (lgwebos & connectsdk) does not show more information.

Here are the log entries from the toast (via channel or action -> the same)

[DEBUG] [nding.lgwebos.handler.LGWebOSHandler] - handleCommand(lgwebos:WebOSTV:06deb30c-07ac-4833-9fe3-04855fb98967:toast,Test) is called
[DEBUG] [com.connectsdk.core.Log             ] - Connect SDK - webOS Socket [OUT] : {"payload":{"iconExtension":"png","message":"Test","iconData":"iVBORw0KGgoAAAANSUh....

Btw. on each restart of openhab I get the following WARNING:

[WARN ] [ng.lgwebos.internal.TVControlChannel] - error requesting channel list: Application error.

I have exactly the same problem.
I have an LG OLED C8.
It worked with my 3 year old LG LED TV. Since I replaced it with the OLED, everything works (volume control etc) except for toast messages.

Did you find a solution? Could it be that newer LG TV’s do not allow toast messages anymore?

I am using OH 2.4.0 and everything I tried works fine with my LG OLED55B7.

There is just one thing bugging me:
When I switch the TV on (via a rule using WOL), it takes about 20 seconds until the Thing comes online. So, I cannot write rules that switch the TV on and a few seconds later for example switch to Netflix.
I guess the binding tries once per minute or so to check if the TV was switched on. Is it somehow possible to “wake” the Thing via code in the rule? Say, when I know I have just switched the TV on, I would wake it maybe 5 seconds later.

Thanks!

not that I am aware of, unfortunately.

After more testing, I recognized that it is not the binding which is causing the delay, it is the TV itself.
But by enabling “Quick Start+” in the TV settings, I can get the delay down to under 10 seconds and this is acceptable.
However, it remains to be seen if that option has disadvantages (besides more standby power drain).

To fix this problem I use this rule:

....
 scene_living_timer = createTimer(now, [ |
                            var statustv = getThingStatusInfo("lgwebos:WebOSTV:7abca087-57d4-4c39-9aa4-3b25ec6e1b4e").getStatus().toString()
                            if(statustv!="ONLINE") scene_living_timer.reschedule(now.plusMillis(500))
                            else {
                                Thread::sleep(500)
                                TV_Living_Application.sendCommand("com.webos.app.hdmi1")
                                createTimer(now.plusSeconds(4),[
                                        TV_Living_Volume.sendCommand(30)
                                        TV_Living_Toast.sendCommand("Satbox started")
                                ]) 
                                scene_living_timer.cancel 
                                scene_living_timer = null
                            }
                        ])

Same issue here, Did you solve it?