Help ! Samsung TV Bindings with >2016 Samsung TV

@sintei ,

Thank you for the log. I have been hoping to find someone with a 2018/19 TV, as that’s one I can’t test locally. Specifically the way apps are handled.

Anyway, it still seems like the binding you downloaded is an earlier version. All I can think is that Dropbox didn’t update quickly enough.

Can you download the binding again (same link) - check the size, old binding was 100kb (ish), latest is 154kb.

There should be a lot more under the “token” entry in the Thing configuration, with a place to enter the PAT, and device ID (device ID should get filled in automatically).

Thanks for the help!

1 Like

@Nicholas_Waterton I tried the new version of your binding but I cannot find the ID of my TV in my logs.
When I put the token in the configuration and save I receive the follow messages (DEBUG enabled):

2021-12-10 19:36:50.297 [DEBUG] [tv.internal.handler.SamsungTvHandler] - 192.168.200.70: Initializing Samsung TV handler for uid 'samsungtv:tv:e8915dfb_26a1_4f26_9e82_aa3720a00611'
2021-12-10 19:36:50.307 [DEBUG] [tv.internal.handler.SamsungTvHandler] - 192.168.200.70: Updated artModeSupported: false and PowerState: true
2021-12-10 19:36:50.308 [DEBUG] [tv.internal.handler.SamsungTvHandler] - 192.168.200.70: Check and create missing services
2021-12-10 19:36:50.310 [DEBUG] [nternal.service.MediaRendererService] - 192.168.200.70: Creating a Samsung TV MediaRenderer service
2021-12-10 19:36:50.311 [DEBUG] [tv.internal.handler.SamsungTvHandler] - 192.168.200.70: Started service for: QE55Q64TAUXZT, MediaRenderer (e8915dfb-26a1-4f26-9e82-aa3720a00611)
2021-12-10 19:36:50.313 [DEBUG] [rnal.service.RemoteControllerService] - 192.168.200.70: Creating a Samsung TV RemoteController service: is UPNP:false
2021-12-10 19:36:50.322 [DEBUG] [l.protocol.RemoteControllerWebSocket] - 192.168.200.70: RemoteControllerWebSocket start Client
2021-12-10 19:36:50.339 [DEBUG] [ngtv.internal.protocol.WebSocketBase] - 192.168.200.70: WebSocketRemote connecting to: wss://192.168.200.70:8002/api/v2/channels/samsung.remote.control?name=b3BlbkhBQg==&token=******
2021-12-10 19:36:50.342 [DEBUG] [ngtv.internal.protocol.WebSocketBase] - 192.168.200.70: WebSocketArt connecting to: wss://192.168.200.70:8002/api/v2/channels/com.samsung.art-app?name=b3BlbkhBQg==
2021-12-10 19:36:50.347 [DEBUG] [ngtv.internal.protocol.WebSocketBase] - 192.168.200.70: WebSocketV2 connecting to: wss://192.168.200.70:8002/api/v2?name=b3BlbkhBQg==
2021-12-10 19:36:50.388 [DEBUG] [tv.internal.handler.SamsungTvHandler] - 192.168.200.70: Started service for: QE55Q64TAUXZT, RemoteControlReceiver ()
2021-12-10 19:36:50.389 [DEBUG] [ternal.service.SmartThingsApiService] - 192.168.200.70: Creating a Samsung TV Smartthings Api service
2021-12-10 19:36:50.391 [DEBUG] [tv.internal.handler.SamsungTvHandler] - 192.168.200.70: Started service for: QE55Q64TAUXZT, SmartthingsApi ()
2021-12-10 19:36:50.393 [DEBUG] [tv.internal.handler.SamsungTvHandler] - 192.168.200.70: TV is online
2021-12-10 19:36:50.395 [DEBUG] [tv.internal.handler.SamsungTvHandler] - 192.168.200.70: Start refresh task, interval=1000
2021-12-10 19:36:50.401 [DEBUG] [nternal.service.MediaRendererService] - 192.168.200.70: Received channel: volume, command: REFRESH
2021-12-10 19:36:50.415 [DEBUG] [tv.internal.handler.SamsungTvHandler] - 192.168.200.70: Received value 'volume':'0' for thing 'samsungtv:tv:e8915dfb_26a1_4f26_9e82_aa3720a00611'
2021-12-10 19:36:50.418 [DEBUG] [ternal.service.SmartThingsApiService] - 192.168.200.70: Received channel: sourceName, command: REFRESH
2021-12-10 19:36:50.420 [WARN ] [mmon.WrappedScheduledExecutorService] - Scheduled runnable ended with an exception: 
java.lang.NullPointerException: null
	at org.openhab.binding.samsungtv.internal.service.SmartThingsApiService.fetchdata(SmartThingsApiService.java:358) ~[?:?]
	at org.openhab.binding.samsungtv.internal.service.SmartThingsApiService.handleCommand(SmartThingsApiService.java:430) ~[?:?]
	at org.openhab.binding.samsungtv.internal.handler.SamsungTvHandler.lambda$6(SamsungTvHandler.java:497) ~[?:?]
	at java.util.stream.ForEachOps$ForEachOp$OfRef.accept(ForEachOps.java:183) ~[?:?]
	at java.util.stream.ReferencePipeline$2$1.accept(ReferencePipeline.java:177) ~[?:?]
	at java.util.Spliterators$ArraySpliterator.forEachRemaining(Spliterators.java:948) ~[?:?]
	at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:484) ~[?:?]
	at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:474) ~[?:?]
	at java.util.stream.ForEachOps$ForEachOp.evaluateSequential(ForEachOps.java:150) ~[?:?]
	at java.util.stream.ForEachOps$ForEachOp$OfRef.evaluateSequential(ForEachOps.java:173) ~[?:?]
	at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234) ~[?:?]
	at java.util.stream.ReferencePipeline.forEach(ReferencePipeline.java:497) ~[?:?]
	at org.openhab.binding.samsungtv.internal.handler.SamsungTvHandler.lambda$4(SamsungTvHandler.java:497) ~[?:?]
	at java.util.stream.ForEachOps$ForEachOp$OfRef.accept(ForEachOps.java:183) ~[?:?]
	at java.util.stream.ReferencePipeline$2$1.accept(ReferencePipeline.java:177) ~[?:?]
	at java.util.Spliterators$ArraySpliterator.forEachRemaining(Spliterators.java:948) ~[?:?]
	at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:484) ~[?:?]
	at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:474) ~[?:?]
	at java.util.stream.ForEachOps$ForEachOp.evaluateSequential(ForEachOps.java:150) ~[?:?]
	at java.util.stream.ForEachOps$ForEachOp$OfRef.evaluateSequential(ForEachOps.java:173) ~[?:?]
	at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234) ~[?:?]
	at java.util.stream.ReferencePipeline.forEach(ReferencePipeline.java:497) ~[?:?]
	at org.openhab.binding.samsungtv.internal.handler.SamsungTvHandler.poll(SamsungTvHandler.java:495) ~[?:?]
	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515) ~[?:?]
	at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:305) ~[?:?]
	at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:305) ~[?:?]
	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:829) [?:?]

