-
Notifications
You must be signed in to change notification settings - Fork 24
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Get token UE40J5200AKXZT #21
Comments
It seems IP not reached:
Do you have the TV on? Are you sure the IP is right? |
thanks for your reply |
thanks for your reply
my tv is on and connected to the internet. the IP address is correct (I use
a static IP address). I have two TVs of the same model and I get the same
error.
Il giorno mer 15 apr 2020 alle ore 09:49 Sergio Mayoral Martínez <
notifications@github.com> ha scritto:
… It seems IP not reached:
ConnectionRefusedError: [WinError 10061] Impossibile stabilire la connessione. Rifiuto persistente del computer di destinazione
Do you have the TV on? Are you sure the IP is right?
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#21 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AOIFNCBDK2GRLMDR2O2NTFDRMVRKBANCNFSM4MGZ4Q7Q>
.
|
@dariob84 I think your TV is blocking the request in some way. If I remember well, there was an option in the TV menu to permit one IP to control the TV. You can try it |
Has anyone successfully received a token on a J series? I have the program running under both under Windows 10 and Debian, but neither can get a token. Weirdly, the error always shows port 8000 is being tried. The TV is a UN40J6203 (specifically a UN40J6200AFXZA) and it IS on the net. nMap shows port 8080 open. Crypto.SelfTest passes fine. Linux command: python3 ./get_token.py -i 192.168.75.210 -p 8080 Linux log: File "/usr/lib/python3/dist-packages/requests/adapters.py", line 516, in send Windows 10 command: get_token.py --ip 192.168.75.210 --port 8080 Windows 10 log: raise ConnectionError(e, request=request) Both indicate port 8000 and both show the connection being refused. I have tried all manner of syntax, -i IP -p PORT; --i IP --p PORT; -ip IP -port PORT; --ip IP --port PORT etcetc to no avail. Is it that I am somehow still doing something wrong, or is the J6200 series not compatible? |
@flostingapplesauce the issue with the bad port should be fixed as of commit 2524a61. I'm having a similar issue with a J series Smart TV too (more details here #62). |
Thanks a million, EPMatt, but I am still getting a page of errors. Same errors when attempting it from the HA box and from a Windows machine. I can see the port is open with nmap, and can hit it with SSH, so I know the IP and port are correct. Although the error is identical when I use --port 8000 and nmap and ssh show 8000 is closed. bash-5.0# python get_token.py --ip 192.168.75.210 --port 8080 During handling of the above exception, another exception occurred: Traceback (most recent call last): During handling of the above exception, another exception occurred: Traceback (most recent call last): During handling of the above exception, another exception occurred: Traceback (most recent call last): |
Hi @flostingapplesauce, Did you clone this repo as of the latest commit? I think this could be the problem since you're passing port 8080 as a parameter to the script, but you're still getting errors related to port 8000. This issue has been completely fixed with the latest merged PR. Regarding the HA box, the issue is that there's no new version for this integration on HACS since the latest fix, so the code on your HA box could still be the buggy one from version I'd suggest trying the following:
Please let us know if running the script as suggested allows you to get the token. |
Thanks again EPMatt, it is indeed different once I had the newest software. Now I get a 400 Bad Request, so at least it is seeing something. Just in case it helps: C:\Samsung>python get_token.py --ip 192.168.75.210 --port 8080 |
Hi EPMatt, C:\temp\samsungtv_encrypted>python get_token.py --ip 192.168.1.31 --port 8080 |
Hi @flostingapplesauce @dariob84, Just for testing purposes and be sure that our devices are behaving in the same way, try to add this after
You'd probably see Could you please check and confirm it? |
Hi guys But I can successfully connect with this code (I receive PIN and it responds correctly): |
After reverting this commit: 2524a61 |
Hi @AKuHAK ,
I'm happy to hear that you managed to get the token. 🚀 Just for testing purposes, could you try retrieving the token with the code at the most recent commit?
Thankyou very much for pointing it out! |
Here are my tests:
However, there is no PIN on the TV screen. If I revert to 4eab94a:
I can see the PIN on the screen and PIN is correctly handled and I can successfully get token and session ID. So I made an assumption that the PIN request port is hardcoded to 8000, maybe I am wrong. Of course, it will be better to run the same tests on some other TV (J series for example). |
Hi, print(websocket_response) this is the response C:\temp\samsungtv_encrypted>python get_token.py --ip 192.168.1.31 --port 8080 |
EPMatt: I wasn't certain whether you wanted that line appended to the end of line 95, or added after it as line 96, so here it is both ways: Appended: C:\samsung> python get_token.py --ip 192.168.75.210 --port 8080 Added as line 96: C:\samsung> python get_token.py --ip 192.168.75.210 --port 8080 <Response [403]> Agreed, it looks like we have similar issues here. I am pretty sure that, at least on my end, I forgot to blow cigar smoke into the face of the sacrificial chicken last time I performed a ritual to the Python goddess, but it could be something else. ;) |
Hi @AKuHAK,
This time the pin was displayed, and you were able to get the token. I saw similar issues, with people being able to display the pin after several attempts. So this second request on the same port probably triggered what the first one didn't. We can then assume that H Series TVs (or at least yours) expose the service on port 8000. But it's interesting that you get a
I performed the tests trying with port 8000 and also manually editing the code to make the first request to We can then assume that J Series TVs (or at least mine) don't expose the service on port 8000. I'm only trying to guess, I think it's really difficult to debug these issues, since every device is a little different from the others, and this integration tries to manage all of them. By the way might be interesting and extremely helpful to add to the docs, for each tested device, which port was used for connecting and retrieving the token. 👍🏻 |
Hi @dariob84,
That's strange, I don't see the output which should be generated by that new line. Maybe I was wrong with the line numbers in my previous comment, please make sure the
If you have time please retry, so that we're sure we're having all the same issue. 👍🏻 |
Hi @flostingapplesauce,
There you go! I think we're definitely on the same boat.
Hahah maybe you're right, neither did I! 😆 |
Please recheck in step 3 I am using |
Hi @AKuHAK,
If I'm not wrong this should be the definition of the
So the
|
Yes but I am running if I run |
Hi @AKuHAK,
You're right, I can see the port argument is used in That's interesting. For me running the commands as you described returns Just for testing purposes, could you please run |
Oh, I see, the port is used in 3 places, my mistake.
|
Same. Port 8000 gives me [WinError 10061] No connection could be made because the target machine actively refused it')) and port 8080 returns a 400 error, both with and without that mod to the line after 95. |
Hi @AKuHAK, |
FWIW, mine has: 7011 open. |
Yes, I am logged in with a Samsung account and get Samsung smartthings token as described here: |
@flostingapplesauce thank you very much, we could check which services our devices expose on the network. @flostingapplesauce @dariob84 could you please post the entire output of For my device (UE32J5200):
|
I feel that I need to move my report here from #62 because we already have a lot of similar issues here.
Gives me this output (I've added
I'm getting Connection refused when trying to use 8000 in any case.
I also tried to hardcode
So looks like
I don't have an option to use API token anywhere on TV, but I logged in with Samsung account. Also, I found "Remote control" under "Support" menu. It displays a PIN on the screen to pass it to Samsung Support to enable remote control for them. Not sure if this is the same functionality, but I tried to use that PIN with SmartCrypto by eclair4151 and no luck. Actually, that script always gives me the same output:
And no PIN on TV is displayed. |
Hi @estevez-dev, I can confirm the same behaviour with the SmartCrypto by eclair4151 script. |
@AKuHAK how did you use that token? |
I didn't get it to work, unfortunately. |
bash-5.0# nmap -p- 192.168.75.210 Nmap done: 1 IP address (1 host up) scanned in 39.87 seconds |
C:\temp\samsungtv_encrypted>python get_token.py --ip 192.168.1.31 --port 8080 i ran nmap C:\temp\samsungtv_encrypted>nmap -PN 192.168.1.31 |
Hi everyone,
Interestingly, it states that @AKuHAK's TV series, H4xxx should not be compatible, but he managed to succesfully retrieve the token, since it's device provides the service on port 8000, while ours don't. As stated in the app manual, below the list of compatible devices:
For H and J-Series they provide additional info here:
I think that we can assume that our TVs don't support the remote control feature. We could perform other attempts, trying somehow to open port 8000, but I really doubt this is possible. The only way I can imagine this could work is by editing some settings in the service menu (dangerous, especially without proper documentation) or upgrading the firmware to a version for a supported model (really bad things could happen, and the device could be easily bricked this way). So in the end, I don't think it's worth it. My suggestion is to add an entry in the documentation clearly stating that unfortunately our devices are not compatible. :( |
@AKuHAK after looking at eclair4151's SmartCrypto implementation I can notice that the code uses the hardcoded port 8000 for connecting to the TV. So it seems intentional, and also as you reported, that was the only way you managed to get the pin displayed on the device. Btw, did you manage to get the Home Assistant integration to work with your device, after you had retrieved the token? |
Yes, integration runs just fine, volume control works, source switch works. The only thing that doesnt work is power button, but it is no necessary cause I have broadlink RM. I also integrated curl command that launch YouTube application on my TV. I will later post all modifications that I made with my TV. Maybe some of them will open desired port for you too. I dont think that my tv is so unique in that terms. |
Hi @AKuHAK, |
Thank you EPMatt for all of your work. This is likely not related, but there is an interesting community who work to root some Samsung televisions. Because, of course there would be 😆 |
Hi @EPMatt . Thanks for your investigation. |
I probably found the solution: You need to disable the Watchdog in the Service menu. Details here:
nmap output with watchdog off:
|
Hi @AKuHAK |
Try to log in with developer account: Login: develop, password: any |
if port 8001 is opened this command will launch YouTube on your TV: |
Ok here is my setup (at least what I can remember so far).
|
BTW I performed Smart Hub reset and now I can use both ports: 8080 and 8001 for pairing. Maybe this will help people that have port 8001 closed. But you still need port 8000 opened for WebSocket requests.
Small tip: I managed how to get never expired tokens. Just use any session-id greater than 1. |
@AKuHAK I am working on implementing the SamsungTV J/H model functionnality into Home Assistant core, and I have just now stumbled upon this thread. I am interested to understand what you mean about the session-id. |
@epenet I don't quite remember, but probably I just did 2 pairings in a row. I recommend for proper debugging install root on your testing device: H-J series
|
I don't actually have a H-J model to test with, so I am relying on other users to test it ! If what you say is correct, then maybe we need to adjust the config-flow in |
Good morning,
i tried to take token for my tv (UE40J5200AKXZT) but i recived this:
C:\temp\samsungtv_encrypted>python get_token.py --ip 192.168.1.31 --port 8080
Traceback (most recent call last):
File "C:\Users\dbarb\AppData\Local\Programs\Python\Python38\lib\site-packages\urllib3\connection.py", line 156, in _new_conn
conn = connection.create_connection(
File "C:\Users\dbarb\AppData\Local\Programs\Python\Python38\lib\site-packages\urllib3\util\connection.py", line 84, in create_connection
raise err
File "C:\Users\dbarb\AppData\Local\Programs\Python\Python38\lib\site-packages\urllib3\util\connection.py", line 74, in create_connection
sock.connect(sa)
ConnectionRefusedError: [WinError 10061] Impossibile stabilire la connessione. Rifiuto persistente del computer di destinazione
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Users\dbarb\AppData\Local\Programs\Python\Python38\lib\site-packages\urllib3\connectionpool.py", line 665, in urlopen
httplib_response = self._make_request(
File "C:\Users\dbarb\AppData\Local\Programs\Python\Python38\lib\site-packages\urllib3\connectionpool.py", line 387, in _make_request
conn.request(method, url, **httplib_request_kw)
File "C:\Users\dbarb\AppData\Local\Programs\Python\Python38\lib\http\client.py", line 1230, in request
self._send_request(method, url, body, headers, encode_chunked)
File "C:\Users\dbarb\AppData\Local\Programs\Python\Python38\lib\http\client.py", line 1276, in _send_request
self.endheaders(body, encode_chunked=encode_chunked)
File "C:\Users\dbarb\AppData\Local\Programs\Python\Python38\lib\http\client.py", line 1225, in endheaders
self._send_output(message_body, encode_chunked=encode_chunked)
File "C:\Users\dbarb\AppData\Local\Programs\Python\Python38\lib\http\client.py", line 1004, in _send_output
self.send(msg)
File "C:\Users\dbarb\AppData\Local\Programs\Python\Python38\lib\http\client.py", line 944, in send
self.connect()
File "C:\Users\dbarb\AppData\Local\Programs\Python\Python38\lib\site-packages\urllib3\connection.py", line 184, in connect
conn = self._new_conn()
File "C:\Users\dbarb\AppData\Local\Programs\Python\Python38\lib\site-packages\urllib3\connection.py", line 168, in _new_conn
raise NewConnectionError(
urllib3.exceptions.NewConnectionError: <urllib3.connection.HTTPConnection object at 0x00000257CA59CD00>: Failed to establish a new connection: [WinError 10061] Impossibile stabilire la connessione. Rifiuto persistente del computer di destinazione
can anyone tell me what am i doing wrong?
Thanks
The text was updated successfully, but these errors were encountered: