Connect SDK Binding (for LG WebOS TVs)

webos
connectsdk
Tags: #<Tag:0x00007f014b377730> #<Tag:0x00007f014b377230>

(William) #306

Hi, I’ve been using this binding for well over a year without any issues, recently it has stopped working after a short period of time after the TV has been switched on. I have updated the addon however the issue isn’t solved. I have posted below the logs from myself turning the TV on to the point of failure. Any help would be appreciated.


==> /var/log/openhab2/events.log <==
2017-10-29 19:06:12.501 [hingStatusInfoChangedEvent] - 'lgwebos:WebOSTV:192_168_1_78' changed from OFFLINE: TV is off to ONLINE: Device Ready
2017-10-29 19:06:17.506 [hingStatusInfoChangedEvent] - 'lgwebos:WebOSTV:192_168_1_78' changed from ONLINE: Device Ready to ONLINE: Connected

==> /var/log/openhab2/openhab.log <==
2017-10-29 19:07:14.226 [DEBUG] [nding.lgwebos.handler.LGWebOSHandler] - Capabilities updated: {"modelName":"LG Smart TV","lastConnected":1509303977,"lastKnownIPAddress":"192.168.1.78","id":"d57cb211-5cc6-4c66-9ebe-539c68174e2b","services":{},"lastDetection":1509303972,"friendlyName":"lg"} - added: [] - removed: [VolumeControl.Get, VolumeControl.Set, VolumeControl.UpDown, VolumeControl.Subscribe, VolumeControl.Mute.Get, VolumeControl.Mute.Set, VolumeControl.Mute.Subscribe, MediaPlayer.Display.Image, MediaPlayer.Play.Video, MediaPlayer.Play.Audio, MediaPlayer.Close, MediaPlayer.MetaData.Title, MediaPlayer.MetaData.Description, MediaPlayer.MetaData.Thumbnail, MediaPlayer.MetaData.MimeType, MediaPlayer.MediaInfo.Get, MediaPlayer.MediaInfo.Subscribe, TextInputControl.Send, TextInputControl.Enter, TextInputControl.Delete, TextInputControl.Subscribe, MouseControl.Connect, MouseControl.Disconnect, MouseControl.Click, MouseControl.Move, MouseControl.Scroll, KeyControl.Up, KeyControl.Down, KeyControl.Left, KeyControl.Right, KeyControl.OK, KeyControl.Back, KeyControl.Home, KeyControl.KeyCode, MediaPlayer.Display.Image, MediaPlayer.Play.Video, MediaPlayer.Play.Audio, MediaPlayer.Close, MediaPlayer.MetaData.Title, MediaPlayer.MetaData.Description, MediaPlayer.MetaData.Thumbnail, MediaPlayer.MetaData.MimeType, MediaPlayer.MediaInfo.Get, MediaPlayer.MediaInfo.Subscribe, Launcher.App, Launcher.App.Params, Launcher.App.Close, Launcher.App.List, Launcher.Browser, Launcher.Browser.Params, Launcher.Hulu, Launcher.Hulu.Params, Launcher.Netflix, Launcher.Netflix.Params, Launcher.YouTube, Launcher.YouTube.Params, Launcher.AppStore, Launcher.AppStore.Params, Launcher.AppState, Launcher.AppState.Subscribe, Launcher.RunningApp, Launcher.RunningApp.Subscribe, TVControl.Channel.Get, TVControl.Channel.Set, TVControl.Channel.Up, TVControl.Channel.Down, TVControl.Channel.List, TVControl.Channel.Subscribe, TVControl.Program.Get, TVControl.Program.List, TVControl.Program.Subscribe, TVControl.Program.List.Subscribe, TVControl.3D.Get, TVControl.3D.Set, TVControl.3D.Subscribe, ExternalInputControl.Picker.Launch, ExternalInputControl.Picker.Close, ExternalInputControl.List, ExternalInputControl.Set, ToastControl.Show, ToastControl.Show.Clickable.App, ToastControl.Show.Clickable.App.Params, ToastControl.Show.Clickable.URL, PowerControl.Off, WebAppLauncher.Launch, WebAppLauncher.Launch.Params, WebAppLauncher.Message.Send, WebAppLauncher.Message.Receive, WebAppLauncher.Message.Send.JSON, WebAppLauncher.Message.Receive.JSON, WebAppLauncher.Connect, WebAppLauncher.Disconnect, WebAppLauncher.Join, WebAppLauncher.Close, WebAppLauncher.Pin, MediaControl.Play, MediaControl.Pause, MediaControl.Stop, MediaControl.Rewind, MediaControl.FastForward, MediaControl.Seek, MediaControl.Previous, MediaControl.Next, MediaControl.Duration, MediaControl.PlayState, MediaControl.PlayState.Subscribe, MediaControl.Position, MediaPlayer.Subtitle.WebVTT, PlaylistControl.JumpToTrack, PlaylistControl.Next, PlaylistControl.Previous, MediaPlayer.Loop]
2017-10-29 19:07:14.228 [DEBUG] [.internal.discovery.LGWebOSDiscovery] - Device removed: {"modelName":"LG Smart TV","lastConnected":1509303977,"lastKnownIPAddress":"192.168.1.78","id":"d57cb211-5cc6-4c66-9ebe-539c68174e2b","services":{},"lastDetection":1509303972,"friendlyName":"lg"}
2017-10-29 19:07:14.255 [DEBUG] [nding.lgwebos.handler.LGWebOSHandler] - Device disconnected: {"modelName":"LG Smart TV","lastConnected":1509303977,"lastKnownIPAddress":"192.168.1.78","id":"d57cb211-5cc6-4c66-9ebe-539c68174e2b","services":{},"lastDetection":1509303972,"friendlyName":"lg"}

