Help ! Samsung TV Bindings with >2016 Samsung TV

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.

On my 2019 Q90R, the artmode channel switch powers off my TV (when operated from the paperUI). Maybe it is a 2019 thing?
If I start the art mode with the TV remote, the ArtMode channel switch in openhab also does not switch on in my case.

Or is the artmode still something different and not present on a non-frame? I do have an ‘ambient mode’ with several (moving) wallpapers on my flagship 2019 q90r.

I just realised, my mistake, the rest didn’t work either. The wrong port was enough to display the volume, but only with the correct port was it possible to send commands. Thanks.

Hi, I did some more testing and I figured out that my problem of the TV not responding to commands was due to the fact that, after the wake on LAN, I started the apps through calling a python script, which was making a separate connection, probably confusing the TV. (I used this before the samsung binding was updated, there was no other way of controlling it before the binding enabled the secure websocket connection with tokens.)

I changed this to use the sourceApp channel in the binding and that worked good for a few days.
I do get an error now when starting an app like that: (it was probably there right away, but I was not monitoring the logs)

WebSocketRemote: Error (java.lang.IllegalStateException: Expected BEGIN_OBJECT but was NUMBER at line 1 column 12 path $.data) in message: {"data":200,"event":"ed.apps.launch","from":"host"} 
com.google.gson.JsonSyntaxException: java.lang.IllegalStateException: Expected BEGIN_OBJECT but was NUMBER at line 1 column 12 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.ssl.SslConnection$DecryptedEndPoint.onFillable(SslConnection.java:426) [bundleFile:9.4.20.v20190813]
	at org.eclipse.jetty.io.ssl.SslConnection.onFillable(SslConnection.java:320) [bundleFile:9.4.20.v20190813]
	at org.eclipse.jetty.io.ssl.SslConnection$2.succeeded(SslConnection.java:158) [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_221]
Caused by: java.lang.IllegalStateException: Expected BEGIN_OBJECT but was NUMBER at line 1 column 12 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:?]
	... 34 more

The app does start, but there is a delay.
I searched the forum and found this post with exactly the same problem, but it was closed off without a solution: https://community.openhab.org/t/samsung-smart-tv-error/99895
Does anyone have any idea on how to get rid of this error? (It would result in a more responsive setup in my case (no delay of 4sec for starting an app).)

I have a 2019 TV (UE50MU6120) on a wired network. I can power on via WoL, power off via the samsungtv binding and control volume. Yay.

But I’d really like to be able to see the playing source.

Samsung’s preferred Android mobile app for controlling/monitoring the TV now seems to be SmartThings. This does show the playing source app or (for live TV) channels.

@arjanmels Any idea how it’s doing this? Is this something that could be included into the binding?

I have a 43" Samsung Frame and a 50" Samsung Frame in use with the binding, with mixed results.

OH3.0.0 docker, on a Ubuntu host. TVs are connected by Ethernet cables, not WiFi (my AT&T router didn’t seem to like the TV WiFi for whatever reason…).

Both are properly detected, and the secure token is added. The token doesn’t persist across reboots (/restarts of the docker container I use for openHAB), but this isn’t a show stopper - I don’t mind selecting ‘Allow’ the next time the TV turns on.

Volume and mute seem to work fine when the TV is on.

The main commands I would like to suss out are Power on / off and art mode. I get errors in the openHAB logs occasionally, and after this I need to disable and re-enable the thing to get it back to ‘normal’.

Example of an error when going from OFF to Art Mode:

2021-01-30 15:27:35.905 [INFO ] [rnal.service.RemoteControllerService] - Using SecureWebSocket interface
2021-01-30 15:27:35.951 [INFO ] [tv.internal.handler.SamsungTvHandler] - Service found after 2 attempts: resend command ON to channel artMode
2021-01-30 15:27:35.952 [WARN ] [ngtv.internal.protocol.WebSocketBase] - WebSocketRemote sending command while socket not connected: {"method":"ms.remote.control","params":{"Cmd":"Click","DataOfCmd":"KEY_POWER","Option":"false","TypeOfRemote":"SendRemoteKey"}}
2021-01-30 15:27:35.953 [WARN ] [mmon.WrappedScheduledExecutorService] - Scheduled runnable ended with an exception: 
java.lang.NullPointerException: null
	at org.openhab.binding.samsungtv.internal.protocol.WebSocketBase.sendCommand(WebSocketBase.java:119) ~[?:?]
	at org.openhab.binding.samsungtv.internal.protocol.WebSocketRemote.sendKeyData(WebSocketRemote.java:224) ~[?:?]
	at org.openhab.binding.samsungtv.internal.protocol.RemoteControllerWebSocket.sendKeyData(RemoteControllerWebSocket.java:331) ~[?:?]
	at org.openhab.binding.samsungtv.internal.protocol.RemoteControllerWebSocket.sendKey(RemoteControllerWebSocket.java:265) ~[?:?]
	at org.openhab.binding.samsungtv.internal.protocol.RemoteControllerWebSocket.sendKey(RemoteControllerWebSocket.java:250) ~[?:?]
	at org.openhab.binding.samsungtv.internal.service.RemoteControllerService.sendKeyCode(RemoteControllerService.java:413) ~[?:?]
	at org.openhab.binding.samsungtv.internal.service.RemoteControllerService.handleCommand(RemoteControllerService.java:311) ~[?:?]
	at org.openhab.binding.samsungtv.internal.handler.SamsungTvHandler$2.run(SamsungTvHandler.java:421) ~[?:?]
	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515) ~[?:?]
	at java.util.concurrent.FutureTask.run(FutureTask.java:264) ~[?:?]
	at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:304) ~[?:?]
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128) [?:?]
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628) [?:?]
	at java.lang.Thread.run(Thread.java:834) [?:?]

However, the TV will then allow me to turn Art Mode off.

When I try and turn it back on, however, I get the below:

2021-01-30 15:31:09.483 [INFO ] [tv.internal.handler.SamsungTvHandler] - Send WOL packet to 192.168.1.80 (bc:7e:8b:ed:53:a3)
2021-01-30 15:31:09.484 [WARN ] [tv.internal.handler.SamsungTvHandler] - Channel 'samsungtv:tv:a2aebcfe_e93e_4ad7_879f_be1a40578ace:artMode' not supported

And then the TV Thing goes offline. After this, it will sometimes work again by stopping and restarting the thing, sometimes I have to restart openHAB.

Also worth noting that I’m unable to use the curl -X POST commands mentioned above - I always get either a 401 or 404 error.

If anyone has experienced something similar, I would be grateful for any tips on how to further troubleshoot! Thank you in advance!

Hi,

I am not sure what these errors you posted mean, but I can tell you for sure WOL is not supported by Samsung TVs, even in the Smart Things app. So if you have your TV on Ethernet try switching to WiFi.

I am using with The Frame 43 for a while now and it works fine.

Good luck.

Hi Gustavo,

It’s strange you say that - I was experimenting with using WoL to wake the TV up from another program on the same device(to see where the issue might be arising), and WoL from the other program works fine… where did you see the reference that WoL isn’t supported?

Hi all,

is there any update on TV models supported by the Samsung tv binding? I have GQ55Q80 model.

Thanks a lot.
Matthias

I’m very interested in be able to know power status of a 2021 Samsung TV too. Is there any beta binding or any other way to just get that channel?

The standard samsungtv binding on port 8002 gives that functionality on my 2020 model QLED. Its one of the few things that work

Thanks @kevin, by knowing the issue was in my end and not in the binding helped me a lot. I uninstalled the binding, rebooted and installed it again and seems it is working now. I tried it before but didn’t work and it also vanished all the other bindings, so I had to reinstall them all (very weird), that’s why I thought this route wouldn’t solve the issue as it did

I don’t know why it stopped working and why it did not fix when I firstly reinstalled the binding, but I’m glad is is working now. I have a lot of automation associated to the TV turn off after evening (“Go to bed” sequence) and it was very annoying not having it after you get used to just turn off the TV and expect everything to happen magically