Help ! Samsung TV Bindings with >2016 Samsung TV

Read the thread. Post 91

Hi,
get this error, if i search on the TV after apps:

2020-05-03 21:36:53.483 [WARN ] [tv.internal.protocol.WebSocketRemote] - WebSocketRemote: Error (java.lang.IllegalStateException: Expected BEGIN_OBJECT but was STRING at line 1 column 39 path $.data) in message: {"event":"ms.remote.imeStart","data":"input"}

com.google.gson.JsonSyntaxException: java.lang.IllegalStateException: Expected BEGIN_OBJECT but was STRING at line 1 column 39 path $.data

	at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$Adapter.read(ReflectiveTypeAdapterFactory.java:224) ~[bundleFile:?]

	at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$1.read(ReflectiveTypeAdapterFactory.java:129) ~[bundleFile:?]

	at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$Adapter.read(ReflectiveTypeAdapterFactory.java:220) ~[bundleFile:?]

	at com.google.gson.Gson.fromJson(Gson.java:888) ~[bundleFile:?]

	at com.google.gson.Gson.fromJson(Gson.java:853) ~[bundleFile:?]

	at com.google.gson.Gson.fromJson(Gson.java:802) ~[bundleFile:?]

	at com.google.gson.Gson.fromJson(Gson.java:774) ~[bundleFile:?]

	at org.openhab.binding.samsungtv.internal.protocol.WebSocketRemote.onWebSocketText(WebSocketRemote.java:94) [bundleFile:?]

	at org.eclipse.jetty.websocket.common.events.JettyListenerEventDriver.onTextMessage(JettyListenerEventDriver.java:231) [bundleFile:9.4.20.v20190813]

	at org.eclipse.jetty.websocket.common.message.SimpleTextMessage.messageComplete(SimpleTextMessage.java:69) [bundleFile:9.4.20.v20190813]

	at org.eclipse.jetty.websocket.common.events.AbstractEventDriver.appendMessage(AbstractEventDriver.java:65) [bundleFile:9.4.20.v20190813]

	at org.eclipse.jetty.websocket.common.events.JettyListenerEventDriver.onTextFrame(JettyListenerEventDriver.java:179) [bundleFile:9.4.20.v20190813]

	at org.eclipse.jetty.websocket.common.events.AbstractEventDriver.incomingFrame(AbstractEventDriver.java:150) [bundleFile:9.4.20.v20190813]

	at org.eclipse.jetty.websocket.common.WebSocketSession.incomingFrame(WebSocketSession.java:321) [bundleFile:9.4.20.v20190813]

	at org.eclipse.jetty.websocket.common.extensions.ExtensionStack.incomingFrame(ExtensionStack.java:202) [bundleFile:9.4.20.v20190813]

	at org.eclipse.jetty.websocket.common.Parser.notifyFrame(Parser.java:226) [bundleFile:9.4.20.v20190813]

	at org.eclipse.jetty.websocket.common.Parser.parseSingleFrame(Parser.java:262) [bundleFile:9.4.20.v20190813]

	at org.eclipse.jetty.websocket.common.io.AbstractWebSocketConnection.readParse(AbstractWebSocketConnection.java:582) [bundleFile:9.4.20.v20190813]

	at org.eclipse.jetty.websocket.common.io.AbstractWebSocketConnection.onFillable(AbstractWebSocketConnection.java:441) [bundleFile:9.4.20.v20190813]

	at org.eclipse.jetty.websocket.common.io.AbstractWebSocketConnection.onFillable(AbstractWebSocketConnection.java:428) [bundleFile:9.4.20.v20190813]

	at org.eclipse.jetty.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:311) [bundleFile:9.4.20.v20190813]

	at org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:103) [bundleFile:9.4.20.v20190813]

	at org.eclipse.jetty.io.ChannelEndPoint$2.run(ChannelEndPoint.java:117) [bundleFile:9.4.20.v20190813]

	at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.runTask(EatWhatYouKill.java:336) [bundleFile:9.4.20.v20190813]

	at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.doProduce(EatWhatYouKill.java:313) [bundleFile:9.4.20.v20190813]

	at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.tryProduce(EatWhatYouKill.java:171) [bundleFile:9.4.20.v20190813]

	at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.run(EatWhatYouKill.java:129) [bundleFile:9.4.20.v20190813]

	at org.eclipse.jetty.util.thread.ReservedThreadExecutor$ReservedThread.run(ReservedThreadExecutor.java:367) [bundleFile:9.4.20.v20190813]

	at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:782) [bundleFile:9.4.20.v20190813]

	at org.eclipse.jetty.util.thread.QueuedThreadPool$Runner.run(QueuedThreadPool.java:918) [bundleFile:9.4.20.v20190813]

	at java.lang.Thread.run(Thread.java:748) [?:1.8.0_232]

