[DEPRECATED] Samsung TV support in SmartThings?

You can build the SSDP desired string inside the hubaction command. Make sure to add the line feeds and spaces correctly.

Could you share an example please :slight_smile: , just to make it a little easier.

@twack Todd do you have a sample for NOTIFY SSDP?

Firstly thanks for sharing this. I can get it to work great with my 2012 Samsung ua46f6800 TV.

Would it be possible to get it to work with Amazon Echo? So far the only thing that works is by saying “Alexa, turn off TV” (I named the group as TV) nothing else work. If it would be possible to change channel or change volume that would be great. Thanks.

1 Like

I’ve posted a couple of times in this thread, but I keep getting distracted by other projects and never seem to get back to diagnosing the issues I run into. If @RBoy is on the case, we must be close. :slight_smile:

TV is a 2014 H series that is not Tizen.
I have SmartApp and DTH installed.
TV has never asked for remote control authorization.

Before I ask for help getting it to work, I’d like to know if the best-case scenario gives me what I want, i.e. (pretty simple) just to trigger a ST event when the TV turns on. Turning off would be a bonus and, at the extreme of my dreams, to control the TV on/off/plex from ST. But, to reiterate, I’d be overjoyed just for ST to know when the TV is on.

I’m not aware of having ST “listen” for events, so without the ability to listen actively for events push notification may not be possible. However if I can get the code to work (my lab H series just doesn’t seem to want to cooperate) it would lead to “polling” to check if the TV has been turned on.

1 Like

Hi, as @bobbles said, i got mine working also by first entering into the “remote management” option, located under “support” section on my TV. Afterwards i finished the setup from the smartapp, then the pin was shown and buttons worked correctly. Also your device will be listed into the “network” section, “all share” options, where you can cancel the permissions.

1 Like

@OscarVM Thanks for the report. Could I ask what year TV you have?

So for the newer 2015 models and firmware this doesn’t seem to be on option however I did some of my own homework on this using Wireshark to track down what’s going and it looks like it’s using HTTP Websockets and as series of POST commands with pairing instructions (actually Step0, Step1 and Step2 followed by a CloudPINPage). If anyone’s interested I can send them the wireshark packet dump.

I also found this if anyone’s interested. I think the page is incomplete compared to my wireshark dump but still has some stuff there
http://forum.samygo.tv/viewtopic.php?f=74&t=7707

How about for 2014 models? (Sorry for the parochial interest - that’s what I’ve got.)

I think it depends on the firmware, the older ones will work fine with this SmartApp, newer ones … well that’s what I’m trying to figure out and any pointers would be helpful.

So if anyone’s interested in helping me debug this, here is the list of 5 commands that needs to be done to get the TV to pair up. These are HTTP Websocket command extracted from Wireshark and replicated using Postman (Chrome Plugin).
You can load these up in Postman, the Commands are run in the following order:

  1. GET CloudPinPage (Prestep Authentication)
  2. GET Step=0
  3. POST Step=1
  4. POST Step=2
  5. DELETE CloudPinPage (Step3 Authentication)

The issue I’ve run into, Commands 1,2 and 3 work great. Somewhere in the response from Command 3 (POST Step=1) lies a code which is used in Command 4 (POST Step=2) in the ServerAckMsg field (the request id returned from Command 3 is used directly in Command 4) and I can’t seem to find a pattern on how it get that ServerAckMsg value from the response of Command 3 ( which returns GeneratorClientHello).

{
	"id": "9fd930d4-cf5a-b9d0-915f-008b2dbe7068",
	"name": "Samsung TV Remote",
	"description": "",
	"order": [
		"1c456655-9e84-0a9e-8542-9f6f0d9f477a",
		"99fdf42b-c5da-1939-c845-250fd6a74a08",
		"745fbc35-db5d-9dfb-0687-a634f2e8c479",
		"12327b72-1bbc-dc0c-59c5-e9b36c861a12",
		"111aaaec-b69b-aaa0-571d-4e9ca1463250"
	],
	"folders": [],
	"timestamp": 1469137311344,
	"owner": "832297",
	"remoteLink": "",
	"public": false,
	"published": false,
	"requests": [
		{
			"id": "111aaaec-b69b-aaa0-571d-4e9ca1463250",
			"headers": "",
			"url": "http://192.168.1.78:8080/ws/apps/CloudPINPage/run",
			"pathVariables": {},
			"preRequestScript": null,
			"method": "DELETE",
			"collectionId": "9fd930d4-cf5a-b9d0-915f-008b2dbe7068",
			"data": null,
			"dataMode": "params",
			"name": "http://192.168.1.78:8080/ws/apps/CloudPINPage/run",
			"description": "Step 3 Authentication",
			"descriptionFormat": "html",
			"time": 1469138526697,
			"version": 2,
			"responses": [],
			"tests": null,
			"currentHelper": "normal",
			"helperAttributes": {}
		},
		{
			"id": "12327b72-1bbc-dc0c-59c5-e9b36c861a12",
			"headers": "",
			"url": "http://192.168.1.78:8080/ws/pairing?step=2&app_id=12345&device_id=6163F897-F7E2-46E6-8ACD-80E3C339F4ED&type=1",
			"pathVariables": {},
			"preRequestScript": "",
			"method": "POST",
			"collectionId": "9fd930d4-cf5a-b9d0-915f-008b2dbe7068",
			"data": [
				{
					"key": "\"auth_Data\"",
					"value": "{\"auth_type\":\"SPC\",\"request_id\":\"4\",\"ServerAckMsg\":\"0103000000000000000014C798C9999D1BD815FFE4C4F8411C37C005C9A00B0000000000\"}",
					"type": "text",
					"enabled": true
				}
			],
			"dataMode": "params",
			"name": "http://192.168.1.78:8080/ws/pairing?step=2&app_id=12345&device_id=6163F897-F7E2-46E6-8ACD-80E3C339F4ED&type=1",
			"description": "Step 2 Authentication",
			"descriptionFormat": "html",
			"time": 1469138324839,
			"version": 2,
			"responses": [],
			"tests": null,
			"currentHelper": "normal",
			"helperAttributes": {}
		},
		{
			"id": "1c456655-9e84-0a9e-8542-9f6f0d9f477a",
			"headers": "",
			"url": "http://192.168.1.78:8080/ws/apps/CloudPINPage",
			"pathVariables": {},
			"preRequestScript": null,
			"method": "GET",
			"collectionId": "9fd930d4-cf5a-b9d0-915f-008b2dbe7068",
			"data": null,
			"dataMode": "params",
			"name": "http://192.168.1.78:8080/ws/apps/CloudPINPage",
			"description": "PreStep Authentication",
			"descriptionFormat": "html",
			"time": 1469138682343,
			"version": 2,
			"responses": [],
			"tests": null,
			"currentHelper": "normal",
			"helperAttributes": {}
		},
		{
			"id": "745fbc35-db5d-9dfb-0687-a634f2e8c479",
			"headers": "",
			"url": "http://192.168.1.78:8080/ws/pairing?step=1&app_id=12345&device_id=6163F897-F7E2-46E6-8ACD-80E3C339F4ED&type=1",
			"pathVariables": {},
			"preRequestScript": "",
			"method": "POST",
			"collectionId": "9fd930d4-cf5a-b9d0-915f-008b2dbe7068",
			"data": [
				{
					"key": "\"auth_Data\"",
					"value": "{\"auth_type\":\"SPC\",\"GeneratorServerHello\":\"010200000000000000008A000000063635343332319BE28900CFCCE6091F911DE2228DC8FE111077742B8AF460A67E205D662CDA9CDEC866A12D72A140BE12F5C0BB6F742478DEED314D99FE08DFAE2ABF78777C133B732041191272E52B3B8C90FAB1464334ECE1E74BBA948055899CB6D0549A44810953324ACA0B093EA0B7BC814F8B271873876348EA44A239C2566454C99AB50000000000\"}",
					"type": "text",
					"enabled": true
				}
			],
			"dataMode": "params",
			"name": "http://192.168.1.78:8080/ws/pairing?step=1&app_id=12345&device_id=6163F897-F7E2-46E6-8ACD-80E3C339F4ED&type=1",
			"description": "Step 1 Authentication",
			"descriptionFormat": "html",
			"time": 1469138087763,
			"version": 2,
			"responses": [
				{
					"status": "",
					"responseCode": {
						"code": 200,
						"name": "OK",
						"detail": "Standard response for successful HTTP requests. The actual response will depend on the request method used. In a GET request, the response will contain an entity corresponding to the requested resource. In a POST request the response will contain an entity describing or containing the result of the action."
					},
					"time": 169,
					"headers": [
						{
							"name": "Access-Control-Allow-Origin",
							"key": "Access-Control-Allow-Origin",
							"value": "https://www.youtube.com",
							"description": "Specifies a URI that may access the resource. For requests without credentials, the server may specify '*' as a wildcard, thereby allowing any origin to access the resource."
						},
						{
							"name": "Cache-Control",
							"key": "Cache-Control",
							"value": "no-cache",
							"description": "Tells all caching mechanisms from server to client whether they may cache this object. It is measured in seconds"
						},
						{
							"name": "Content-Length",
							"key": "Content-Length",
							"value": "440",
							"description": "The length of the response body in octets (8-bit bytes)"
						},
						{
							"name": "Content-Type",
							"key": "Content-Type",
							"value": "application/x-javascript; charset=utf-8",
							"description": "The mime type of this content"
						},
						{
							"name": "Date",
							"key": "Date",
							"value": "Thu, 01 Jan 1970 03:05:58 GMT",
							"description": "The date and time that the message was sent"
						},
						{
							"name": "Secure-Mode",
							"key": "Secure-Mode",
							"value": "true",
							"description": "Custom header"
						}
					],
					"cookies": [],
					"mime": "",
					"text": "{\"auth_data\":\"{\\\"auth_type\\\":\\\"SPC\\\",\\\"request_id\\\":\\\"5\\\",\\\"GeneratorClientHello\\\":\\\"010100000000000000009E00000006363534333231C152181F236BEDF8F21BBA294E8B26902D28323EC2AE4A4C8E37B134C242191D4BCC8E8604ECCA5C7FC0FA193D38A15F9191467B923FF6952FA8E395FBCB972C4544B315E195F02C2911FE364D18BD38B7D124977890BC05BB22FF0560600AC65C47EDE281FCA44CCF8F24644D09CCDA4E1B8620E86C98202586E0A4A60042BF26D539388E74EEEF26B59C9D34BF6787BACD55940000000000\\\"}\"}\n\n",
					"language": "javascript",
					"rawDataType": "text",
					"previewType": "html",
					"searchResultScrolledTo": -1,
					"forceNoPretty": false,
					"write": true,
					"empty": false,
					"failed": false,
					"state": {
						"size": "normal"
					},
					"id": "830eb671-d77a-cbd6-d84d-b358b132d30e",
					"name": "Step 1 Response",
					"request": {
						"url": "http://192.168.1.78:8080/ws/pairing?step=1&app_id=12345&device_id=6163F897-F7E2-46E6-8ACD-80E3C339F4ED&type=1",
						"headers": [],
						"data": [
							{
								"key": "\"auth_Data\"",
								"value": "{\"auth_type\":\"SPC\",\"GeneratorServerHello\":\"010200000000000000008A000000063635343332319BE28900CFCCE6091F911DE2228DC8FE111077742B8AF460A67E205D662CDA9CDEC866A12D72A140BE12F5C0BB6F742478DEED314D99FE08DFAE2ABF78777C133B732041191272E52B3B8C90FAB1464334ECE1E74BBA948055899CB6D0549A44810953324ACA0B093EA0B7BC814F8B271873876348EA44A239C2566454C99AB50000000000\"}",
								"type": "text",
								"enabled": true
							}
						],
						"method": "POST",
						"dataMode": "params"
					}
				}
			],
			"tests": null,
			"currentHelper": "normal",
			"helperAttributes": {}
		},
		{
			"id": "99fdf42b-c5da-1939-c845-250fd6a74a08",
			"headers": "",
			"url": "http://192.168.1.78:8080/ws/pairing?step=0&app_id=12345&device_id=6163F897-F7E2-46E6-8ACD-80E3C339F4ED&type=1",
			"pathVariables": {},
			"preRequestScript": null,
			"method": "GET",
			"collectionId": "9fd930d4-cf5a-b9d0-915f-008b2dbe7068",
			"data": null,
			"dataMode": "params",
			"name": "http://192.168.1.78:8080/ws/pairing?step=0&app_id=12345&device_id=6163F897-F7E2-46E6-8ACD-80E3C339F4ED&type=1",
			"description": "Step 0 Authenticate",
			"descriptionFormat": "html",
			"time": 1469137829143,
			"version": 2,
			"responses": [
				{
					"status": "",
					"responseCode": {
						"code": 200,
						"name": "OK",
						"detail": "Standard response for successful HTTP requests. The actual response will depend on the request method used. In a GET request, the response will contain an entity corresponding to the requested resource. In a POST request the response will contain an entity describing or containing the result of the action."
					},
					"time": 127,
					"headers": [
						{
							"name": "Access-Control-Allow-Origin",
							"key": "Access-Control-Allow-Origin",
							"value": "https://www.youtube.com",
							"description": "Specifies a URI that may access the resource. For requests without credentials, the server may specify '*' as a wildcard, thereby allowing any origin to access the resource."
						},
						{
							"name": "Cache-Control",
							"key": "Cache-Control",
							"value": "no-cache",
							"description": "Tells all caching mechanisms from server to client whether they may cache this object. It is measured in seconds"
						},
						{
							"name": "Content-Length",
							"key": "Content-Length",
							"value": "18",
							"description": "The length of the response body in octets (8-bit bytes)"
						},
						{
							"name": "Content-Type",
							"key": "Content-Type",
							"value": "application/x-javascript; charset=utf-8",
							"description": "The mime type of this content"
						},
						{
							"name": "Date",
							"key": "Date",
							"value": "Thu, 01 Jan 1970 03:05:47 GMT",
							"description": "The date and time that the message was sent"
						},
						{
							"name": "Secure-Mode",
							"key": "Secure-Mode",
							"value": "true",
							"description": "Custom header"
						}
					],
					"cookies": [],
					"mime": "",
					"text": "{\"auth_data\":\"\"}\n\n",
					"language": "javascript",
					"rawDataType": "text",
					"previewType": "html",
					"searchResultScrolledTo": -1,
					"forceNoPretty": false,
					"write": true,
					"empty": false,
					"failed": false,
					"state": {
						"size": "normal"
					},
					"id": "2c1f1958-d3ff-174d-7fba-cd686f07d2e6",
					"name": "Step 0 Response",
					"request": {
						"url": "http://192.168.1.78:8080/ws/pairing?step=0&app_id=12345&device_id=6163F897-F7E2-46E6-8ACD-80E3C339F4ED&type=1",
						"headers": [],
						"data": null,
						"method": "GET",
						"dataMode": "params"
					}
				}
			],
			"tests": null,
			"currentHelper": "normal",
			"helperAttributes": {}
		}
	]
}
1 Like

