LGWebOS Binding (for LG WebOS TVs)

dumb copy past mistake.

thanks!

I have tried the Network Health to monitor the power status. It works - but having it in the binding would be great. Any plans?

In the logs i can see that the state is monitored
`

2016-05-19 21:40:17.184 [INFO ] [b.c.internal.ConnectSDKBinding] - Device removed: {"modelName":"LG Smart TV","lastConnected":1463681863,"lastKnownIPAddress":"172.16.x.x","modelNumber":"32LF652V-ZB","id":"eeb5691e-387b-xxxx-xxxx30c91f0b026x","services":{},"lastDetection":1463681858,"friendlyName":"LGTV"}

`
So i wonder if it is possible towrite a rule checking if the tv is on without using network health


actually the binding already does this when you bind to the PowerControl

Switch LG_TV0_Power “Power” { connectsdk=“lgwebostv.fritz.box:PowerControl:power”, autoupdate=“false” }

As soon as i change frpm Hetwork Health to LG power rules stop working.
I guess it is somehow connected to pairing not staying in place. Still struggling to understand when pairing is requested Is it normal for pairing to be done after each openhab restart?
In the logs i see the folllowing (Removed client and server keys)

2016-05-21 09:22:33.984 [WARN ] [osphere.cpr.DefaultBroadcaster] - Duplicate resource    580a1dc8-7c1f-4edf-9695-ba8f200af74e. Could be caused by a dead connection not detected by your server. Replacing the old one with the fresh one
2016-05-21 09:23:08.311 [INFO ] [b.c.internal.ConnectSDKBinding] - added: {"modelName":"LG Smart     TV","lastConnected":9223372036854775807,"lastKnownIPAddress":"x.x.x.x","modelNumber":"32LF652V-ZB","id":"009d5730-f938-4912-b18a-b42b61f6b4d8","services":{"32316e70-50ab-3bfd-6d9c-912b0ff09eb9":{"description":{"filter":"urn:lge-com:service:webos-second-screen:1","modelName":"LG Smart TV","port":1817,"ipAddress":"x.x.x.x","modelNumber":"32LF652V-ZB","serviceId":"webOS TV","uuid":"32316e70-50ab-3bfd-6d9c-912b0ff09eb9","version":"4.1.0","friendlyName":"LGTV"},"class":"WebOSTVService","config":{"lastDetection":1463811788,"UUID":"32316e70-50ab-3bfd-6d9c-912b0ff09eb9","class":"ServiceConfig"}}},"lastDetection":1463811788,"friendlyName":"LGTV"}
2016-05-21 09:23:08.849 [INFO ] [b.c.internal.ConnectSDKBinding] - Pairing required.
2016-05-21 09:23:41.518 [INFO ] [b.c.internal.ConnectSDKBinding] - Device ready: {"modelName":"LG Smart TV","lastConnected":1463811821,"lastKnownIPAddress":"x.x.x.x","modelNumber":"32LF652V-ZB","id":"009d5730-f938-4912-b18a-b42b61f6b4d8","services":{"32316e70-50ab-3bfd-6d9c-912b0ff09eb9":{"description":{"filter":"urn:lge-com:service:webos-second-screen:1","modelName":"LG Smart TV","port":1817,"ipAddress":"x.x.x.x","modelNumber":"32LF652V-ZB","serviceId":"webOS TV","uuid":"32316e70-50ab-3bfd-6d9c-912b0ff09eb9","version":"4.1.0","friendlyName":"LGTV"},"class":"WebOSTVService","config":{"clientKey":"xx","serverCertificate":"xx=","lastDetection":9223372036854775807,"UUID":"32316e70-50ab-3bfd-6d9c-912b0ff09eb9","class":"WebOSTVServiceConfig"}}},"lastDetection":1463811788,"friendlyName":"LGTV"}
2016-05-21 09:23:52.762 [WARN ] [osphere.cpr.DefaultBroadcaster] - Duplicate resource 8c550d0f-e171-4d1a-bd85-23a637f40b92. Could be caused by a dead connection not detected by your server. Replacing the old one with the fresh one

And afterwards a lot of strings in log like

2016-05-21 09:26:38.100 [WARN ] [osphere.cpr.DefaultBroadcaster] - Duplicate resource d44f4bcf-c7a9-46fa-bae5-31cfb6bdc81x. Could be caused by a dead connection not detected by your server. Replacing the old one with the fresh one
2016-05-21 09:27:44.545 [WARN ] [osphere.cpr.DefaultBroadcaster] - Duplicate resource d44f4bcf-c7a9-46fa-bae5-31cfb6bdc81x. Could be caused by a dead connection not detected by your server. Replacing the old one with the fresh one
2016-05-21 09:28:51.213 [WARN ] [osphere.cpr.DefaultBroadcaster] - Duplicate resource d44f4bcf-c7a9-46fa-bae5-31cfb6bdc81x. Could be caused by a dead connection not detected by your server. Replacing the old one with the fresh one

Still no luck with this binding. I resetted the TV and also installed a new instance with openhab 2b3. After initial pairing TV doesn’t get reconnected. It Only gets reconnected, when i start openhab new, while TV is running. While it is connected everything is working fine.
Still no idea why this is happening.
@sprehn maybe there is a problem with my TV Model LB670V?

Edit:

Also there is a strange error when i restart openhab in the Log:
2016-06-05 20:08:04.052 [INFO ] [me.event.ThingStatusInfoChangedEvent] - ‘connec tsdk:WebOSTV:192_168_178_102’ changed from OFFLINE to UNINITIALIZED (HANDLER_MIS SING_ERROR)