Caused by: java.lang.IllegalStateException: Expected BEGIN_OBJECT but was STRING at line 1 column 39 path $.data

	at com.google.gson.stream.JsonReader.beginObject(JsonReader.java:385) ~[bundleFile:?]

	at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$Adapter.read(ReflectiveTypeAdapterFactory.java:213) ~[bundleFile:?]

	... 30 more

WebSocket is connected but after this i get the warning:

[WARN ] [l.protocol.RemoteControllerWebSocket] - Cannot retrieve current app webSocketV2 is not connected

The only thing that works is the Power Switch.

Can someone help??
Greettings,
Markus

Hi Guys

I wanted to report that after restarting Openhab 2.5.4 running on Windows 10 I have to remove the Samsung TV binding restart again & re install it in order to keep it working.

For me I only use it to detect when the TV(s) is turned on & off to control other lights in the room which works perfectly except after I have restarted Openhab.

I had similiar issues with the updated SamsungTV binding from this GitHub version. I rolled back to 2.4 RC1.

Best, Jay

Hi @jwiseman,
I suffer this bug with my samsung TV (I really need to get it working because we heavy rely on rules I created to manage TV for kids),
Where do I find the 2.4 RC1 version of the binding? Does it work with openhab 2.5.4 ? What version of JuPnP is suggested?

Thank you very much

https://openhab.jfrog.io/openhab/webapp/#/home
Search using this --> * samsungtv-2.4.0.RC1 * <-- remove the spaces before/after the *'s

I’m running jupnp 2.5.2, I’m assuming the version your running will work fine.

Keep in mind, basic functionality is with 2.4 RC1 based on the model of your SamsungTV.

Best, Jay

1 Like

I’m running openHAB 2.5.5 stable, assuming that Binding is also on v2.5.5? So is there a difference/enhancement to use 2.4 RC1 ???

And apologies for stupid question, do I have to install kind of jupnp in addition to binding??

Rgds,
Joerg

Yes, lots of differences between the two version. The 2.4 is stable but doesn’t have all the functionality of the 2.5.x version. You would just uninstall Samsung 2.5.x and drop the 2.4.0 RC1 into the Addon’s directory.

No, you don’t need to change the jupnp versions.

Best, Jay

Hi Jay,
thanks for swift feedback. I don’t have anything specific installed and just imagine if my system would be run[quote=“jwiseman, post:118, topic:67053”]
and drop the 2.4.0 RC1
[/quote]

Before this I shall be able to find this on frog-repository :-/ but I’m not. Neither package nor quick search or any other brings this one up :-/ HAs it been moved, or do I make something wrong in my search?? I looked for samsungtv-2.4.0.RC1, just as descibed above

Solved, got it. Wasn’t clear to me that I had to include *'s :wink:

1 Like

:-/ Same behavior => online for few minutes, then going offline.

btw: this version of binding is from 2018 already??

rgds
int5749

1 Like

Did you solve this?
I have the exact same problem and it seems that it is the slash that causes problems.
Try the URL without any slashes “192.168.1.134:81”
It doesn’t solve the problem but it isolates it :slight_smile:
Any URL with slashes causes my TV to do a google search where the slash has an backslash before.
Example:
“192.168.2.134:81/ui3.htm” will generate the same OH-error log message as you got and the TV will open a browser for the address “192.168.2.134:81/ui3.htm”

The binding is also going offline, but thats another problem :slight_smile:

Hi,

I’ve the same problem. Did you manage to fix this?

Best Regards,
Fernando Gomes

EDIT: I saw this in debugging for a (non-secure) Websocket TV thing:

2020-10-25 21:26:33.452 [DEBUG] [rnal.service.RemoteControllerService] - getSupportedChannelNames: [keyCode, power, channel, url, sourceApp, artMode]

Switching to secure Websocket, I only got:

2020-10-25 21:13:07.871 [DEBUG] [rnal.service.RemoteControllerService] -
getSupportedChannelNames: [keyCode, power, channel]

Please someone to have a comprehensive setup working on a new Samsung TV to use encrypted websockets, please post your config (things, items). Thanks.

Hi, I have a similar problem. My 2019 Q90R works fine with the new binding. in the 2.4.0, it didn’t because of the secure websocket connection not being there (?). Downgrading is thus not an option.