Did any one come up with a work around for this I have an Samsung 6 Series @johnconstantelo I also get java.lang.NullPointerException: Cannot get property ‘hub’ on null object @ line 126 what part of this did you change. Any help would be gratefully thanks

I don’t have the code in the IDE anymore, but it’s on my Github but it’s down due to the DNS issue hitting a good part of the East Coast. As soon as it’s back I’ll look. Like my post above said, all I did was make sure the namespace was correct.

Hi @troy_houghton,

Github is back. Here’s the SmartApp that works for me: (it creates the DH and device for you)

https://raw.githubusercontent.com/constjs/jcdevhandlers/master/smartapps/jscgs350/samsung-tv-connect.src/samsung-tv-connect.groovy

1 Like

Looks like you definitely need the DH installed too. I thought it was done for you via the SmartApp, but no. Here it is:

https://raw.githubusercontent.com/constjs/jcdevhandlers/master/devicetypes/jscgs350/samsung-smart-tv.src/samsung-smart-tv.groovy

Install both the app and DH, and then use the app to search for the TV.

…and my final post on this topic… I get the same error:

Quite frankly it’s useless for me anyway. I now remember why I removed the smartapp and DH 8 months ago, and why I’me doing it again right now.

The newer TVs won’t work this way - 2014 onwards which is H onwards. Also why there is 2 different Samsung TV apps.

I’m confused so there is SmartApps called Samsung TV 2016 but it doesn’t work ?