Skip to content
This repository has been archived by the owner on Jul 10, 2024. It is now read-only.

No Token received on UE43RU7400UXXU #117

Open
cyclops1982 opened this issue Aug 10, 2019 · 12 comments
Open

No Token received on UE43RU7400UXXU #117

cyclops1982 opened this issue Aug 10, 2019 · 12 comments

Comments

@cyclops1982
Copy link

Hi,
I've been having trouble getting things to work. Now, i tried to debug things a bit with some JS and websockets.

From what i understand, we connect to:
"ws://192.168.1.22:8001/api/v2/channel/samsung.remote.control?name="+appname
or
"wss://192.168.1.22:8002/api/v2/channel/samsung.remote.control?name="+appname

and should then get some JSON back with a 'token' after you've approved it on the TV itself.
Now, i don't get a token back. All i get is:
{"data":{"clients":[{"attributes":{"name":"U2Ftc3VuZyBTbWFydFRWIGFwcDIzMjM="},"connectTime":1565448405613,"deviceName":"U2Ftc3VuZyBTbWFydFRWIGFwcDIzMjM=","id":"cff93d38-c95a-49ce-a7a2-26ab541cdd10","isHost":false}],"id":"cff93d38-c95a-49ce-a7a2-26ab541cdd10"},"event":"ms.channel.connect"}

So, i simply don't get a token. I've tried to perform the same request with a dummy token, and then i do get a token back int he attributes object, but i'm still unable to run commands:
send:{"method":"ms.remote.control","params":{"Cmd":"Click","DataOfCmd":"KEY_MUTE","Option":"false","TypeOfRemote":"SendRemoteKey"}} Received:{"data":{"message":"unrecognized method value : ms.remote.control"},"event":"ms.error"}

Now, i did all of this in some nodejs after looking at all the code, so i might easily do something wrong! Any advise would be appreciated.

@cyclops1982
Copy link
Author

#114 (comment)

I'm not sure if this requires a change in samsungctl

@mStirner
Copy link

mStirner commented Sep 8, 2019

I have the exact same issue with a UE60J6289.
No pairing dialog appears nor Wake On LAN work either.

Output from http://192.168.2.103:8001/api/v2/:

{
  "id": "uuid:bd816fe9-5a03-48f2-8cbd-c048378e5645",
  "name": "[TV] UE60J6289",
  "version": "2.0.25",
  "device": {
    "type": "Samsung SmartTV",
    "duid": "uuid:bd816fe9-5a03-48f2-8cbd-c048378e5645",
    "model": "15_HAWKM_2D",
    "modelName": "UE60J6240",
    "description": "Samsung DTV RCR",
    "networkType": "wired",
    "ssid": "",
    "ip": "192.168.2.103",
    "firmwareVersion": "Unknown",
    "name": "[TV] UE60J6289",
    "id": "uuid:bd816fe9-5a03-48f2-8cbd-c048378e5645",
    "udn": "uuid:bd816fe9-5a03-48f2-8cbd-c048378e5645",
    "resolution": "1920x1080",
    "countryCode": "DE",
    "msfVersion": "2.0.25",
    "smartHubAgreement": "true",
    "wifiMac": "5c:49:7d:21:14:27",
    "developerMode": "0",
    "developerIP": ""
  },
  "type": "Samsung SmartTV",
  "uri": "http://192.168.2.103:8001/api/v2/"
}

With my other Samsung TV (UE43KU6079) it works fine.
Im not sure if i enabled developer mode or something similar.