I used to have a workaround with the old binding in that way that I wrote up a set of python scripts in which I set up a wss connection and sent the corresponding keycodes. This works, but there is a very noticeable delay between issuing the command and seeing the effect on the TV.
I’m on 2.5.1 for the moment and have the 2.5.x binding installed. With this binding the connection works and the token is remembered over the sessions. Sending keys is much much faster. The difference is that big that there is no going back to the script workaround for me.

However, I get communication errors whenever the TV was powered down for a while.
When I send the power_off command, the TV shuts down and the thing goes offline in the basicUI. If I wait long enough for the TV to shut down completely, my rules stop working when powering it back up. I can get it back up using a wake on lan package (which is how I always power it up) and the status of the thing goes to online. But as soon as I send a command the status changes to OFFLINE-COMMUNICATION_ERROR. It does not recover from this state. This is regardless of how long I wait between waking and sending a keycode. If I then switch off the TV using the samsung remote and power it back up using that remote, the thing goes off- and online and all my commands work again.
It seems like the problem is only there after a wake-on-lan. Is there any other way to wake the TV? Is there a way to force some sort of ‘refresh’ of the thing (not an item)? How should I get the tv to respond to my commands after a long sleep?
Thanks for any help on this!

EDIT: If I change something on the thing int he basicUI, it refreshes and goes back online, and my codes also work again then. So even after a wake-on-lan, if the thing reconnects to the TV, the codes work too.

My logs show this error when trying to send a key.

2020-12-15 20:26:58.232 [WARN ] [l.protocol.RemoteControllerWebSocket] - WebSocketClient failure: java.lang.RuntimeException: java.lang.InterruptedException
2020-12-15 20:26:58.235 [WARN ] [l.protocol.RemoteControllerWebSocket] - WebSocketClient failure: java.util.concurrent.RejectedExecutionException: org.eclipse.jetty.io.ManagedSelector$$Lambda$371/1145320357@56c34fa3
2020-12-15 20:26:58.236 [WARN ] [l.protocol.RemoteControllerWebSocket] - Cannot connect to websocket remote control interface: org.eclipse.jetty.io.ManagedSelector$$Lambda$371/1145320357@56c34fa3
java.util.concurrent.RejectedExecutionException: org.eclipse.jetty.io.ManagedSelector$$Lambda$371/1145320357@56c34fa3
	at org.eclipse.jetty.util.thread.QueuedThreadPool.execute(QueuedThreadPool.java:494) ~[bundleFile:9.4.20.v20190813]
	at org.eclipse.jetty.io.SelectorManager.execute(SelectorManager.java:163) ~[?:?]
	at org.eclipse.jetty.io.ManagedSelector.doStart(ManagedSelector.java:117) ~[?:?]
	at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:72) ~[bundleFile:9.4.20.v20190813]
	at org.eclipse.jetty.util.component.ContainerLifeCycle.start(ContainerLifeCycle.java:169) ~[bundleFile:9.4.20.v20190813]
	at org.eclipse.jetty.util.component.ContainerLifeCycle.doStart(ContainerLifeCycle.java:110) ~[bundleFile:9.4.20.v20190813]
	at org.eclipse.jetty.io.SelectorManager.doStart(SelectorManager.java:262) ~[?:?]
	at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:72) ~[bundleFile:9.4.20.v20190813]
	at org.eclipse.jetty.util.component.ContainerLifeCycle.start(ContainerLifeCycle.java:169) ~[bundleFile:9.4.20.v20190813]
	at org.eclipse.jetty.util.component.ContainerLifeCycle.doStart(ContainerLifeCycle.java:110) ~[bundleFile:9.4.20.v20190813]
	at org.eclipse.jetty.client.AbstractConnectorHttpClientTransport.doStart(AbstractConnectorHttpClientTransport.java:64) ~[?:?]
	at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:72) ~[bundleFile:9.4.20.v20190813]
	at org.eclipse.jetty.util.component.ContainerLifeCycle.start(ContainerLifeCycle.java:169) ~[bundleFile:9.4.20.v20190813]
	at org.eclipse.jetty.util.component.ContainerLifeCycle.doStart(ContainerLifeCycle.java:110) ~[bundleFile:9.4.20.v20190813]
	at org.eclipse.jetty.client.HttpClient.doStart(HttpClient.java:244) ~[?:?]
	at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:72) ~[bundleFile:9.4.20.v20190813]
	at org.eclipse.jetty.util.component.ContainerLifeCycle.start(ContainerLifeCycle.java:169) ~[bundleFile:9.4.20.v20190813]
	at org.eclipse.jetty.util.component.ContainerLifeCycle.doStart(ContainerLifeCycle.java:110) ~[bundleFile:9.4.20.v20190813]
	at org.eclipse.jetty.websocket.client.WebSocketClient.doStart(WebSocketClient.java:355) ~[?:?]
	at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:72) ~[bundleFile:9.4.20.v20190813]
	at org.openhab.binding.samsungtv.internal.protocol.RemoteControllerWebSocket.openConnection(RemoteControllerWebSocket.java:147) [bundleFile:?]
	at org.openhab.binding.samsungtv.internal.protocol.RemoteControllerWebSocket.sendKey(RemoteControllerWebSocket.java:261) [bundleFile:?]
	at org.openhab.binding.samsungtv.internal.protocol.RemoteControllerWebSocket.sendKey(RemoteControllerWebSocket.java:250) [bundleFile:?]
	at org.openhab.binding.samsungtv.internal.service.RemoteControllerService.sendKeyCode(RemoteControllerService.java:413) [bundleFile:?]
	at org.openhab.binding.samsungtv.internal.service.RemoteControllerService.handleCommand(RemoteControllerService.java:336) [bundleFile:?]
	at org.openhab.binding.samsungtv.internal.handler.SamsungTvHandler.handleCommand(SamsungTvHandler.java:122) [bundleFile:?]
	at sun.reflect.GeneratedMethodAccessor173.invoke(Unknown Source) ~[?:?]
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_221]
	at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_221]
	at org.eclipse.smarthome.core.internal.common.AbstractInvocationHandler.invokeDirect(AbstractInvocationHandler.java:152) [bundleFile:?]
	at org.eclipse.smarthome.core.internal.common.InvocationHandlerSync.invoke(InvocationHandlerSync.java:59) [bundleFile:?]
	at com.sun.proxy.$Proxy1394.handleCommand(Unknown Source) [?:?]
	at org.eclipse.smarthome.core.thing.internal.profiles.ProfileCallbackImpl.handleCommand(ProfileCallbackImpl.java:74) [bundleFile:?]
	at org.eclipse.smarthome.core.thing.internal.profiles.SystemDefaultProfile.onCommandFromItem(SystemDefaultProfile.java:48) [bundleFile:?]
	at sun.reflect.GeneratedMethodAccessor172.invoke(Unknown Source) ~[?:?]
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_221]
	at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_221]
	at org.eclipse.smarthome.core.internal.common.AbstractInvocationHandler.invokeDirect(AbstractInvocationHandler.java:152) [bundleFile:?]
	at org.eclipse.smarthome.core.internal.common.Invocation.call(Invocation.java:52) [bundleFile:?]
	at java.util.concurrent.FutureTask.run(FutureTask.java:266) [?:1.8.0_221]
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) [?:1.8.0_221]
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) [?:1.8.0_221]
	at java.lang.Thread.run(Thread.java:748) [?:1.8.0_221]

Let me add already to my question. It is a strange happening…
The error does not seem to return (for now), and the thing stays online in my basicUI page.
However, I could replicate the two situations where my commands do and do not work. My logs show the following:

This is what I see when the TV comes online and when my commands do not work. In this case, the thing is still online but not responding.

2020-12-15 21:01:21.892 [INFO ] [rnal.service.RemoteControllerService] - Using SecureWebSocket interface
2020-12-15 21:01:52.204 [WARN ] [l.protocol.RemoteControllerWebSocket] - WebSocketClient failure: java.lang.RuntimeException: java.lang.InterruptedException

Alternatively, when the TV comes online and my commands do work, I get these lines in the log:

2020-12-15 21:05:47.973 [INFO ] [rnal.service.RemoteControllerService] - Using SecureWebSocket interface
2020-12-15 21:05:48.400 [WARN ] [l.protocol.RemoteControllerWebSocket] - Cannot retrieve current app webSocketV2 is not connected

Strange how this last log says that the websocket is not connected while my keycodes are transferred correctly…

Have you figured out a way to send a WoL without it powering up? I’d like to retain connectivity without it always coming on and/or restore connection without powering it up.

That would provide a workaround for my problem too, if I could keep it alive.
But no, the WoL brings on the screen every time.

FYI to the binding owners. [SamsungTV] Several Thread Issues · Issue #9495 · openhab/openhab-addons · GitHub was opened earlier as a byproduct of looking into other thread issues. Kai found a few issues where this binding is causing issues with UPnP.

Does anybody know why the Samsung QLED 4K The Frame (GQ65LS03TAUXZG) does not support the ArtMode although it is probably the TV for presenting Art with an embedded art galery as a subscription?

[tv.internal.handler.SamsungTvHandler] - Channel 'samsungtv:tv:00071a0c_b05d_4905_a178_9766f9820c46:artMode' not supported

It does on my 65 inch 2020 The Frame.