Is this binding compatible with OH2?

check my post on 25 March
I made a oh2 version.

Missed that one. Installed. I can see that i can configure it via paper UI. But to keep it simple - can it be configured by adding connectSDK.cfg to the services dir?

Need to configure as got 2016-06-08 07:14:54.883 [ERROR] [ternal.discovery.ConnectSDKDiscovery] - Autodetection of local IP (via getNetworkInterfaces) failed, as multiple interfaces where detected:

For the loclIP in the Paper UI
or the localIP= in cons/services/connectsdk.cfg

do i put in local ip of the openhab controller or the tv? Tried both but it doesn’t seem to work.

It has to be your local ip of the opnehab controller

Done. Trying to discover thing via the PaperUI doesn’t find anything. No information in logs available. What is the best way to debug?
Seems also there is no way to manually add ip. I can see it emtu in the properties but no edit option available

Well got it working in OH2.

The problem was that IPv6 was enabled on the eth0 interface. So the binding gave an error

2016-06-08 07:14:54.883 [ERROR] [ternal.discovery.ConnectSDKDiscovery] - Autodetection of local IP (via getNetworkInterfaces) failed, as multiple interfaces where detected

Setting the IP (ipv4) manually in the cfg file or paperUI had no effect.
After disabling the ipv6 - the tv was finally discovered

Are you still working on this?

My device still doesn’t reconnect correctly after turning tv off and on. When I unlink the Power Channel and Link it again the device is ready and I control it again, so there have to be an error regarding this.

@sprehn
I am interested on this, do you plan to continue working on it? I don’t have much programming knowledge or anything like that but I can help testing if necessary.

Hi
no aktiv work at the moment. also since both the 1.8 and the 2.0 version of the plugin seemed to work ok. one user reported a problem with disconnected tv which we were unable to trace to a root cause however i suspect this is an issue with the underlying connectsdk framework which is abandoned now.

what is not working for you?

regards
sebastian

Hi, @sprehn,

I was wondering whether a connectsdk binding could be used to control audio/video streaming, too, as this is a feature of the underlying connectsdk library. This led us to the question whether you included the original connectsdk library in your binding. (Is there a native connectsdk java library at all?)

Would be great if you could comment on https://github.com/openhab/openhab2-addons/pull/1398#issuecomment-260077157 (or here).

Thank you very much in advance!
Jack

Hi Jack,

I created the openhab binding based on connectsdk’s java version, which was designed for android devices. It is working fine in to control WebOs based TVs both in 1.8 and also in a 2.0 version of the binding. I did not get my Apple TV to work with the base lib and don’t have any other devices to test, so I did not activate any of those devices in the binding.
The idea was to keep the lib unmodified as much as possible to allow easy merging from upstream. I took android stubs and implementing only those interfaces actually required.

So the latest binding jars that can be downloaded are a mix of binding code and fork from connectsdk. I did not think it is clean enough to submit it to the main project. On the other hand it’s working fine for me and some other testers. So I got sidetracked and paused my efforts for a while.

Connectsdk as a project seems to be abandoned by LG. Apparently they released their dev team in Silicon Valley a while ago. There has not been a release since version 1.6.

Realizing this, I started my own fork of connect sdk with the goal to remove android dependencies.
https://github.com/sprehn/Connect-SDK-Android-Core This lib could than be added as a dependency to the binding. I was also planning to rename the binding to sth like WebOS binding.

To answer your question, all features that Connect SDK supports should theoretically be available, but at the moment those are not accessible via the binding.

Kind Regards
Sebastian

Hi! Thank you for binding.
Please help with issue, i can send text messages to LG TV:

String    Device_TV_Toast            "Message [%s]"    { connectsdk="192.168.1.9:ToastControl:toast" }

But i didnt received status of items below:

String    Device_TV_Input            "TV input [%s]"         { connectsdk="192.168.1.9:ExternalInputControl:input" }
String    Device_TV_ChannelName    "Channel: [%s]"        { connectsdk="192.168.1.9:TVControl:channelName" }

Hi,
well, this is the item definition I am using:

String LG_TV0_InputSelection "TV Eingang"
String LG_TV0_Input “Input” { connectsdk=“lgwebostv.fritz.box:ExternalInputControl:input” }
String LG_TV0_ChannelName “Channel: [%s]” { connectsdk=“lgwebostv.fritz.box:TVControl:channelName” }

and these this is my sitemap entries:
Selection item=LG_TV0_InputSelection mappings=[0=“TV”, 1=“Apple TV”, 2=“Playstation”]

Text item=LG_TV0_Input
Text item=LG_TV0_ChannelName

and rules:

rule "input selection"
when
Item LG_TV0_InputSelection received update
then
val String selection = LG_TV0_InputSelection.state.toString
logInfo(“input selection”, “value”, selection)
if(“0”.equals(selection)) {
sendCommand(LG_TV0_Channel, 1)
}
if(“1”.equals(selection)) {
sendCommand(LG_TV0_Input, “HDMI_3”)
}
if(“2”.equals(selection)) {
sendCommand(LG_TV0_Input, “HDMI_1”)
}
end

I LG_TV0_Input really just works when you sendCommand(LG_TV0_Input, "HDMI_3“) or sendCommand(LG_TV0_Input, "HDMI_1“).
There is no notification mechanism to detect when the TV changes input.

But ChannelName should work and update automatically.

Kind Regards
Sebastian