Closed EPMatt closed 3 years ago
I have the same issue with UE55H6203AK model.
I'm also getting <Response [403]>
I've tried everything from #61 with reverting latest fixes, changing the port to 8000, but still no luck.
Hi @estevez-dev, could you please post the command you used for retrieving the token, and the output you received?
Hi @EPMatt Sure. I'm using:
python3 ./get_token.py --ip 192.168.2.23 --port 8080
and getting:
<Response [403]>
Traceback (most recent call last):
File "./get_token.py", line 40, in <module>
main(sys.argv[1:])
File "./get_token.py", line 36, in main
PySmartCrypto(ip, port)
File "/home/estevez/src/ha-samsungtv-encrypted/custom_components/samsungtv_encrypted/PySmartCrypto/pysmartcrypto.py", line 124, in __init__
self._connection = self.connect()
File "/home/estevez/src/ha-samsungtv-encrypted/custom_components/samsungtv_encrypted/PySmartCrypto/pysmartcrypto.py", line 100, in connect
connection = websocket.create_connection(websocket_url)
File "/home/estevez/.local/lib/python3.7/site-packages/websocket/_core.py", line 515, in create_connection
websock.connect(url, **options)
File "/home/estevez/.local/lib/python3.7/site-packages/websocket/_core.py", line 226, in connect
self.handshake_response = handshake(self.sock, *addrs, **options)
File "/home/estevez/.local/lib/python3.7/site-packages/websocket/_handshake.py", line 80, in handshake
status, resp = _get_resp_headers(sock)
File "/home/estevez/.local/lib/python3.7/site-packages/websocket/_handshake.py", line 165, in _get_resp_headers
raise WebSocketBadStatusException("Handshake status %d %s", status, status_message, resp_headers)
websocket._exceptions.WebSocketBadStatusException: Handshake status 400 Bad Request
Should I add this info to #21 as well?
Hi @estevez-dev, could you please try to execute the following command? Switching to port 8000.
python3 ./get_token.py --ip 192.168.2.23 --port 8000
Hi @EPMatt
I'm getting Connection refused
when trying to use 8000 in any case.
I tried like this:
python3 ./get_token.py --ip 192.168.2.23 --port 8000
I also tried to hardcode 8000
in connect
function for step4_url
, for websocket_url
and for both. The answer is always the same:
requests.exceptions.ConnectionError: HTTPConnectionPool(host='192.168.2.23', port=8000): Max retries exceeded with url: /socket.io/1/?t=1606845620690 (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x7ae57b664748>: Failed to establish a new connection: [Errno 111] Connection refused'))
So looks like 8000
is not an option for my TV as well.
Hi @estevez-dev, sorry for my delayed response. Could you please try to run the following command and post its entire output? So we can check which ports are opened on your TV.
nmap <your_ip>
Moreover, If you'd like we can move this issue to #21 and keep track of the progress there. :)
Moved to #21.
getting the same thing with my J6200
Hi @sermayoral, I'm trying to connect a UE32J5200 TV with this integration. Unfortunately I'm stuck at the token retrieval.
Running
get_token.py --ip <myip> --port 8080
results in aconnection refused
error. I found that the procedure defined inconnect()
method of thePySmartCrypto
library is using the hardcoded port8000
, so that the port supplied via cli argument is not considered in the pairing section.This issue has been addressed in #61, but I still can't connect to my device. Running
get_token.py --ip <myip> --port 8080
on the PR #61 results in a different error:I tried to debug the issue by myself without success, but I discovered that the value of
websocket_response
after its initialization is<Response [403]>
, while the value ofwebsocket_url
after its initialization iswhich I think it's not what it should be.
So the problem seems to be with the first request receiving a
Forbidden
response at line 95. I'd be glad to help you solving this issue. 👍🏻