I don’t know if this is correct or not…

@Rickytr ,

Thanks for the report - no it’s not right, it’s a bug. It’s caused by the device ID being null (not blank, ie “”) - missed adding the null check (that I specifically wrote).

Download the fixed version I just uploaded, see if that works. I don’t know how many TV’s you have added to Smarthings, but the binding should find the right TV automatically, and fill in the device ID. I’m not sure how well this works, as I only have one TV in Smartthings (and finding one is easy).

Give the fixed binding a try, and let me know what happens.

Just tested the “new binding” and now PAT was viewable. After inputing the PAT I can now see updates to HDMI changes which I could not before!
Tomorrow, I’ll try the rest, but this looks promising.
@Nicholas_Waterton please look in your inbox from me.

@Nicholas_Waterton tried the new version and now I don’t receive the error but still I cannot find the ID:


2021-12-11 08:44:55.182 [DEBUG] [ternal.service.SmartThingsApiService] - 192.168.200.71: Creating a Samsung TV Smartthings Api service
2021-12-11 08:44:55.184 [DEBUG] [tv.internal.handler.SamsungTvHandler] - 192.168.200.71: Started service for: UE32T5370AUXZT, SmartthingsApi ()
2021-12-11 08:44:55.186 [DEBUG] [tv.internal.handler.SamsungTvHandler] - 192.168.200.71: TV is online

I have two different TVs both from 2020.

Can you post your whole log? These three lines don’t tell me much. Set to TRACE if you can, that way I can see the requests being sent etc.

What is your polling set to? it takes a couple of polling cycles to get the device ID’s.

If the binding finds the device ID, it will fill it in automatically. If not, it will list the device ID’s it finds, but it only does this once, about 2 polling cycles after the service starts up, It then stops the service (as it needs the Device ID to continue).

I did find a potential bug in the situation where you have two TV’s in Smartthings, which I have fixed and re-uploaded. Try that and let me know (with a full log).

Thanks.

I tried the latest version and automatically found and wrote id in the thing. Great work!
Thanks a lot.

Great to know it worked.

Let me know how it goes.

@FranzS ,

I have added SmartThings cloud support to the samsungtv binding. Can you add your TV to the SmartThings app?

If so, you will get control over the TV input (SOURCE_NAME), and I could add control for CHANNEL, and possibly other things.

This could be a workaround for the encrypted websocket problem.

Let me know if you can add your TV to SmartThings.