==> /var/log/openhab2/events.log <==
2017-10-29 19:07:14.265 [hingStatusInfoChangedEvent] - 'lgwebos:WebOSTV:192_168_1_78' changed from ONLINE: Connected to OFFLINE: TV is off


(Sebastian Prehn) #307

hey @sintei , could you try once more and just use “IP” as the property name?


(Sebastian Prehn) #308

no idea really. the network connection must have been lost


(Peter Haugaard) #309

Hi .

I am trying to use the binding to my LG TV, and it finds it fine, but then it goes offline. This is the log:
2017-11-05 19:34:38.511 [ThingAddedEvent ] - Thing ‘lgwebos:WebOSTV:192_168_77_31’ has been added.
2017-11-05 19:34:38.580 [hingStatusInfoChangedEvent] - ‘lgwebos:WebOSTV:192_168_77_31’ changed from UNINITIALIZED to INITIALIZING
2017-11-05 19:34:38.589 [hingStatusInfoChangedEvent] - ‘lgwebos:WebOSTV:192_168_77_31’ changed from INITIALIZING to ONLINE: Device Ready
2017-11-05 19:34:39.188 [hingStatusInfoChangedEvent] - ‘lgwebos:WebOSTV:192_168_77_31’ changed from ONLINE: Device Ready to ONLINE (CONFIGURATION_PENDING): Pairing Required
2017-11-05 19:35:39.226 [ItemStateChangedEvent ] - LGWebOSTVOLED65B6V_Power changed from NULL to OFF
2017-11-05 19:35:39.236 [hingStatusInfoChangedEvent] - ‘lgwebos:WebOSTV:192_168_77_31’ changed from ONLINE (CONFIGURATION_PENDING): Pairing Required to OFFLINE: TV is off

It says pairing is needed and I don’t know how to do this.

Hope you can help.

BR
Peter


(Sebastian Prehn) #310

at this point you should see a Yes/No question pop up on your TV screen. You have to answer with “Yes” or remove the TV from your things and re-run discovery.


(Peter Haugaard) #311

Thank for your swift reply.

It works now.

BR
Peter


(Nicke) #312

