LGWebOS Binding (for LG WebOS TVs)

well, you are right. you have to sign in to github

I don’t what’s going on here, but I am logged in to github and can’t even see your repo. Searching for sprehn on github returns nothing


ill post to github Support.

GitHub fixed the issue. try again

So download was working - but I already had the latest version :frowning:
Here is the log you requested (not actually xml, but the platforms doesn’t allow upload auf txt files
)
connect.log.xml (65.1 KB)

I did another test with ip - no difference. Here is log:

2016-01-13 22:12:43.837 DEBUG o.o.b.c.i.ConnectSDKBinding[:112]- internalReceiveCommand(LG_TV0_Toast,Test) is called!
2016-01-13 22:12:43.842 WARN  o.o.b.c.i.ConnectSDKBinding[:125]- 192.168.178.28 not found under connect sdk devices. Skipping item LG_TV0_Toast
2016-01-13 22:13:31.325 INFO  o.o.b.c.i.ConnectSDKBinding[:158]- added: {"id":"8a1726c7-0da2-4714-b5c9-857adf82ba3f","services":{"46e7fa86-5ee0-6646-16d2-dc69012b4288":{"description":{"port":1621,"modelName":"LG Smart TV","serviceId":"webOS TV","friendlyName":"[LG] webOS TV","uuid":"46e7fa86-5ee0-6646-16d2-dc69012b4288","modelNumber":"65UC970V-ZA","filter":"urn:lge-com:service:webos-second-screen:1","version":"4.0.3","ipAddress":"192.168.178.28"},"config":{"UUID":"46e7fa86-5ee0-6646-16d2-dc69012b4288","class":"ServiceConfig","lastDetection":1452719611},"class":"WebOSTVService"}},"lastConnected":9223372036854775807,"modelName":"LG Smart TV","lastKnownIPAddress":"192.168.178.28","friendlyName":"[LG] webOS TV","lastDetection":1452719611,"modelNumber":"65UC970V-ZA"}
2016-01-13 22:13:32.145 INFO  o.o.b.c.i.ConnectSDKBinding[:165]- Pairing required.
2016-01-13 22:13:55.293 DEBUG o.o.b.c.i.ConnectSDKBinding[:112]- internalReceiveCommand(LG_TV0_Toast,Test) is called!

As you can see there the first toast message was sent before the pairing and failed. Then pairing occured and there was no error for the toast message


Hi,

I checked you log. Something is wrong during the pairing process. I see a lot of “Pairing required” followed by “Device disconnected”.
2016-01-13 20:59:18.606 INFO o.o.b.c.i.ConnectSDKBinding[:165]- Pairing required. 2016-01-13 21:00:06.170 DEBUG o.o.b.c.i.ConnectSDKBinding[:184]- Device disconnected:

Normally it should be
22:35:28.398 INFO o.o.b.c.i.ConnectSDKBinding[:165]- Pairing required. 22:35:30.655 INFO o.o.b.c.i.ConnectSDKBinding[:175]- Device ready: ...

I assume you clicked “Yes” when your TV asked you to pair. And this should only happen once. Looks like this happens everytime you turn on the TV


Could you please check that in your openhab installation folder (e.g. /opt/openhab) you have a subfolder etc/connect_sdk
with a file by the name “StoredDevices”. This file should not be empty, but contain a json structure with reference to your TV. If this is not the case, please check the folder permissions. should be writable to openhab

And can you tell me a little bit more about your OS. We have so far tested on linux and macos. Maybe you run on windows and the bug is somehow platform dependent.

Hey strelok1986,

is the binding working for you now?

Sebastian

Hi Sebastian,

Thank you so much for working on this binding, keep up the great work.
I have managed to get the binding working with my 2015 LG TV but have one issue. The pairing worked fine and the tests I have done work, unfortuneately though it only stays connect for a minute or 2 and then in the logs shows Device Removed. I then have to turn off the TV, wait a few seconds, turn it back on, wait a few more seconds and then it connects again. Minute or 2 later it drops again I have to follow the same process!! Do you have any troubleshooting tips or ideas of how to fix?

Exact Log:

2016-01-14 20:35:38.024 [INFO ] [b.c.internal.ConnectSDKBinding] - Device ready: {“modelName”:“LG Smart TV”,“lastConnected”:1452803738,“lastKnownIPAddress”:“192.168.1.122”,“id”:"f17ed198-566f-4d00-aa19-0b55$
2016-01-14 20:36:42.118 [INFO ] [b.c.internal.ConnectSDKBinding] - Device removed: {“modelName”:“LG Smart TV”,“lastConnected”:1452803738,“lastKnownIPAddress”:“192.168.1.122”,“id”:"f17ed198-566f-4d00-aa19-0b$

1 Like

No the directory does not exist. /opt/openhab/etc/ is writable for my openhab user.
I’m running openhab on ubuntu on cubietruck.

Some more logs

2016-01-14 22:49:40.448 DEBUG android.util.Log[:23]- Connect SDK - Service added: [LG] webOS TV (webOS TV)
2016-01-14 22:49:40.455 DEBUG android.util.Log[:23]- Connect SDK - Adding service webOS TV to device with address 192.168.178.28 and id 6034723d-e77d-4d91-a88b-1ccdf5777789
2016-01-14 22:49:40.520 INFO  o.o.b.c.i.ConnectSDKBinding[:158]- added: {"id":"6034723d-e77d-4d91-a88b-1ccdf5777789","services":{"46e7fa86-5ee0-6646-16d2-dc69012b4288":{"description":{"port":1579,"modelName":"LG Smart TV","serviceId":"webOS TV","friendlyName":"[LG] webOS TV","uuid":"46e7fa86-5ee0-6646-16d2-dc69012b4288","modelNumber":"65UC970V-ZA","filter":"urn:lge-com:service:webos-second-screen:1","version":"4.0.3","ipAddress":"192.168.178.28"},"config":{"UUID":"46e7fa86-5ee0-6646-16d2-dc69012b4288","class":"ServiceConfig","lastDetection":1452808180},"class":"WebOSTVService"}},"lastConnected":9223372036854775807,"modelName":"LG Smart TV","lastKnownIPAddress":"192.168.178.28","friendlyName":"[LG] webOS TV","lastDetection":1452808180,"modelNumber":"65UC970V-ZA"}
2016-01-14 22:49:40.795 DEBUG android.util.Log[:23]- Connect SDK - Expecting device cert (any)
2016-01-14 22:49:41.047 DEBUG android.util.Log[:23]- Connect SDK - webOS Socket [IN] : {"type":"hello","payload":{"protocolVersion":1,"deviceType":"tv","deviceOS":"webOS","deviceOSVersion":"4.0.3","deviceOSReleaseVersion":"1.4.0","deviceUUID":"46e7fa86-5ee0-6646-16d2-dc69012b4288","pairingTypes":["PIN","PROMPT"]}}
2016-01-14 22:49:41.067 DEBUG android.util.Log[:23]- Connect SDK - webOS Socket [OUT] : {"id":2,"payload":{"pairingType":"PROMPT","manifest":{"permissions":["LAUNCH","LAUNCH_WEBAPP","APP_TO_APP","CONTROL_AUDIO","CONTROL_INPUT_MEDIA_PLAYBACK","CONTROL_POWER","READ_INSTALLED_APPS","CONTROL_DISPLAY","CONTROL_INPUT_JOYSTICK","CONTROL_INPUT_MEDIA_RECORDING","CONTROL_INPUT_TV","READ_INPUT_DEVICE_LIST","READ_NETWORK_STATE","READ_TV_CHANNEL_LIST","WRITE_NOTIFICATION_TOAST","CONTROL_INPUT_TEXT","CONTROL_MOUSE_AND_KEYBOARD","READ_CURRENT_CHANNEL","READ_RUNNING_APPS"],"manifestVersion":1}},"type":"register"}
2016-01-14 22:49:41.201 DEBUG android.util.Log[:23]- Connect SDK - webOS Socket [IN] : {"type":"response","id":2,"payload":{"pairingType":"PROMPT","returnValue":true}}
2016-01-14 22:49:41.211 INFO  o.o.b.c.i.ConnectSDKBinding[:165]- Pairing required.
2016-01-14 22:49:49.913 DEBUG android.util.Log[:23]- Connect SDK - webOS Socket [IN] : {"type":"registered","id":2,"payload":{"client-key":"0d5ffcab2a79a4ad0589c2a4398d18e9"}}
2016-01-14 22:51:25.146 DEBUG o.o.b.c.i.ConnectSDKBinding[:112]- internalReceiveCommand(LG_TV0_Toast,Test) is called!
2016-01-14 22:51:28.568 DEBUG o.o.b.c.i.ConnectSDKBinding[:112]- internalReceiveCommand(LG_TV0_Toast,Test) is called!
2016-01-14 22:51:48.370 DEBUG o.o.b.c.i.ConnectSDKBinding[:112]- internalReceiveCommand(LG_TV0_VolumeUp,ON) is called!
2016-01-14 22:51:48.377 DEBUG android.util.Log[:23]- Connect SDK - webOS Socket [OUT] : {"id":"3","type":"request","uri":"ssap://audio/volumeUp"}
2016-01-14 22:51:50.079 DEBUG o.o.b.c.i.ConnectSDKBinding[:112]- internalReceiveCommand(LG_TV0_VolumeDown,ON) is called!
2016-01-14 22:51:50.082 DEBUG android.util.Log[:23]- Connect SDK - webOS Socket [OUT] : {"id":"4","type":"request","uri":"ssap://audio/volumeDown"}

For Volume-Control you can see socket activity, for toast not


Good idea to enable the “android” logging.
I will review of the process off how the stored devices are written to disk. Maybe the issue lies here.

Hi. No spontaneous idea. But maybe it is similar to the issue Simon is observing. Do you have a connect_sdk folder under openhab/etc?

Hi,
I added few more log statements, so that we can trace the way devices are stored.

The error is somehow related to the pairing process. The device never gets into the “ready” state. So the capabilities are never get upgraded (Connect SDK thinks that your device dues not support Toast messages), and thus no message is sent. For these basic functions, like volume up or down no pairing is required. See: http://connectsdk.com/SupportedFeatures/

Please use the new version here:


Changelog:
-redirected the android.util.Log to org.openhab.binding.connectsdk.Log
-added a log statement to show the folder in which the StoredDevices file will be created.

Look out for sth like this:
10:51:43.388 [DEBUG] [o.o.b.c.internal.ContextImpl :69 ] - Folder path for connect sdk devices: /Users/sprehn/openhab-runtime/etc/connect_sdk
and any stack traces or messages after it.

Another observation, according to logs:
My WebOS version is: 4.1.0
@maihacke: yours is 4.0.3

Kind Regards
Sebastian

Here is the new log

2016-01-16 10:04:38.905 DEBUG o.o.b.c.i.ConnectSDKBinding[:73]- activated
2016-01-16 10:04:50.765 DEBUG o.o.b.c.i.ConnectSDKBinding[:112]- internalReceiveCommand(LG_TV0_Toast,Test) is called!
2016-01-16 10:04:50.782 WARN  o.o.b.c.i.ConnectSDKBinding[:125]- LGSmartTV.fritz.box not found under connect sdk devices. Skipping item LG_TV0_Toast
2016-01-16 11:19:36.288 DEBUG o.o.b.c.i.ConnectSDKBinding[:100]- deactivate 6
2016-01-16 11:19:36.684 DEBUG o.o.b.c.i.ConnectSDKBinding[:73]- activated
2016-01-16 11:19:37.146 WARN  o.o.m.i.i.GenericItemProvider[:108]- Attempted to register a second BindingConfigReader of type 'connectsdk'. The primaraly reader will remain active!
2016-01-16 11:19:37.256 DEBUG o.o.b.c.i.ConnectSDKBinding[:73]- activated
2016-01-16 11:19:37.305 DEBUG o.o.b.c.internal.ContextImpl[:69]- Folder path for connect sdk devices: /opt/openhab-1.7.0/etc/connect_sdk
2016-01-16 11:19:57.427 DEBUG o.o.b.c.i.ConnectSDKBinding[:100]- deactivate 6
2016-01-16 11:21:29.806 INFO  o.o.i.t.m.i.MqttBrokerConnection[:114]- Starting MQTT broker connection 'ohmosq'
2016-01-16 11:22:30.774 DEBUG o.o.b.c.i.ConnectSDKBinding[:73]- activated
2016-01-16 11:22:30.969 DEBUG o.o.b.c.internal.ContextImpl[:69]- Folder path for connect sdk devices: /opt/openhab-1.7.0/etc/connect_sdk
2016-01-16 11:22:31.493 DEBUG o.o.b.c.i.ConnectSDKBinding[:112]- internalReceiveCommand(LG_TV0_Toast,Test) is called!
2016-01-16 11:22:31.521 WARN  o.o.b.c.i.ConnectSDKBinding[:125]- LGSmartTV.fritz.box not found under connect sdk devices. Skipping item LG_TV0_Toast
2016-01-16 11:22:32.032 DEBUG o.o.b.c.i.ConnectSDKBinding[:112]- internalReceiveCommand(LG_TV0_Toast,Test) is called!
2016-01-16 11:22:32.035 WARN  o.o.b.c.i.ConnectSDKBinding[:125]- LGSmartTV.fritz.box not found under connect sdk devices. Skipping item LG_TV0_Toast
2016-01-16 11:24:16.904 DEBUG o.o.binding.connectsdk.Log[:23]- Connect SDK - Service added: [LG] webOS TV (webOS TV)
2016-01-16 11:24:16.911 DEBUG o.o.binding.connectsdk.Log[:23]- Connect SDK - Adding service webOS TV to device with address 192.168.178.28 and id 703d9797-d92e-40b5-9f09-205e0f9a3ff5
2016-01-16 11:24:16.974 INFO  o.o.b.c.i.ConnectSDKBinding[:158]- added: {"id":"703d9797-d92e-40b5-9f09-205e0f9a3ff5","services":{"46e7fa86-5ee0-6646-16d2-dc69012b4288":{"description":{"port":1738,"modelName":"LG Smart TV","serviceId":"webOS TV","friendlyName":"[LG] webOS TV","uuid":"46e7fa86-5ee0-6646-16d2-dc69012b4288","modelNumber":"65UC970V-ZA","filter":"urn:lge-com:service:webos-second-screen:1","version":"4.0.3","ipAddress":"192.168.178.28"},"config":{"UUID":"46e7fa86-5ee0-6646-16d2-dc69012b4288","class":"ServiceConfig","lastDetection":1452939856},"class":"WebOSTVService"}},"lastConnected":9223372036854775807,"modelName":"LG Smart TV","lastKnownIPAddress":"192.168.178.28","friendlyName":"[LG] webOS TV","lastDetection":1452939856,"modelNumber":"65UC970V-ZA"}
2016-01-16 11:24:17.289 DEBUG o.o.binding.connectsdk.Log[:23]- Connect SDK - Expecting device cert (any)
2016-01-16 11:24:18.359 DEBUG o.o.binding.connectsdk.Log[:23]- Connect SDK - webOS Socket [IN] : {"type":"hello","payload":{"protocolVersion":1,"deviceType":"tv","deviceOS":"webOS","deviceOSVersion":"4.0.3","deviceOSReleaseVersion":"1.4.0","deviceUUID":"46e7fa86-5ee0-6646-16d2-dc69012b4288","pairingTypes":["PIN","PROMPT"]}}
2016-01-16 11:24:18.381 DEBUG o.o.binding.connectsdk.Log[:23]- Connect SDK - webOS Socket [OUT] : {"id":2,"payload":{"pairingType":"PROMPT","manifest":{"permissions":["LAUNCH","LAUNCH_WEBAPP","APP_TO_APP","CONTROL_AUDIO","CONTROL_INPUT_MEDIA_PLAYBACK","CONTROL_POWER","READ_INSTALLED_APPS","CONTROL_DISPLAY","CONTROL_INPUT_JOYSTICK","CONTROL_INPUT_MEDIA_RECORDING","CONTROL_INPUT_TV","READ_INPUT_DEVICE_LIST","READ_NETWORK_STATE","READ_TV_CHANNEL_LIST","WRITE_NOTIFICATION_TOAST","CONTROL_INPUT_TEXT","CONTROL_MOUSE_AND_KEYBOARD","READ_CURRENT_CHANNEL","READ_RUNNING_APPS"],"manifestVersion":1}},"type":"register"}
2016-01-16 11:24:18.921 DEBUG o.o.binding.connectsdk.Log[:23]- Connect SDK - webOS Socket [IN] : {"type":"response","id":2,"payload":{"pairingType":"PROMPT","returnValue":true}}
2016-01-16 11:24:18.930 INFO  o.o.b.c.i.ConnectSDKBinding[:165]- Pairing required.
2016-01-16 11:24:23.990 DEBUG o.o.binding.connectsdk.Log[:23]- Connect SDK - webOS Socket [IN] : {"type":"registered","id":2,"payload":{"client-key":"d694c1a16a3c4ed52af15f8810037209"}}

how does the log go on? I walked through the connect sdk code. After receiving the “registered” message it normally should try to store the device in the StoredDevices file or through an exception.

The path looks good.

In DefaultConnectableDeviceStore

`private synchronized void writeStoreToDisk(final JSONObject deviceStore) {
final long lastUpdate = updated;
waitToWrite = true;

    Util.runInBackground(new Runnable() {

        @Override
        public void run() {
            FileWriter out;
            try {
                File output = new File(fileFullPath);

                if (!output.exists())
                    output.getParentFile().mkdirs();

                out = new FileWriter(output);
                out.write(deviceStore.toString());
                out.close();
            } catch (IOException e) {
                e.printStackTrace();
            } finally {
                waitToWrite = false;
            }

            if (lastUpdate < updated)
                writeStoreToDisk(deviceStore);
        }
    });
}`

Hmmm looks good to me. What next? Sadly I could not manage to do remote debugging on my cubie, since rmi is somewhat broken. maybe it is because of the arm platform.

Hi! Finally I’m back.
My story is similar to @Glenn_Bignell’s one.
I’m turning the TV on, starting to click on control buttons from openhab, after 20-25 seconds the binding finds the TV and TV responces - control is available. This miracle lasts for two minutes, then the binding losts the TV. All these manipulations are illustrated in the log below:

1. Switched ON the TV
2. Started to click on vol+, vol- and mute control buttons from Openhab
2016-01-16 22:01:56.922 [DEBUG] [b.c.internal.ConnectSDKBinding] - internalReceiveCommand(LG1_vol_mute,ON) is called!
2016-01-16 22:01:56.923 [WARN ] [b.c.internal.ConnectSDKBinding] - 192.168.0.30 not found under connect sdk devices. Skipping item LG1_vol_mute
2016-01-16 22:01:57.171 [DEBUG] [b.c.internal.ConnectSDKBinding] - internalReceiveCommand(LG1_vol_mute,OFF) is called!
2016-01-16 22:01:57.172 [WARN ] [b.c.internal.ConnectSDKBinding] - 192.168.0.30 not found under connect sdk devices. Skipping item LG1_vol_mute
2016-01-16 22:01:57.403 [DEBUG] [b.c.internal.ConnectSDKBinding] - internalReceiveCommand(LG1_vol_down,ON) is called!
2016-01-16 22:01:57.404 [WARN ] [b.c.internal.ConnectSDKBinding] - 192.168.0.30 not found under connect sdk devices. Skipping item LG1_vol_down


3. Till finally (usually it takes about 20-25 seconds) TV is found by the binding
2016-01-16 22:01:59.509 [INFO ] [b.c.internal.ConnectSDKBinding] - added: {“modelName”:“LG Smart TV”,“lastConnected”:9223372036854775807,“lastKnownIPAddress”:“192.168.0.30”,“modelNumber”:“42LB671V-ZF”,“id”:“3d25509d-e11f-4a33-81ca-6c720e01e6e2”,“services”:{“1eef01bd-461b-8656-0cc3-4c0f1da57322”:{“description”:{“filter”:“urn:lge-com:service:webos-second-screen:1”,“modelName”:“LG Smart TV”,“port”:1487,“ipAddress”:“192.168.0.30”,“modelNumber”:“42LB671V-ZF”,“serviceId”:“webOS TV”,“uuid”:“1eef01bd-461b-8656-0cc3-4c0f1da57322”,“version”:“4.0.3”,“friendlyName”:"[LG] webOS TV"},“class”:“WebOSTVService”,“config”:{“clientKey”:“f35afd81656a170b2adefca958676fe3”,“lastDetection”:9223372036854775807,“UUID”:“1eef01bd-461b-8656-0cc3-4c0f1da57322”,“class”:“WebOSTVServiceConfig”}}},“lastDetection”:1452970919,“friendlyName”:"[LG] webOS TV"}
2016-01-16 22:02:00.547 [DEBUG] [b.c.internal.ConnectSDKBinding] - internalReceiveCommand(LG1_vol_down,ON) is called!
2016-01-16 22:02:00.689 [DEBUG] [b.c.internal.ConnectSDKBinding] - internalReceiveCommand(LG1_vol_down,ON) is called!
2016-01-16 22:02:00.841 [DEBUG] [b.c.internal.ConnectSDKBinding] - internalReceiveCommand(LG1_vol_down,ON) is called!
2016-01-16 22:02:01.178 [DEBUG] [b.c.internal.ConnectSDKBinding] - internalReceiveCommand(LG1_vol_up,ON) is called!
2016-01-16 22:02:01.182 [WARN ] [android.util.Log ] - Connect SDK - already connecting; not trying to connect again: REGISTERING
2016-01-16 22:02:01.386 [DEBUG] [b.c.internal.ConnectSDKBinding] - internalReceiveCommand(LG1_vol_up,ON) is called!
2016-01-16 22:02:01.388 [WARN ] [android.util.Log ] - Connect SDK - already connecting; not trying to connect again: REGISTERING
2016-01-16 22:02:01.554 [DEBUG] [b.c.internal.ConnectSDKBinding] - internalReceiveCommand(LG1_vol_up,ON) is called!
2016-01-16 22:02:01.556 [WARN ] [android.util.Log ] - Connect SDK - already connecting; not trying to connect again: REGISTERING
2016-01-16 22:02:01.889 [DEBUG] [b.c.internal.ConnectSDKBinding] - internalReceiveCommand(LG1_vol_down,ON) is called!
2016-01-16 22:02:01.891 [WARN ] [android.util.Log ] - Connect SDK - already connecting; not trying to connect again: REGISTERING
2016-01-16 22:02:02.050 [DEBUG] [b.c.internal.ConnectSDKBinding] - internalReceiveCommand(LG1_vol_down,ON) is called!
2016-01-16 22:02:02.051 [WARN ] [android.util.Log ] - Connect SDK - already connecting; not trying to connect again: REGISTERING
2016-01-16 22:02:02.202 [DEBUG] [b.c.internal.ConnectSDKBinding] - internalReceiveCommand(LG1_vol_down,ON) is called!
4. Then control from openhab is available
2016-01-16 22:02:06.649 [DEBUG] [b.c.internal.ConnectSDKBinding] - internalReceiveCommand(LG1_vol_down,ON) is called!
2016-01-16 22:02:06.662 [DEBUG] [penhabConnectSDKPropertyBridge] - Successfully set VolumeControl:down: {“returnValue”:true}.
2016-01-16 22:02:06.792 [DEBUG] [penhabConnectSDKPropertyBridge] - Successfully set VolumeControl:down: {“returnValue”:true}.
2016-01-16 22:02:06.802 [DEBUG] [penhabConnectSDKPropertyBridge] - Successfully set VolumeControl:down: {“returnValue”:true}.
2016-01-16 22:02:06.828 [DEBUG] [penhabConnectSDKPropertyBridge] - Successfully set VolumeControl:down: {“returnValue”:true}.
2016-01-16 22:02:06.833 [DEBUG] [penhabConnectSDKPropertyBridge] - Successfully set VolumeControl:down: {“returnValue”:true}.
2016-01-16 22:02:06.837 [DEBUG] [penhabConnectSDKPropertyBridge] - Successfully set VolumeControl:down: {“returnValue”:true}.
2016-01-16 22:02:06.849 [DEBUG] [penhabConnectSDKPropertyBridge] - Successfully set VolumeControl:down: {“returnValue”:true}.
2016-01-16 22:02:06.962 [DEBUG] [b.c.internal.ConnectSDKBinding] - internalReceiveCommand(LG1_vol_down,ON) is called!
2016-01-16 22:02:07.058 [DEBUG] [penhabConnectSDKPropertyBridge] - Successfully set VolumeControl:down: {“returnValue”:true}.
2016-01-16 22:02:07.138 [DEBUG] [b.c.internal.ConnectSDKBinding] - internalReceiveCommand(LG1_vol_down,ON) is called!
2016-01-16 22:02:07.181 [DEBUG] [penhabConnectSDKPropertyBridge] - Successfully set VolumeControl:down: {“returnValue”:true}.
2016-01-16 22:02:07.297 [DEBUG] [b.c.internal.ConnectSDKBinding] - internalReceiveCommand(LG1_vol_down,ON) is called!
2016-01-16 22:02:07.358 [DEBUG] [penhabConnectSDKPropertyBridge] - Successfully set VolumeControl:down: {“returnValue”:true}.
2016-01-16 22:02:07.498 [DEBUG] [b.c.internal.ConnectSDKBinding] - internalReceiveCommand(LG1_vol_down,ON) is called!
2016-01-16 22:02:07.548 [DEBUG] [penhabConnectSDKPropertyBridge] - Successfully set VolumeControl:down: {“returnValue”:true}.
2016-01-16 22:02:07.835 [DEBUG] [penhabConnectSDKPropertyBridge] - Successfully set VolumeControl:mute: {“returnValue”:true}.
2016-01-16 22:02:07.932 [DEBUG] [penhabConnectSDKPropertyBridge] - Successfully set VolumeControl:mute: {“returnValue”:true}.
2016-01-16 22:02:07.934 [DEBUG] [penhabConnectSDKPropertyBridge] - Successfully set VolumeControl:mute: {“returnValue”:true}.
2016-01-16 22:02:07.937 [DEBUG] [penhabConnectSDKPropertyBridge] - Successfully set VolumeControl:mute: {“returnValue”:true}.
2016-01-16 22:02:07.943 [DEBUG] [penhabConnectSDKPropertyBridge] - Successfully set VolumeControl:mute: {“returnValue”:true}.
2016-01-16 22:02:07.947 [DEBUG] [penhabConnectSDKPropertyBridge] - Successfully set VolumeControl:mute: {“returnValue”:true}.
5. After two minutes of happiness I lost control over TV
2016-01-16 22:03:06.618 [INFO ] [b.c.internal.ConnectSDKBinding] - Device removed: {“modelName”:“LG Smart TV”,“lastConnected”:1452970922,“lastKnownIPAddress”:“192.168.0.30”,“modelNumber”:“42LB671V-ZF”,“id”:“3d25509d-e11f-4a33-81ca-6c720e01e6e2”,“services”:{},“lastDetection”:1452970919,“friendlyName”:"[LG] webOS TV"}
2016-01-16 22:03:06.618 [DEBUG] [b.c.internal.ConnectSDKBinding] - Capabilities updated: {“modelName”:“LG Smart TV”,“lastConnected”:1452970922,“lastKnownIPAddress”:“192.168.0.30”,“modelNumber”:“42LB671V-ZF”,“id”:“3d25509d-e11f-4a33-81ca-6c720e01e6e2”,“services”:{},“lastDetection”:1452970919,“friendlyName”:"[LG] webOS TV"} - 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]
2016-01-16 22:03:06.622 [DEBUG] [penhabConnectSDKPropertyBridge] - Unsubscribed VolumeControl:mute listener on IP: 192.168.0.30
2016-01-16 22:03:06.647 [DEBUG] [.c.i.bridges.VolumeControlMute] - error: 0 null connection lost
2016-01-16 22:03:06.663 [DEBUG] [b.c.internal.ConnectSDKBinding] - Device disconnected: {“modelName”:“LG Smart TV”,“lastConnected”:1452970922,“lastKnownIPAddress”:“192.168.0.30”,“modelNumber”:“42LB671V-ZF”,“id”:“3d25509d-e11f-4a33-81ca-6c720e01e6e2”,“services”:{},“lastDetection”:1452970919,“friendlyName”:"[LG] webOS TV"}

PS
Updated the binding - testing scenario and the problem stay the same. New log is uploaded to googledrive

This is so weird. This is somewhere deep down in connect sdk I believe.
The only commonality I see so far, is the older WebOS version. @strelok1986: you also seem to run WebOS 4.0.3. Since you have two TVs, could you maybe upgrade one to 4.1.0 and test if the problems remain?

And do you have the StoredDevices file under openhab/etc/connect_sdk?

Yes, I have [o.o.b.c.internal.ContextImpl ] - Folder path for connect sdk devices: /usr/share/openhab/etc/connect_sdk with StoredDevices:

{“devices”:[{“modelName”:“LG Smart TV”,“lastConnected”:9223372036854775807,“lastKnownIPAddress”:“192.168.0.30”,“modelNumber”:“42LB671V-ZF”,“id”:“3d25509d-e11f-4a33-81ca-6c720e01e6e2”,“services”:{“1eef01bd-461b-8656-0cc3-4c0f1da57322”:{“description”:{“filter”:“urn:lge-com:service:webos-second-screen:1”,“modelName”:“LG Smart TV”,“port”:1444,“ipAddress”:“192.168.0.30”,“modelNumber”:“42LB671V-ZF”,“serviceId”:“webOS TV”,“uuid”:“1eef01bd-461b-8656-0cc3-4c0f1da57322”,“version”:“4.0.3”,“friendlyName”:"[LG] webOS TV"},“class”:“WebOSTVService”,“config”:{“clientKey”:“f35afd81656a170b2adefca958676fe3”,“serverCertificate”:"
",“class”:“WebOSTVServiceConfig”}}},“lastDetection”:1452974196,“friendlyName”:"[LG] webOS TV"},{“modelName”:“LG Smart TV”,“lastConnected”:9223372036854775807,“lastKnownIPAddress”:“192.168.0.31”,“modelNumber”:“32LF653V-ZC”,“id”:“0250b270-3d3f-4a7d-9efc-e4fcff99ea5e”,“services”:{“5898a6ba-7ee1-80c4-4cbc-68b25015d29d”:{“description”:{“filter”:“urn:lge-com:service:webos-second-screen:1”,“modelName”:“LG Smart TV”,“port”:1458,“ipAddress”:“192.168.0.31”,“modelNumber”:“32LF653V-ZC”,“serviceId”:“webOS TV”,“uuid”:“5898a6ba-7ee1-80c4-4cbc-68b25015d29d”,“version”:“4.1.0”,“friendlyName”:"[LG] webOS TV LF653V"},“class”:“WebOSTVService”,“config”:{“clientKey”:“6586493eea26f60ecebfd6b2be0efc9f”,“serverCertificate”:"
",“lastDetection”:9223372036854775807,“UUID”:“5898a6ba-7ee1-80c4-4cbc-68b25015d29d”,“class”:“WebOSTVServiceConfig”}}},“lastDetection”:1453017302,“friendlyName”:"[LG] webOS TV LF653V"}],“created”:1452017882,“version”:0,“updated”:1453017302}

And I checked firmware version - it’s the freshest on both TVs, no updates are available.


I wonder what could trigger the device to be removed. According to your reports is seems to be some sort of timeout. Maybe something buggy in the websocket communication: bug in java-websocket lib, energy saving setting on TV?, something todo with the underlying OS 

I checked where onDeviceRemoved, which produces the log statement “Device removed:”, gets called


handleDeviceUpdate and setCapabilityFilters:
I never set the capabilityFilters. so this should actually never call handleDeviceLoss

onReceive
This should at least produce a log entry: “Network connection is disconnected”

onServiceRemoved
This should produce a log entry: “onServiceRemoved: friendlyName: 
”

I don’t see those in the logs. Can you check please?

Do you have the ability to remote debug? Set a breakpoint in ConnectSDKBinding.onDeviceRemoved and check out the stack, who is calling this