{
  "id": "uuid:b7dc3810-668b-4b29-990f-509aa954ae2b",
  "name": "[TV] Samsung 6 Series (43)",
  "version": "2.1.0",
  "device": {
    "type": "Samsung SmartTV",
    "duid": "uuid:b7dc3810-668b-4b29-990f-509aa954ae2b",
    "model": "16_JAZZL_UHD_BASIC",
    "modelName": "UE43KU6079",
    "description": "Samsung DTV RCR",
    "networkType": "wired",
    "ssid": "",
    "ip": "192.168.2.108",
    "firmwareVersion": "Unknown",
    "name": "[TV] Samsung 6 Series (43)",
    "id": "uuid:b7dc3810-668b-4b29-990f-509aa954ae2b",
    "udn": "uuid:b7dc3810-668b-4b29-990f-509aa954ae2b",
    "resolution": "3840x2160",
    "countryCode": "DE",
    "msfVersion": "2.1.0",
    "smartHubAgreement": "true",
    "VoiceSupport": "false",
    "GamePadSupport": "true",
    "wifiMac": "f8:3f:51:fd:ae:b2",
    "developerMode": "0",
    "developerIP": "",
    "OS": "Tizen"
  },
  "type": "Samsung SmartTV",
  "uri": "http://192.168.2.108:8001/api/v2/",
  "remote": "1.0",
  "isSupport": "{\"remote_available\":\"true\",\"remote_fourDirections\":\"true\",\"remote_touchPad\":\"true\",\"remote_voiceControl\":\"false\",\"DMP_available\":\"true\",\"DMP_DRM_PLAYREADY\":\"false\",\"DMP_DRM_WIDEVINE\":\"false\",\"EDEN_available\":\"true\"}"
}

@johnjhr
Copy link

johnjhr commented Feb 4, 2020

Hi,
I've been having trouble getting things to work. Now, i tried to debug things a bit with some JS and websockets.

From what i understand, we connect to:
"ws://192.168.1.22:8001/api/v2/channel/samsung.remote.control?name="+appname
or
"wss://192.168.1.22:8002/api/v2/channel/samsung.remote.control?name="+appname

and should then get some JSON back with a 'token' after you've approved it on the TV itself.
Now, i don't get a token back. All i get is:
{"data":{"clients":[{"attributes":{"name":"U2Ftc3VuZyBTbWFydFRWIGFwcDIzMjM="},"connectTime":1565448405613,"deviceName":"U2Ftc3VuZyBTbWFydFRWIGFwcDIzMjM=","id":"cff93d38-c95a-49ce-a7a2-26ab541cdd10","isHost":false}],"id":"cff93d38-c95a-49ce-a7a2-26ab541cdd10"},"event":"ms.channel.connect"}

So, i simply don't get a token. I've tried to perform the same request with a dummy token, and then i do get a token back int he attributes object, but i'm still unable to run commands:
send:{"method":"ms.remote.control","params":{"Cmd":"Click","DataOfCmd":"KEY_MUTE","Option":"false","TypeOfRemote":"SendRemoteKey"}} Received:{"data":{"message":"unrecognized method value : ms.remote.control"},"event":"ms.error"}

Now, i did all of this in some nodejs after looking at all the code, so i might easily do something wrong! Any advise would be appreciated.

did u get any fix ?

@mStirner
Copy link

mStirner commented Feb 17, 2020

@cyclops1982 johnjaiharjose unfortunately not yet.
Im not sure where to start debugging.

Is there a way to re-trigger the "Allow Control" handshake ?
Some where on the TV must be saved what devices/apps can access the API, how can i view/clear that ?

Its too sad that samsung dosnt document this API

@cyclops1982
Copy link
Author

@mStirner - you can remove the provided permissions in one of the settings of the TV. Then you'll get that dialog again.