I have UE65KS8002 and most thinks not working. It’s not supporting series - so understood. I have not tried @Nicholas_Waterton version, but found how I can use 3.1 original version:
Manually created thing on 8001 port and protocol=“WebSocket”
SSH/Telnet to the box where OH installed
run command: “curl -X POST http://<MY_TV_IP_ADDRESS>:8001/ws/apps/Netflix” and TV will ask to allow this device connect. Using /api/… requests do not bring that dialog and can’t whitelist OH instance.
Power ON/OFF working by default, but all other items from plugin - not (excluding key_kodes).
Then I tested commands with keycodes. Volume_UP /Down and so on works. And most commands that is required working too. I don’t try to test every command, I just checked minimum list for my self.
Then in the sitemap (using mapping TVRemoteControl item ) added crucial items.
Ugly, but can be used sometimes when remote is somewhere not found…

Hey

I’ve been running the new binding for about a month now… Most things are working well, however, I have noticed that the binding seems to loose the running application at times… I can get it to work again simply by going to the thing in MainUI and clicking save. This results in the following log message

2021-12-15 22:50:14.491 [INFO ] [tv.internal.SamsungTvAppWatchService] - 192.168.0.161: Starting Apps File monitoring service

and the item for the current application then updates and continues to update for a while (I’m not sure how long it continues to update though)

I’ve tried updating to the latest JAR but that hasn’t made any difference.

@Mark_Webster ,

Can you grab me a log of when it looses the current app. The binding retrieves this by polling every 10 seconds.

Clicking on save just restarts the binding connections.

I need to see why it stops updating - ie does the tv stop responding, or is there a hidden NPE somewhere. Maybe it’s something to do with turning the tv off.

How long does it take to stop responding? Is it a few hours, a day, a week?

I’ve had the binding running with no problems for several days, but it may depend on your specific set up or tv model.

Try to get me a log from just before it stops updating to just after, TRACE level if you can.

Thanks.

New bindiing is now published in the openHAB marketplace.

You can download it and install it from there.

See Samsung TV Enhanced Binding

2 Likes

Thanks for this! Was just about to update to the new version but somehow, installing it via the marketplace nor manual with the jar file works.
Is is required to uninstall the old binding or can they live besides each other (until testing is confirmed for new one)?

You have to uninstall the old binding.

You may have to manually install the UpNP transport as well.

1 Like

If you publish it as a .kar file, UPnP does not need to be installed separate….

Thanks, switched over to the enhanced binding and all works as is. Sadly the, hoped for, on/off (power) switch is still not working (as with the old binding).
But that might be an issue with my TV model I guess (UA40JU6000).

If it’s one of the encrypted TV’s (J and K models from around 2015), the remote control interface is encrypted, so the binding can’t send power off commands (and I don’t think they support WOL either).

The encyption protocol is known, it’s just a whole lot of effort to try to implement (along with the extra pin entry system), and I have no way of testing it, as I don’t have one of these TV’s.

Also TV’s are cheaper these days, so the number of 2015 TV’s still out in the wild are dropping rapidly. Of course I just retired my 2012 TV, and my wife thought it was still “fine”. The new TV has impressed her though, if only because it’s 1” thick, mounts flush to the wall, and displays art when it’s “off”.

Understood and no worries on it.
I can still control the on/off with IR and my broadlink.

I would like for my Samsung Frame TV to automatically turn on from code.

I have the art Mode working great (turns the TV to art mode via code).

I have the samsung app list in - /etc/openhab/misc/samsungtv.applist

My Netflix app ID is (I’m not sure how to verify the app IDs, so I copied it from the original post):

{ "name":"Netflix"                 , "appId":"3201907018807"    , "type":2 }

I have a testing rule for a Virtual switch to test my code:

rule "Testing"
when
	Item vTesting changed to ON

then
	logInfo("Testing", "Testing set to ON")
		MasterBathTV_SourceName.sendCommand("Netflix")

end

This is what I see in the logs:

2022-03-16 11:14:10.063 [INFO ] [rg.openhab.core.model.script.Testing] - Testing set to ON
2022-03-16 11:14:10.090 [WARN ] [tv.internal.handler.SamsungTvHandler] - Channel 'samsungtv:tv:f3e838eb_9eff_455c_9d3a_d63e9e4137af:sourceName' not supported
==> /var/log/openhab/events.log <==
2022-03-16 11:14:10.052 [INFO ] [openhab.event.ItemCommandEvent      ] - Item 'vTesting' received command ON
2022-03-16 11:14:10.056 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'vTesting' changed from OFF to ON
2022-03-16 11:14:10.067 [INFO ] [openhab.event.ItemCommandEvent      ] - Item 'MasterBathTV_SourceName' received command Netflix
2022-03-16 11:14:10.079 [INFO ] [penhab.event.ItemStatePredictedEvent] - Item 'MasterBathTV_SourceName' predicted to become Netflix

The TV does not switch from Art mode to Netflix.

I’m on the latest version of OH3.3M2

The binding has the host name IP, TCP Port set to 8002, mac address populated, and Protocol set to Secure websocket.

The TV is a 2021 43" Samsung Frame TV.