Tried it and it did not work :frowning:
I’m on openhab build 2.2 1069 and using your RC2 binding.
Autodiscovery works perfect :slight_smile:

2017-11-06 18:46:32.114 [INFO ] [el.core.internal.ModelRepositoryImpl] - Loading model 'lgtvwebos3.things'
2017-11-06 18:46:32.130 [INFO ] [el.core.internal.ModelRepositoryImpl] - Refreshing model 'lgtvwebos3.things'
2017-11-06 18:46:32.138 [ERROR] [ome.core.thing.internal.ThingManager] - Exception occurred while calling thing updated at ThingHandler 'org.openhab.binding.lgwebos.handler.LGWebOSHandler@2a87d2a4': java.lang.NullPointerException
java.util.concurrent.ExecutionException: java.lang.NullPointerException
	at java.util.concurrent.FutureTask.report(Unknown Source) ~[?:?]
	at java.util.concurrent.FutureTask.get(Unknown Source) ~[?:?]
	at org.eclipse.smarthome.core.common.SafeMethodCaller.callAsynchronous(SafeMethodCaller.java:194) ~[?:?]
	at org.eclipse.smarthome.core.common.SafeMethodCaller.call(SafeMethodCaller.java:83) ~[?:?]
	at org.eclipse.smarthome.core.common.SafeMethodCaller.call(SafeMethodCaller.java:67) ~[?:?]
	at org.eclipse.smarthome.core.thing.internal.ThingManager.thingUpdated(ThingManager.java:423) ~[?:?]
	at org.eclipse.smarthome.core.thing.internal.ThingRegistryImpl.notifyTrackers(ThingRegistryImpl.java:217) ~[?:?]
	at org.eclipse.smarthome.core.thing.internal.ThingRegistryImpl.notifyListenersAboutUpdatedElement(ThingRegistryImpl.java:140) ~[?:?]
	at org.eclipse.smarthome.core.thing.internal.ThingRegistryImpl.notifyListenersAboutUpdatedElement(ThingRegistryImpl.java:1) ~[?:?]
	at org.eclipse.smarthome.core.common.registry.AbstractRegistry.updated(AbstractRegistry.java:183) ~[?:?]
	at org.eclipse.smarthome.core.common.registry.AbstractRegistry.updated(AbstractRegistry.java:1) ~[?:?]
	at org.eclipse.smarthome.core.common.registry.AbstractProvider.notifyListeners(AbstractProvider.java:57) ~[?:?]
	at org.eclipse.smarthome.core.common.registry.AbstractProvider.notifyListenersAboutUpdatedElement(AbstractProvider.java:81) ~[?:?]
	at org.eclipse.smarthome.model.thing.internal.GenericThingProvider.lambda$21(GenericThingProvider.java:894) ~[?:?]
	at java.util.ArrayList.forEach(Unknown Source) ~[?:?]
	at org.eclipse.smarthome.model.thing.internal.GenericThingProvider.createThingsFromModelForThingHandlerFactory(GenericThingProvider.java:901) ~[?:?]
	at org.eclipse.smarthome.model.thing.internal.GenericThingProvider.lambda$3(GenericThingProvider.java:294) ~[?:?]
	at java.lang.Iterable.forEach(Unknown Source) [?:?]
	at org.eclipse.smarthome.model.thing.internal.GenericThingProvider.createThingsFromModel(GenericThingProvider.java:296) [134:org.eclipse.smarthome.model.thing:0.9.0.201710240931]
	at org.eclipse.smarthome.model.thing.internal.GenericThingProvider.modelChanged(GenericThingProvider.java:736) [134:org.eclipse.smarthome.model.thing:0.9.0.201710240931]
	at org.eclipse.smarthome.model.core.internal.ModelRepositoryImpl.notifyListeners(ModelRepositoryImpl.java:309) [123:org.eclipse.smarthome.model.core:0.9.0.201710240931]
	at org.eclipse.smarthome.model.core.internal.ModelRepositoryImpl.addOrRefreshModel(ModelRepositoryImpl.java:138) [123:org.eclipse.smarthome.model.core:0.9.0.201710240931]
	at org.eclipse.smarthome.model.core.internal.folder.FolderObserver.checkFile(FolderObserver.java:242) [123:org.eclipse.smarthome.model.core:0.9.0.201710240931]
	at org.eclipse.smarthome.model.core.internal.folder.FolderObserver.processWatchEvent(FolderObserver.java:306) [123:org.eclipse.smarthome.model.core:0.9.0.201710240931]
	at org.eclipse.smarthome.core.service.WatchQueueReader.run(WatchQueueReader.java:204) [98:org.eclipse.smarthome.core:0.9.0.201710240931]
	at java.lang.Thread.run(Unknown Source) [?:?]
