Leggin / dirigera

This repository provides an unofficial Python client for controlling the IKEA Dirigera Smart Home Hub.
MIT License
99 stars 19 forks source link

Unable to connect to hub #54

Closed jspeckman closed 3 months ago

jspeckman commented 3 months ago

Having a problem connecting to the dirigera hub. When running the generate-token script I get a timeout every time.

generate-token 172.16.20.234

Traceback (most recent call last): File "/usr/lib/python3/dist-packages/urllib3/connectionpool.py", line 382, in _make_request self._validate_conn(conn) File "/usr/lib/python3/dist-packages/urllib3/connectionpool.py", line 1012, in _validate_conn conn.connect() File "/usr/lib/python3/dist-packages/urllib3/connection.py", line 411, in connect self.sock = ssl_wrapsocket( File "/usr/lib/python3/dist-packages/urllib3/util/ssl.py", line 453, in ssl_wrap_socket ssl_sock = _ssl_wrap_socket_impl(sock, context, tls_intls) File "/usr/lib/python3/dist-packages/urllib3/util/ssl.py", line 495, in _ssl_wrap_socket_impl return ssl_context.wrap_socket(sock) File "/usr/lib/python3.9/ssl.py", line 500, in wrap_socket return self.sslsocket_class._create( File "/usr/lib/python3.9/ssl.py", line 1040, in _create self.do_handshake() File "/usr/lib/python3.9/ssl.py", line 1309, in do_handshake self._sslobj.do_handshake() socket.timeout: _ssl.c:1106: The handshake operation timed out

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/usr/lib/python3/dist-packages/requests/adapters.py", line 439, in send resp = conn.urlopen( File "/usr/lib/python3/dist-packages/urllib3/connectionpool.py", line 755, in urlopen retries = retries.increment( File "/usr/lib/python3/dist-packages/urllib3/util/retry.py", line 532, in increment raise six.reraise(type(error), error, _stacktrace) File "/usr/lib/python3/dist-packages/six.py", line 719, in reraise raise value File "/usr/lib/python3/dist-packages/urllib3/connectionpool.py", line 699, in urlopen httplib_response = self._make_request( File "/usr/lib/python3/dist-packages/urllib3/connectionpool.py", line 385, in _make_request self._raise_timeout(err=e, url=url, timeout_value=conn.timeout) File "/usr/lib/python3/dist-packages/urllib3/connectionpool.py", line 336, in _raise_timeout raise ReadTimeoutError( urllib3.exceptions.ReadTimeoutError: HTTPSConnectionPool(host='172.16.20.234', port=8443): Read timed out. (read timeout=10)

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/usr/local/bin/generate-token", line 8, in sys.exit(main()) File "/usr/local/lib/python3.9/dist-packages/dirigera/hub/auth.py", line 79, in main code = send_challenge(ip_address, code_verifier) File "/usr/local/lib/python3.9/dist-packages/dirigera/hub/auth.py", line 47, in send_challenge response = requests.get(auth_url, params=params, verify=False, timeout=10) File "/usr/lib/python3/dist-packages/requests/api.py", line 76, in get return request('get', url, params=params, kwargs) File "/usr/lib/python3/dist-packages/requests/api.py", line 61, in request return session.request(method=method, url=url, kwargs) File "/usr/lib/python3/dist-packages/requests/sessions.py", line 542, in request resp = self.send(prep, send_kwargs) File "/usr/lib/python3/dist-packages/requests/sessions.py", line 655, in send r = adapter.send(request, kwargs) File "/usr/lib/python3/dist-packages/requests/adapters.py", line 529, in send raise ReadTimeout(e, request=request) requests.exceptions.ReadTimeout: HTTPSConnectionPool(host='172.16.20.234', port=8443): Read timed out. (read timeout=10)

The ikea app has no problem connecting. I have tried with the ikea app connected, and with the hub removed from the app.

A port scan shows the following: Nmap scan report for 172.16.20.234 Host is up (0.0013s latency). Not shown: 995 filtered tcp ports (no-response) PORT STATE SERVICE 8000/tcp open http-alt 8081/tcp closed blackice-icecap 8082/tcp open blackice-alerts 8443/tcp open https-alt 9000/tcp open cslistener MAC Address: 68:EC:8A:00:8F:61 (Ikea of Sweden AB)

Nmap done: 1 IP address (1 host up) scanned in 8.00 seconds

Any help would be appreciated.

Thanks, Jason

jspeckman commented 3 months ago

Never mind, turned out to be an MTU issue.