Samsung TV Binding (Beta)

Samsung TV Binding (Beta)

This is an updated version of the samsungtv binding. it has specific channels for Frame TV’s, but also has been completely re-written for enhanced stability and function. it supports all Samsung TV’s (not just Frame TV’s).

NOTE: Encryted TV’s from 2014/2015 (H and J versions) are NOT supported.

Key features:

  • Supports power/artMode/off function
  • Stores TV token after first connection
  • allows multiple KEY_CODES to be sent, with
    • delays
    • long key press
    • mouse moves and clicks
    • text entry
  • Supports app read and launching in >2020 TV’s.
  • Supports Smartthings connection:
    • read/change TV input
    • read channel number/name
  • Has specific channels for Frame TV’s artwork support.

See the Documentation for full details, configurations, source code etc.

You must uninstall the original samsungtv binding if you have it installed.
You may have to load UPnP transport as well if you use the .jar file. From the console:

feature:install openhab-transport-upnp

If you use the .kar file, it should take care of installing the UPnP transport for you, but the .kar file is untested.

Changelog

Version 01.0

initial release

Version 01.01

Attempt to trap polling job Exceptions, and included .kar file.

Version 01.02

Bug Fixes for 2017/2018 TV’s

Version 1.03

Pull Request release version.

Version 1.04

This Release adds over 340 known app ID’s, which should be automatically checked on >2020 TV’s. Some bug fixes, and polling is now delayed 10 seconds on TV power on, and disabled on TV power off.

Version 1.05

Added back two frame TV Channels that got accidentally left out.

Version 1.06

Fixed creation of services after WOL. Should make power ON more reliable.

Version 1.07

Added option to subscribe to UPNP events (reduces polling slightly). Some bug fixes.

Version 1.08

Increased websocket buffer sizes from 64k to 1Mb. Large thumbnail images should now download correctly. Thumbnails are now only downloaded if the ART_IMAGE channel is linked.

Version 1.09

Fixed <2019 Frame TV thumbnail downloads, changed websocket connect logic.

Version 1.10

Fixed SmartThings API Device ID discovery.

Version 1.11

Improved Websocket handling, and TV app launching on <2020 TV. Bug Fixes.

Version 1.12

Changes requested by PR reviewers. Location of the custom app file has been moved from misc/samsungtv.applist to services/samsungtv.cfg. Please move and rename this file if it previously existed. Bug Fixes.

Resources

org.openhab.binding.samsungtv-3.3.0-SNAPSHOT.jar
org.openhab.binding.samsungtv-3.3.0-SNAPSHOT.kar

6 Likes

@Nicholas_Waterton please note the marktplace contribution rules

To not irritate users, we do not want to have two bindings for the same devices. So please rename this topic and add a link to your pull request on github.

If you do not want to contribute your changes to the original binding, please remove the published tag.

I am not adverse to making a pull request, but there are extensive changes to the binding that need testing on users devices that I do not have access to.

Hence this is a beta release that has been tested on a limited number of devices.

If I remove the published tag, is it Ok to leave this, for testing purposes, before I am ready to make a pull request?

You can already make a Pull Request and mark it as [WIP], so you can add more commits during tests. Removing the published tag will make it invisible for others.
And please remove the „enhanced“ from the title.

Hi @Nicholas_Waterton,

I have tested your Beta on a SamSung UA75MU7000. The discovery and UPNP seems to work. Controls for OH are not working. Also had similar issues with the official version of the binding.

The TV does not prompt for accepting the connection to the device despite a message in the log file. Tried deleting all device entries on the TV device list and also deleting and rediscovering the Thing in OH. The channel/point values for volume and power get update Ok from the TV but controls for OH don’t work. Log File is attached.

samsung.log (52.6 KB)

Appreciate any advice.

Thanks, James

What is the output of http://192.168.1.45:8001/api/v2/ (you can enter this in a web browser)?

What year is your TV?

The reason most things don’t work is that the remote control channel is not getting authorized (on the TV).

Different TV’s have different ways of authorizing remote control. You may have to enable “Remote Control”, or “IP Remote” on the TV (my settings are in “Network”, “Expert Settings”), also “Power On with Mobile”. You may also have to enable “Access Notification” (I have mine set to “first time only”).

The TV should show a pop up window asking you to authorize OpenHAB as a control device. You have to accept this connection, and you only have 30 seconds to do it.

Without this authorization, most things will not work.

The output of http://192.168.1.45:8001/api/v2/ is:

{"device":{"FrameTVSupport":"false","GamePadSupport":"true","ImeSyncedSupport":"true","OS":"Tizen","TokenAuthSupport":"true","VoiceSupport":"true","countryCode":"AU","description":"Samsung DTV RCR","developerIP":"0.0.0.0","developerMode":"0","duid":"uuid:49e17d8b-c812-4bd8-9922-f2aa1c77017b","firmwareVersion":"Unknown","id":"uuid:49e17d8b-c812-4bd8-9922-f2aa1c77017b","ip":"192.168.1.45","model":"17_KANTM_UHD","modelName":"UA75MU7000","name":"[TV] Samsung 7 Series (75)","networkType":"none","resolution":"3840x2160","smartHubAgreement":"true","type":"Samsung SmartTV","udn":"uuid:49e17d8b-c812-4bd8-9922-f2aa1c77017b","wifiMac":"none"},"id":"uuid:49e17d8b-c812-4bd8-9922-f2aa1c77017b","isSupport":"{\"DMP_DRM_PLAYREADY\":\"false\",\"DMP_DRM_WIDEVINE\":\"false\",\"DMP_available\":\"true\",\"EDEN_available\":\"true\",\"FrameTVSupport\":\"false\",\"ImeSyncedSupport\":\"true\",\"TokenAuthSupport\":\"true\",\"remote_available\":\"true\",\"remote_fourDirections\":\"true\",\"remote_touchPad\":\"true\",\"remote_voiceControl\":\"true\"}\n","name":"[TV] Samsung 7 Series (75)","remote":"1.0","type":"Samsung SmartTV","uri":"http://192.168.1.45:8001/api/v2/","version":"2.0.25"}

Checked the settings. I don’t have have “Expert Settings” in the “Network”. Other settings look OK, “Access Notification” is “Always On”.

The TV is 2018 model.

Are you connected via WiFi or Ethernet cable? looks like it should work, if you can get it to authorize somehow.

The only odd thing is “networkType”: “none” and”wifiMAC”:”none”. Not seen that before.

I am connected via Ethernet cable.

Ok,

Which port/connection is selected? I’m thinking it should be “websocketsecure” and 8002, but this is around the time that samsung switched, so “websocket” 8001 might be right.

Try the other setting/port.

Yes - sorry to be the party poopers here, but taking an existing binding, making changes, and republishing it on the marketplace advertising it as “advanced” or the like is something we decided we don’t want to allow on this platform. If your intent is to allow beta testing your changes while they’re awaiting review on the original binding, then it’s fine but alternatives of official bindings are not allowed. Hope you understand our rationale.

I power cycled the TV (I have tried this may times before) and it prompted to allow the OpenHAB connection. It appears to be working now.

The port/connection is 8002 and Secure Websocket. Also now have a Websocket Token.

Thanks for your help.

That’s great!

Can you post me a full log, I would like to know if the apps are discovered correctly.

Thanks.

Hi @Nicholas_Waterton, please see the log file with the app discovery.

samsung_app_discovery.log (250.4 KB)
samsung_PowerOn.log (174.6 KB)

There appears to be an issue when Power ON uses WOL, the state of the Power channel does not change to ON, stays OFF. Please see the samsung.PowerOn.log file.

Hi @Nicholas_Waterton, also found that sometimes the RemoteController is not connected and KeyCode commands fail.

2021-12-29 09:26:35.870 [DEBUG] [tv.internal.handler.SamsungTvHandler] - 192.168.1.45: Received channel: samsungtv:tv:d0188465-aa3e-4a26-a111-72a41d7ba620:keyCode, command: KEY_CHDOWN
2021-12-29 09:26:35.870 [TRACE] [rnal.service.RemoteControllerService] - 192.168.1.45: getSupportedChannelNames: [keyCode, power, channel]
2021-12-29 09:26:35.870 [DEBUG] [rnal.service.RemoteControllerService] - 192.168.1.45: Received channel: keyCode, command: KEY_CHDOWN
2021-12-29 09:26:35.870 [WARN ] [rnal.service.RemoteControllerService] - 192.168.1.45: RemoteController is not connected
2021-12-29 09:26:35.871 [TRACE] [nternal.service.MediaRendererService] - 192.168.1.45: getSupportedChannelNames: [volume, mute, brightness, contrast, sharpness, colorTemperature]
2021-12-29 09:26:35.871 [WARN ] [tv.internal.handler.SamsungTvHandler] - 192.168.1.45: Channel 'samsungtv:tv:d0188465-aa3e-4a26-a111-72a41d7ba620:keyCode' not connected/supported

A few minutes later it works

2021-12-29 09:29:51.077 [DEBUG] [tv.internal.handler.SamsungTvHandler] - 192.168.1.45: Received value 'volume':'27' for thing 'samsungtv:tv:d0188465-aa3e-4a26-a111-72a41d7ba620'
2021-12-29 09:29:51.077 [DEBUG] [nternal.service.MediaRendererService] - 192.168.1.45: Received channel: mute, command: REFRESH
2021-12-29 09:29:51.088 [TRACE] [nternal.service.MediaRendererService] - 192.168.1.45: Value 'false' for CurrentMute hasn't changed, ignoring update
2021-12-29 09:29:52.089 [DEBUG] [nternal.service.MediaRendererService] - 192.168.1.45: Received channel: volume, command: REFRESH
2021-12-29 09:29:52.093 [TRACE] [nternal.service.MediaRendererService] - 192.168.1.45: Value '27' for CurrentVolume hasn't changed, ignoring update

samsung_remotecontroller.log (137.9 KB)

Thank you for the detailed logs. Looks like I have some bugs to fix.

The basic problem is that your TV seems to have both the UPNP remote controller and the websocket one.

The binding is flipping between the two (but the port is wrong for the UPNP controller).

I hadn’t considered that a TV might have both methods available at the same time.

I will update the binding tomorrow.

@JamesC ,
I have updated the binding, hopefully this will fix the problems you have been seeing. Please give it a go, and post your logs so I can see if it worked.

Your logs have been very useful! Thank you.

@Nicholas_Waterton,
Thanks for the updated version, it seems to be working fine. Please see the log file.
samsung.log (761.4 KB)

Good news.

Let me know if you have any other issues.