What my problem is is that i basically want to start/stop the TV. I do power it down in between (so i'ts not evne on stand-by) and it seems that the token is just not accepted, or the commands are majorly different.

So, after the first accepted, i want to be able to shut down and start the tv again (even if this is only into stand-by or not). I can't get that to work, which is my major use-case here.

For me it feels like samsung is missing out here. There's no good app or anything to control the new TV's anymore, i even wonder how well it works with samsungs own home-automation, because i don't see how that can even work at the moment.

@johnjhr
Copy link

johnjhr commented Feb 18, 2020

There's no good app or anything to control the new TV's anymore, i even wonder how well it works with samsungs own home-automation, because i don't see how that can even work at the moment.

The smarthub app works flawless on the new 7 series samsung led tv. I think it uses IFTTT. Full remote control is embedded in that app. I can provide any help if u guys need.

@mStirner
Copy link

mStirner commented Feb 18, 2020

With my UE60J6289 it just dosnt work.
I delete all permissions and tried it again.

When i connect to the WebSocket endpoint, only the unprotected url works. (ws + port 8001) , with wss + 8002 nothing happens, no open event is fired.
Could this be due to incompatible TLS/SSL settings/algorithms ? But why is no error thrown from node/ws lib ?
When i connect with the SmartView app from my Androind phone the TV displays 4 a digit pin.

My other TV (UE43KU6079) works witerror: WebSocket was closed before the connection was establishedh protected & unprocted url (ws + 8001 & wss + 8002).
When i connect, the TV asks for permissions. On this TV the Wake-on-LAN works too.

Only my UE60J6289 bitches around

EDIT:

With wscat it it a error, but not realy helpful:
wscat -n -c wss://192.168.2.100:8002/api/v2/channels/samsung.remote.control?name=dGVzdA==

error: WebSocket was closed before the connection was established

(Program terminated with CTRL+C after nothing happend)
I think the error comes from the process termination and has nothing to do with the with the problem/connection phase.

I just dont get it why there is in no way a possible connection to port 8002...
I try to play a little with ncat

@johnjhr
Copy link

johnjhr commented Feb 18, 2020

With my UE60J6289 it just dosnt work.
I delete all permissions and tried it again.

When i connect to the WebSocket endpoint, only the unprotected url works. (ws + port 8001) , with wss + 8002 nothing happens, no open event is fired.
Could this be due to incompatible TLS/SSL settings/algorithms ? But why is no error thrown from node/ws lib ?
When i connect with the SmartView app from my Androind phone the TV displays 4 a digit pin.

My other TV (UE43KU6079) works witerror: WebSocket was closed before the connection was establishedh protected & unprocted url (ws + 8001 & wss + 8002).
When i connect, the TV asks for permissions. On this TV the Wake-on-LAN works too.

Only my UE60J6289 bitches around

EDIT:

With wscat it it a error, but not realy helpful:
wscat -n -c wss://192.168.2.100:8002/api/v2/channels/samsung.remote.control?name=dGVzdA==

error: WebSocket was closed before the connection was established

(Program terminated with CTRL+C after nothing happend)
I think the error comes from the process termination and has nothing to do with the with the problem/connection phase.

I just dont get it why there is in no way a possible connection to port 8002...
I try to play a little with ncat

ok so try WOL on ur UE60J6289 on different ports like 8080, 7678 try a port scan and check for http protocol.

On my UN55RU7470 WOL works on 8080.

portscan

@mStirner
Copy link

mStirner commented Feb 19, 2020

ok so try WOL on ur UE60J6289 on different ports like 8080, 7678 try a port scan and check for http protocol.

WOL works normal on UDP port 7 or 9. Why should samsung implement this on a different port and what has this todo with http ?

That are the result of a nmap scan (tcp):

PORT STATE SERVICE VERSION
7236/tcp open display?
| fingerprint-strings:
| NULL:
| OPTIONS * RTSP/1.0
| CSeq: 1
| Server: AllShareCast/TizenTV/2.1
| Require: org.wfa.wfd1.0
|_ Date: Wed, 19 Feb 2020 11:00:09 GMT
7237/tcp open tcpwrapped
7676/tcp open upnp Samsung AllShare upnpd 1.0 (UPnP 1.1)
7677/tcp open upnp Samsung AllShare upnpd 1.0 (UPnP 1.1)
7678/tcp open upnp Samsung AllShare upnpd 1.0 (UPnP 1.1)
8000/tcp open http-alt
| fingerprint-strings:
| FourOhFourRequest, GetRequest, HTTPOptions:
| HTTP/1.1 500 Internal Server Error
| Content-Type: text/plain
| Date: Wed, 19 Feb 2020 11:00:20 GMT
|_ Connection: close
|_http-cors: GET POST PUT DELETE OPTIONS
|http-favicon: Unknown favicon MD5: 33E3EA7FC9C08D2E72730482906A676C
| http-methods:
|
Supported Methods: GET HEAD POST OPTIONS
|_http-open-proxy: Proxy might be redirecting requests
|_http-title: Site doesn't have a title.
8001/tcp open http Tizen Multiscreen SDK httpd
|http-cors: GET POST PUT DELETE
| http-methods:
|
Supported Methods: GET HEAD POST OPTIONS
|_http-title: 404 : Not Found
8002/tcp open ssl/http Tizen Multiscreen SDK httpd
|http-cors: GET POST PUT DELETE
| http-methods:
|
Supported Methods: HEAD POST OPTIONS
|_http-title: 404 : Not Found
| ssl-cert: Subject: commonName=SmartViewSDK/organizationName=SmartViewSDK/countryName=KR
| Subject Alternative Name: DNS:127.0.0.1, DNS:localhost
| Issuer: commonName=SmartViewSDK Root Ceritificate Authority/organizationName=SmartViewSDK/countryName=KR
| Public Key type: rsa
| Public Key bits: 2048
| Signature Algorithm: sha256WithRSAEncryption
| Not valid before: 2016-07-29T05:34:23
| Not valid after: 2036-07-29T05:34:23
| MD5: 189b 2634 fcca f1ef 31e1 7b7b 02ac c5bd
|SHA-1: b15e 72c0 04b4 3825 651e e7a7 2b66 1856 305d e56b
|ssl-date: TLS randomness does not represent time
| tls-nextprotoneg:
| http/1.1
|
http/1.0
8080/tcp open http lighttpd
| http-methods:
|
Supported Methods: OPTIONS GET HEAD POST
|_http-server-header: WebServer
|_http-title: 404 - Not Found
8187/tcp open upnp Samsung AllShare upnpd 1.0 (UPnP 1.1)
9197/tcp open upnp Samsung AllShare upnpd 1.0 (UPnP 1.1)
9999/tcp open abyss?
15500/tcp open unknown

To test the open ports i wrote a litle test script:

const wol = require('wol');

// 5C:49:7D:21:14:27


[
    7236,
    7237,
    7676,
    7677,
    7678,
    8000,
    8001,
    8002,
    8080,
    8187,
    9197,
    9999,
    15500
].forEach((port) => {
    wol.wake('5C-49-7D-21-14-27', {
        port: 7678
    }, (err, res) => {
        console.log("port: %d, err: %s, result: %j", port, err, res);
    });
});

node index.js
port: 7236, err: null, result: true
port: 7237, err: null, result: true
port: 7676, err: null, result: true
port: 7677, err: null, result: true
port: 7678, err: null, result: true
port: 8000, err: null, result: true
port: 8001, err: null, result: true
port: 8002, err: null, result: true
port: 8080, err: null, result: true
port: 8187, err: null, result: true
port: 9197, err: null, result: true
port: 9999, err: null, result: true
port: 15500, err: null, result: true

Unfortunately the TV dosn't start.
A UDP scan in nmap is running, but takes more then 7h to complete...

Are there some settings like "quick start" or "instant on" that need to be enabled/disabled ?

@RoderickJDunn
Copy link

Hopefully this helps someone.. Turns out my TV doesn't even require a token. I have full control using port 8001, with no token provided. My model is UN40KU6270

@PatrickSt1991
Copy link

I tried this many time but couldn't get it to work ([TV] Samsung 7 Series (55))

Then I found https://github.com/andrewsayre/pysmartthings that makes use of the SmartThings app with use of the API and Python.

I got both of my TV's in the app and now i'm able the control them via python in domoticz.

Maybe somebody find this usefull

@JBChesh
Copy link

JBChesh commented Jul 1, 2020

@PatrickStel correct link is https://github.com/andrewsayre/pysmartthings

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants