Samsung TV Binding (Beta)

You still don’t need multiple instances. You can call the rules “room 1 - something something “ “room 2 - something else.”
You can use Wemos which are usb powered and thus 5volts.
You are really overcomplicating things…

I am having trouble with this binding and am looking for guidance if anyone has a moment.

The original binding that is provided with openHAB 3.4 does display a prompt on connect, but this beta does not for me. My TV is a 4K UA50NU7090, 2018 model.

Additionally, both bindings show my TV as Offline even though it is running - its worth nothing that I do see the UPnP items appear in Network on my Windows 10 PCs when the TV is turned on. I have set the logging level to TRACE and when I save the binding and restart it, this is all I get when log:tailing it:

23:35:15.850 [DEBUG] [rnal.SamsungTvTlsTrustManagerProvider] - bundle org.openhab.binding.samsungtv:3.3.0.202204291417 (299)[org.openhab.binding.samsungtv.internal.SamsungTvTlsTrustManagerProvider(386)] : getService (single component manager) dependencies collected.
23:35:15.850 [DEBUG] [rnal.SamsungTvTlsTrustManagerProvider] - bundle org.openhab.binding.samsungtv:3.3.0.202204291417 (299)[org.openhab.binding.samsungtv.internal.SamsungTvTlsTrustManagerProvider(386)] : Querying state satisfied
23:35:15.850 [DEBUG] [rnal.SamsungTvTlsTrustManagerProvider] - bundle org.openhab.binding.samsungtv:3.3.0.202204291417 (299)[org.openhab.binding.samsungtv.internal.SamsungTvTlsTrustManagerProvider(386)] : Querying state satisfied
23:35:15.850 [DEBUG] [rnal.SamsungTvTlsTrustManagerProvider] - bundle org.openhab.binding.samsungtv:3.3.0.202204291417 (299)[org.openhab.binding.samsungtv.internal.SamsungTvTlsTrustManagerProvider(386)] : getting activate: activate
23:35:15.850 [DEBUG] [rnal.SamsungTvTlsTrustManagerProvider] - bundle org.openhab.binding.samsungtv:3.3.0.202204291417 (299)[org.openhab.binding.samsungtv.internal.SamsungTvTlsTrustManagerProvider(386)] : Locating method activate in class org.openhab.binding.samsungtv.internal.SamsungTvTlsTrustManagerProvider
23:35:15.850 [DEBUG] [rnal.SamsungTvTlsTrustManagerProvider] - bundle org.openhab.binding.samsungtv:3.3.0.202204291417 (299)[org.openhab.binding.samsungtv.internal.SamsungTvTlsTrustManagerProvider(386)] : Declared Method org.openhab.binding.samsungtv.internal.SamsungTvTlsTrustManagerProvider.activate([interface org.osgi.service.component.ComponentContext]) not found
23:35:15.850 [DEBUG] [rnal.SamsungTvTlsTrustManagerProvider] - bundle org.openhab.binding.samsungtv:3.3.0.202204291417 (299)[org.openhab.binding.samsungtv.internal.SamsungTvTlsTrustManagerProvider(386)] : Locating method activate in class java.lang.Object
23:35:15.850 [DEBUG] [rnal.SamsungTvTlsTrustManagerProvider] - bundle org.openhab.binding.samsungtv:3.3.0.202204291417 (299)[org.openhab.binding.samsungtv.internal.SamsungTvTlsTrustManagerProvider(386)] : Declared Method java.lang.Object.activate([interface org.osgi.service.component.ComponentContext]) not found
23:35:15.850 [DEBUG] [rnal.SamsungTvTlsTrustManagerProvider] - bundle org.openhab.binding.samsungtv:3.3.0.202204291417 (299)[org.openhab.binding.samsungtv.internal.SamsungTvTlsTrustManagerProvider(386)] : activate method [activate] not found, ignoring
23:35:15.850 [DEBUG] [rnal.SamsungTvTlsTrustManagerProvider] - bundle org.openhab.binding.samsungtv:3.3.0.202204291417 (299)[org.openhab.binding.samsungtv.internal.SamsungTvTlsTrustManagerProvider(386)] : Set implementation object for component
23:35:15.850 [DEBUG] [rnal.SamsungTvTlsTrustManagerProvider] - bundle org.openhab.binding.samsungtv:3.3.0.202204291417 (299)[org.openhab.binding.samsungtv.internal.SamsungTvTlsTrustManagerProvider(386)] : Changed state from satisfied to active
23:35:15.850 [DEBUG] [scovery.SamsungTvDiscoveryParticipant] - bundle org.openhab.binding.samsungtv:3.3.0.202204291417 (299)[org.openhab.binding.samsungtv.internal.discovery.SamsungTvDiscoveryParticipant] : Component created: DS=DS13, implementation=org.openhab.binding.samsungtv.internal.discovery.SamsungTvDiscoveryParticipant, immediate=false, default-enabled=true, factory=null, configuration-policy=optional, activate=activate, deactivate=deactivate, modified=null configuration-pid=[org.openhab.binding.samsungtv.internal.discovery.SamsungTvDiscoveryParticipant]
23:35:15.850 [DEBUG] [scovery.SamsungTvDiscoveryParticipant] - bundle org.openhab.binding.samsungtv:3.3.0.202204291417 (299)[org.openhab.binding.samsungtv.internal.discovery.SamsungTvDiscoveryParticipant] : Component Services: scope=singleton, services=[org.openhab.core.config.discovery.upnp.UpnpDiscoveryParticipant]
23:35:15.851 [DEBUG] [scovery.SamsungTvDiscoveryParticipant] - bundle org.openhab.binding.samsungtv:3.3.0.202204291417 (299)[org.openhab.binding.samsungtv.internal.discovery.SamsungTvDiscoveryParticipant] : Component Properties: {}
23:35:15.851 [DEBUG] [scovery.SamsungTvDiscoveryParticipant] - bundle org.openhab.binding.samsungtv:3.3.0.202204291417 (299)[org.openhab.binding.samsungtv.internal.discovery.SamsungTvDiscoveryParticipant] : Querying state disabled
23:35:15.851 [DEBUG] [scovery.SamsungTvDiscoveryParticipant] - bundle org.openhab.binding.samsungtv:3.3.0.202204291417 (299)[org.openhab.binding.samsungtv.internal.discovery.SamsungTvDiscoveryParticipant] : Querying state disabled
23:35:15.851 [DEBUG] [scovery.SamsungTvDiscoveryParticipant] - bundle org.openhab.binding.samsungtv:3.3.0.202204291417 (299)[org.openhab.binding.samsungtv.internal.discovery.SamsungTvDiscoveryParticipant] : Component can not be activated since it is in state disabled
23:35:15.851 [DEBUG] [scovery.SamsungTvDiscoveryParticipant] - bundle org.openhab.binding.samsungtv:3.3.0.202204291417 (299)[org.openhab.binding.samsungtv.internal.discovery.SamsungTvDiscoveryParticipant] : Querying state disabled
23:35:15.851 [DEBUG] [scovery.SamsungTvDiscoveryParticipant] - bundle org.openhab.binding.samsungtv:3.3.0.202204291417 (299)[org.openhab.binding.samsungtv.internal.discovery.SamsungTvDiscoveryParticipant(387)] : Updating target filters
23:35:15.851 [DEBUG] [scovery.SamsungTvDiscoveryParticipant] - bundle org.openhab.binding.samsungtv:3.3.0.202204291417 (299)[org.openhab.binding.samsungtv.internal.discovery.SamsungTvDiscoveryParticipant(387)] : Changed state from disabled to unsatisfiedReference
23:35:15.851 [DEBUG] [scovery.SamsungTvDiscoveryParticipant] - bundle org.openhab.binding.samsungtv:3.3.0.202204291417 (299)[org.openhab.binding.samsungtv.internal.discovery.SamsungTvDiscoveryParticipant(387)] : Component enabled
23:35:15.851 [DEBUG] [scovery.SamsungTvDiscoveryParticipant] - bundle org.openhab.binding.samsungtv:3.3.0.202204291417 (299)[org.openhab.binding.samsungtv.internal.discovery.SamsungTvDiscoveryParticipant(387)] : ActivateInternal
23:35:15.851 [DEBUG] [scovery.SamsungTvDiscoveryParticipant] - bundle org.openhab.binding.samsungtv:3.3.0.202204291417 (299)[org.openhab.binding.samsungtv.internal.discovery.SamsungTvDiscoveryParticipant(387)] : Querying state unsatisfiedReference
23:35:15.851 [DEBUG] [scovery.SamsungTvDiscoveryParticipant] - bundle org.openhab.binding.samsungtv:3.3.0.202204291417 (299)[org.openhab.binding.samsungtv.internal.discovery.SamsungTvDiscoveryParticipant(387)] : Querying state unsatisfiedReference
23:35:15.851 [DEBUG] [scovery.SamsungTvDiscoveryParticipant] - bundle org.openhab.binding.samsungtv:3.3.0.202204291417 (299)[org.openhab.binding.samsungtv.internal.discovery.SamsungTvDiscoveryParticipant(387)] : Activating component from state unsatisfiedReference
23:35:15.851 [DEBUG] [scovery.SamsungTvDiscoveryParticipant] - bundle org.openhab.binding.samsungtv:3.3.0.202204291417 (299)[org.openhab.binding.samsungtv.internal.discovery.SamsungTvDiscoveryParticipant(387)] : Querying state unsatisfiedReference
23:35:15.851 [DEBUG] [scovery.SamsungTvDiscoveryParticipant] - bundle org.openhab.binding.samsungtv:3.3.0.202204291417 (299)[org.openhab.binding.samsungtv.internal.discovery.SamsungTvDiscoveryParticipant(387)] : Querying state unsatisfiedReference
23:35:15.851 [DEBUG] [scovery.SamsungTvDiscoveryParticipant] - bundle org.openhab.binding.samsungtv:3.3.0.202204291417 (299)[org.openhab.binding.samsungtv.internal.discovery.SamsungTvDiscoveryParticipant(387)] : Changed state from unsatisfiedReference to satisfied
23:35:15.851 [DEBUG] [scovery.SamsungTvDiscoveryParticipant] - bundle org.openhab.binding.samsungtv:3.3.0.202204291417 (299)[org.openhab.binding.samsungtv.internal.discovery.SamsungTvDiscoveryParticipant(387)] : registration change queue [registered]
23:35:15.852 [DEBUG] [scovery.SamsungTvDiscoveryParticipant] - bundle org.openhab.binding.samsungtv:3.3.0.202204291417 (299)[org.openhab.binding.samsungtv.internal.discovery.SamsungTvDiscoveryParticipant(387)] : Checking constructor public org.openhab.binding.samsungtv.internal.discovery.SamsungTvDiscoveryParticipant()
23:35:15.852 [DEBUG] [scovery.SamsungTvDiscoveryParticipant] - bundle org.openhab.binding.samsungtv:3.3.0.202204291417 (299)[org.openhab.binding.samsungtv.internal.discovery.SamsungTvDiscoveryParticipant(387)] : Found constructor with 0 arguments : public org.openhab.binding.samsungtv.internal.discovery.SamsungTvDiscoveryParticipant()
23:35:15.852 [DEBUG] [scovery.SamsungTvDiscoveryParticipant] - bundle org.openhab.binding.samsungtv:3.3.0.202204291417 (299)[org.openhab.binding.samsungtv.internal.discovery.SamsungTvDiscoveryParticipant(387)] : This thread collected dependencies
23:35:15.852 [DEBUG] [scovery.SamsungTvDiscoveryParticipant] - bundle org.openhab.binding.samsungtv:3.3.0.202204291417 (299)[org.openhab.binding.samsungtv.internal.discovery.SamsungTvDiscoveryParticipant(387)] : getService (single component manager) dependencies collected.
23:35:15.852 [DEBUG] [scovery.SamsungTvDiscoveryParticipant] - bundle org.openhab.binding.samsungtv:3.3.0.202204291417 (299)[org.openhab.binding.samsungtv.internal.discovery.SamsungTvDiscoveryParticipant(387)] : Querying state satisfied
23:35:15.852 [DEBUG] [scovery.SamsungTvDiscoveryParticipant] - bundle org.openhab.binding.samsungtv:3.3.0.202204291417 (299)[org.openhab.binding.samsungtv.internal.discovery.SamsungTvDiscoveryParticipant(387)] : Querying state satisfied
23:35:15.852 [DEBUG] [scovery.SamsungTvDiscoveryParticipant] - bundle org.openhab.binding.samsungtv:3.3.0.202204291417 (299)[org.openhab.binding.samsungtv.internal.discovery.SamsungTvDiscoveryParticipant(387)] : getting activate: activate
23:35:15.852 [DEBUG] [scovery.SamsungTvDiscoveryParticipant] - bundle org.openhab.binding.samsungtv:3.3.0.202204291417 (299)[org.openhab.binding.samsungtv.internal.discovery.SamsungTvDiscoveryParticipant(387)] : Locating method activate in class org.openhab.binding.samsungtv.internal.discovery.SamsungTvDiscoveryParticipant
23:35:15.852 [DEBUG] [scovery.SamsungTvDiscoveryParticipant] - bundle org.openhab.binding.samsungtv:3.3.0.202204291417 (299)[org.openhab.binding.samsungtv.internal.discovery.SamsungTvDiscoveryParticipant(387)] : Declared Method org.openhab.binding.samsungtv.internal.discovery.SamsungTvDiscoveryParticipant.activate([interface org.osgi.service.component.ComponentContext]) not found
23:35:15.852 [DEBUG] [scovery.SamsungTvDiscoveryParticipant] - bundle org.openhab.binding.samsungtv:3.3.0.202204291417 (299)[org.openhab.binding.samsungtv.internal.discovery.SamsungTvDiscoveryParticipant(387)] : Locating method activate in class java.lang.Object
23:35:15.852 [DEBUG] [scovery.SamsungTvDiscoveryParticipant] - bundle org.openhab.binding.samsungtv:3.3.0.202204291417 (299)[org.openhab.binding.samsungtv.internal.discovery.SamsungTvDiscoveryParticipant(387)] : Declared Method java.lang.Object.activate([interface org.osgi.service.component.ComponentContext]) not found
23:35:15.852 [DEBUG] [scovery.SamsungTvDiscoveryParticipant] - bundle org.openhab.binding.samsungtv:3.3.0.202204291417 (299)[org.openhab.binding.samsungtv.internal.discovery.SamsungTvDiscoveryParticipant(387)] : activate method [activate] not found, ignoring
23:35:15.852 [DEBUG] [scovery.SamsungTvDiscoveryParticipant] - bundle org.openhab.binding.samsungtv:3.3.0.202204291417 (299)[org.openhab.binding.samsungtv.internal.discovery.SamsungTvDiscoveryParticipant(387)] : Set implementation object for component
23:35:15.852 [DEBUG] [scovery.SamsungTvDiscoveryParticipant] - bundle org.openhab.binding.samsungtv:3.3.0.202204291417 (299)[org.openhab.binding.samsungtv.internal.discovery.SamsungTvDiscoveryParticipant(387)] : Changed state from satisfied to active
23:35:15.860 [DEBUG] [gtv.internal.handler.SamsungTvHandler] - 192.168.69.30: Create a Samsung TV Handler for thing 'samsungtv:tv:LivingRoomTV'
23:35:15.862 [DEBUG] [gtv.internal.handler.SamsungTvHandler] - 192.168.69.30: Initializing Samsung TV handler for uid 'samsungtv:tv:LivingRoomTV'
23:35:15.865 [DEBUG] [gtv.internal.handler.SamsungTvHandler] - 192.168.69.30: Updated artModeSupported: false and PowerState: false
23:35:15.865 [DEBUG] [gtv.internal.handler.SamsungTvHandler] - 192.168.69.30: Configuration: SecureWebSocket, port: 55000, token: , MAC: , subscription: false
23:35:15.865 [DEBUG] [gtv.internal.handler.SamsungTvHandler] - 192.168.69.30: SmartThings disabled
23:35:15.865 [DEBUG] [gtv.internal.handler.SamsungTvHandler] - 192.168.69.30: Check and create missing services
23:35:15.865 [DEBUG] [gtv.internal.handler.SamsungTvHandler] - 192.168.69.30: TV is OFFLINE

I feel like I should be getting some TRACE logs, but I do not see them.

My api v2 (note the unique IDs are obfuscated):

{
  "device": {
    "FrameTVSupport": "false",
    "GamePadSupport": "true",
    "ImeSyncedSupport": "true",
    "OS": "Tizen",
    "TokenAuthSupport": "true",
    "VoiceSupport": "false",
    "countryCode": "NZ",
    "description": "Samsung DTV RCR",
    "developerIP": "0.0.0.0",
    "developerMode": "0",
    "duid": "uuid:ca7a9b5e-3235-4aa4-ad3b-99b1********",
    "firmwareVersion": "Unknown",
    "id": "uuid:ca7a9b5e-3235-4aa4-ad3b-99b1********",
    "ip": "192.168.69.30",
    "model": "18_KANTSU_UHD_BASIC",
    "modelName": "UA50NU7090",
    "name": "[TV] Samsung 7 Series (50)",
    "networkType": "wired",
    "resolution": "3840x2160",
    "smartHubAgreement": "true",
    "type": "Samsung SmartTV",
    "udn": "uuid:ca7a9b5e-3235-4aa4-ad3b-99b1********",
    "wifiMac": "c0:48:e6:**:**:**"
  },
  "id": "uuid:ca7a9b5e-3235-4aa4-ad3b-99b1********",
  "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\":\"false\"}\n",
  "name": "[TV] Samsung 7 Series (50)",
  "remote": "1.0",
  "type": "Samsung SmartTV",
  "uri": "https://192.168.69.30:8002/api/v2/",
  "version": "2.0.25"
}

Samsung really suck as it seems like over time they seem to remove automation features for these TVs! Some of those pre-2016 TV’s had some really cool automation features. I just read up above and now it seems like they’ve removed the Art Mode api from the 2022 models! :broken_heart:

@Cossey Tell me about the 2022 art mode…

Anyway, the first thing I see is that your port is incorrect. 5500 is for very old legacy TV’s. your port should be 8002 (Secure Websocket).

The other thing is that you probably don’t have the UPNP Transport service installed (which is why your TV appears OFFLINE).

From the documentation, you need to go to the karaf console and enter:

feature:install openhab-transport-upnp

This is because this is a marketplace binding, and marketplace bindings don’t automatically install dependencies the same way regular binding do.

The .kar file should include the dependencies (which is why I include it), but the marketplace only installs .jar files.

So, fix the port, and install the UPNP transport, and report back if it works.

I am working on a 2022 version of the binding, to work around the art mode api being removed. it’s almost ready to go, it has some improvements for regular TV’s as well.

Thanks for the follow up, however still no luck - I also do not see any TRACE output when log:tailing. I will pull down your latest code and have test to see what is going on in further detail.

If I recall, the openhab provided binding would automatically use port 8001/8002 in code when using the WS/WSS, I wonder if the port option is really needed?

Regarding power on/off - I noticed that this has always been an issue with this binding as the status of the TV is attached to the UPnP status. A few years ago I did experiment with how it worked on my TV when connecting over secure web sockets. I found that monitoring the web socket connection worked best for this model - as sometimes it could take up to 30 seconds after power-off to shut down UPnP and Web sockets - in that time you could send the power command again to toggle back on the TV as (WoL would only work when both of these had “shut down”). It would be great if this could be an option to set those devices where this is a problem.

@Cossey , I assume you have your log level set to Trace right? Because you are right, you should be seeing a lot more output than you are.

If I recall, the openhab provided binding would automatically use port 8001/8002 in code when using the WS/WSS, I wonder if the port option is really needed?

My binding should automatically configure the ports correctly, when the TV is discovered and added from the inbox. And yes, it is important that the port is set correctly. Only 8002 will work with your TV. It is different ports for different versions of TV, so I didn’t want to mess with it too much.

The power handling in my binding has been completely re-written. I can’t guarantee that it will work better with your TV though. There is no real good way to detect when the TV is off, other than watching ports. The UPNP port announces when it goes offline, so that’s what I use to detect TV off. Samsung has an “instant on” feature that keeps the TV from shutting down immediately, just in case you want to turn back on straight after turning off. This does cause some issues.

I try to read the status from the REST port (it reports “standby” when the TV is in this state), of course with the TV off, it doesn’t report anything.

All I can say is that with Samsung changing things every year, and nothing published, we just have to do what we can. I also only have three TV’s to test on.

So set you logging level to TRACE, and we’ll see if we can get it working. It’s almost always the UPNP that’s the problem.

Thanks again for the response, unless the ID is different, it is set to trace.

log:get org.openhab.binding.samsungtv
TRACE

This binding does not pick up the TV (even the openHAB provided one). I am running latest milestone on upon docker (with network mode: host) on a Debian PC. I do have cisco networking equipment, but all IGMP settings are disabled and I can see the TV show up and disappear under Networking on Windows 10. I did try with the commit you’ve made to your repository (1840bfd). I’ll look into the code as soon as I have some time to figure out what is going on.

I don’t know what’s wrong with your logging setup, but UDMP multicast will not work properly from within a docker container.

This is because docker does not support IGMP, so the IGMP JOIN to the multicast group can’t be sent.

This is why neither binding is working for you.

Only solution is to run Openhab in a VM or some other configuration.

I have my openHAB on a docker container and the plug-in is working…

Ok, maybe I’m wrong. I have had trouble with docker containers not passing UPNP multicast before, but it’s possible that there is some other setting, or network config that’s causing the problem.