Connect SDK Binding (for LG WebOS TVs)

webos
connectsdk
Tags: #<Tag:0x00007f0156ab32a0> #<Tag:0x00007f0156aaffb0>

(Ron) #506

EDIT: Never mind, I was not paying attention, the TV had gone to standby by the time I started testing this…


(Jens) #507

I have the same problem as lfs_alp5
After a short while, the TV status changes from ON to OFF and back again.
I also use lgwebos-2.4.0-snapshot-201810302216


(Sebastian Prehn) #508

@Tobi77, @lfs_alp5, @timer
when you enable debug logging

log:set debug org.openhab.binding.lgwebos
log:set debug com.connectsdk

do you see activity before the tv goes offline?


(Sebastian Prehn) #509

Pull Request #2926 was just merged. With the new 2.5 version you can use classic rules to launch the browser on a url.

	 val actions = getActions("lgwebos","lgwebos:WebOSTV:3aab9eea-953b-4272-bdbd-f0cd0ecf4a46")
	 if(null === actions) {
	        logInfo("actions", "Actions not found, check thing ID")
	        return
	 }
	 actions.launchBrowser("https://www.openhab.org")
	 ```

(Sebastian Prehn) #510

The next version includes more detailed debug statements. I would suggest you monitor the situation with debug enabled.

log:set debug org.openhab.binding.lgwebos
log:set debug com.connectsdk

In the 2.5 version there will be debug statements that tell us if the TV does not have the required capability.


(Sebastian Prehn) #511

2.5 will version will also include caching of channels and applications. So changing channels or applications should be much more responsive.

There is also now support to increase or decrease a channel according to the TVs current channel list like so:

rule "ChannelUpDown"
when Item LG_TV0_ChannelDummy received command
then
	 val actions = getActions("lgwebos","lgwebos:WebOSTV:3aab9eea-953b-4272-bdbd-f0cd0ecf4a46")
	 if(null === actions) {
	        logInfo("actions", "Actions not found, check thing ID")
	        return
	 }
	 switch receivedCommand{
       		    case 0: actions.decreaseChannel() 
        	    case 1: actions.increaseChannel()
	 }
end

the difference to our approach using current channel +1 or -1 is that it will go to the next channel in you current list of channels, not the next numeric value.


(Tobias) #512

@sprehn Dear Sebastian, thanks a lot! I am currently on milestone versions, so I have to wait until the new version is published. I will come back then and report.


(Kenny Batselier) #513

@sprehn it seems like the ‘getActions’ is not working for me. In the log I get the ‘Actions not found, check thing ID’ message. So this means the result of ‘getActions’ was null. The thing ID should be correct so really no idea what can be wrong. I’m on version 2.4.0 on synology. Any idea?


(Sebastian Prehn) #514

it will only be available in 2.5 snapshots


(Kenny Batselier) #515

@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?


(Jens) #516

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)


(Sebastian Prehn) #517

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.


(Sebastian Prehn) #518

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.


(Kenny Batselier) #519

Ok, please give an update when fixed


(Sebastian Prehn) #520

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

(Ron) #521

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…


(Sebastian Prehn) #522

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.


(Ron) #523

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?


(Sebastian Prehn) #524

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.


(Ron) #525

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.