Caused by: java.lang.NullPointerException
	at org.openhab.binding.lgwebos.handler.LGWebOSHandler.initialize(LGWebOSHandler.java:87) ~[?:?]
	at org.eclipse.smarthome.core.thing.binding.BaseThingHandler.thingUpdated(BaseThingHandler.java:190) ~[?:?]
	at org.eclipse.smarthome.core.thing.internal.ThingManager$4.call(ThingManager.java:427) ~[?:?]
	at org.eclipse.smarthome.core.thing.internal.ThingManager$4.call(ThingManager.java:1) ~[?:?]
	at org.eclipse.smarthome.core.common.SafeMethodCaller$CallableWrapper.call(SafeMethodCaller.java:181) ~[?:?]
	at java.util.concurrent.FutureTask.run(Unknown Source) ~[?:?]
	at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) ~[?:?]
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) ~[?:?]
	... 1 more


(Sebastian Prehn) #313

Release Candidate 3 now published.

Most changes are internal. Most notable change is that the channel for TV Channel is now a Number instead of String. Channel up and down are now replaced with Increase and decrease commands to the channel “Channel”.

For relative channel changes you need an extra Dummy item and a rule:

// for relative channel changes
rule "ChannelUpDown"
when Item LG_TV0_ChannelDummy received command
then
    switch receivedCommand{
        case 0: LG_TV0_ChannelNo.sendCommand(DECREASE)
        case 1: LG_TV0_ChannelNo.sendCommand(INCREASE)
    }
end

(gdo) #314

Hello @sprehn,

thank you for this great binding.
Is it possible to add channels for the ok- and the arrow-buttons?

best regards
gdo


(Sebastian Prehn) #315

try this: KeyControl Beta Release


(gdo) #316

ok, seems that the new binding ist not working in 2.1.0.
where can I get a 2.2.0-SNAPSHOT bundle of OH?


(Sebastian Prehn) #317

I am using 2.1.0 myself.


(gdo) #318

I got an exception on startup:

openhab> java.net.SocketException: socket closed
at java.net.TwoStacksPlainDatagramSocketImpl.receive0(Native Method)
at java.net.TwoStacksPlainDatagramSocketImpl.receive(TwoStacksPlainDatagramSocketImpl.java:114)
at java.net.DatagramSocket.receive(DatagramSocket.java:812)
at com.connectsdk.discovery.provider.ssdp.SSDPClient.multicastReceive(SSDPClient.java:115)
at com.connectsdk.discovery.provider.SSDPDiscoveryProvider$4.run(SSDPDiscoveryProvider.java:275)
at java.lang.Thread.run(Thread.java:745)
java.net.SocketException: socket closed
at java.net.DualStackPlainDatagramSocketImpl.socketReceiveOrPeekData(Native Method)
at java.net.DualStackPlainDatagramSocketImpl.receive0(DualStackPlainDatagramSocketImpl.java:124)
at java.net.AbstractPlainDatagramSocketImpl.receive(AbstractPlainDatagramSocketImpl.java:143)
at java.net.DatagramSocket.receive(DatagramSocket.java:812)
at com.connectsdk.discovery.provider.ssdp.SSDPClient.responseReceive(SSDPClient.java:103)
at com.connectsdk.discovery.provider.SSDPDiscoveryProvider$3.run(SSDPDiscoveryProvider.java:255)
at java.lang.Thread.run(Thread.java:745)


(Sebastian Prehn) #319

seems like there is an issue to create the network socket to listen for SSDP discovery. There should not be any change in the code there. did you restart your OH instance?


(gdo) #320

Restart causes the same error.
So I have set up a new instance of OH with only the lgwebos-binding.
The exception does not appear any longer, but the discovery in paperui did not find my tv.
openhab.log:
org.osgi.framework.BundleException: Could not resolve module: org.openhab.binding.lgwebos [47]
Unresolved requirement: Import-Package: org.eclipse.jdt.annotation; resolution:="optional"
Unresolved requirement: Import-Package: org.eclipse.smarthome.model.script.engine.action

Caused by: java.lang.NoClassDefFoundError: org/apache/karaf/shell/support/RegexCommandLoggingFilter

The Log has 234 lines, should I post it?


(Sebastian Prehn) #321

hm, maybe it is related to your version of OH. But between this special version and RC3 there is no difference in dependencies.


(gdo) #322

You can reproduce this error:

  1. download openhab-2.1.0.zip and unzip
  2. copy org.openhab.binding.lgwebos-2.2.0-SNAPSHOT.jar to addons
  3. start oh and choose standard

(gdo) #323

I got the binding working by using a docker image of OH 2.1.0.

Now my thing is “lgwebos:WebOSTV:192_168_0_11”

lgtv.items:
Number LG_TV0_KeyDummy “Key”

lgtv.rules:
rule "Keys"
when Item LG_TV0_KeyDummy received command
then
switch receivedCommand{
case 0: sendHome(192_168_0_11)
case 1: sendOk(192_168_0_11)
}
end

default.sitemap:
Switch item=LG_TV0_KeyDummy icon=“television” mappings=[0=“Home”, 1=“Ok”]

But nothing happens.
What’s wrong?


(PeterP) #324

Works fine for me. After a lot of testing with old SDK and standard binding, this will be my solution.

Still have one issue:
Can’t use WOL to start my TV because I can’t install the WOL binding.
I also see the errors for the other (for me new) bindings that I wanted to test.
Any Idea how to solve? Or how I can “deinstall” without having installed the binding correctly?

21:05:05.364 [ERROR] [.core.karaf.internal.FeatureInstaller] - Failed installing ‘openhab-binding-hue, openhab-binding-http1, openhab-voice-marytts, openhab-misc-hueemulation, openhab-binding-wol1, openhab-transformation-jsonpath’: Unable to resolve root: missing requirement [root] osgi.identity; osgi.identity=openhab-binding-hue; type=karaf.feature; version="[2.2.0.SNAPSHOT,2.2.0.SNAPSHOT]"; filter:="(&(osgi.identity=openhab-binding-hue)(type=karaf.feature)(version>=2.2.0.SNAPSHOT)(version<=2.2.0.SNAPSHOT))" [caused by: Unable to resolve openhab-binding-hue/2.2.0.SNAPSHOT: missing requirement [openhab-binding-hue/2.2.0.SNAPSHOT] osgi.identity; osgi.identity=esh-binding-hue; type=karaf.feature [caused by: Unable to resolve esh-binding-hue/0.9.0.SNAPSHOT: missing requirement [esh-binding-hue/0.9.0.SNAPSHOT] osgi.identity; osgi.identity=org.eclipse.smarthome.binding.hue; type=osgi.bundle; version="[0.9.0.201711101643,0.9.0.201711101643]"; resolution:=mandatory [caused by: Unable to resolve org.eclipse.smarthome.binding.hue/0.9.0.201711101643: missing requirement [org.eclipse.smarthome.binding.hue/0.9.0.201711101643] osgi.wiring.package; filter:="(osgi.wiring.package=org.eclipse.smarthome.config.discovery.upnp)"]]]


(Sebastian Prehn) #325

try with

sendHome("192.168.0.11")