Open seaniedan opened 3 years ago
This means the integration cannot connect to the API server. Most likely an issue with the API server or your network.
Thank you for the reply. No other connection issues with other integrations on homeassistant, and the “home connect” continues to function and report the dishwasher program time.
When I restart the home assistant, the dishwasher reports to homeassistant again. But
after a few days I get this error.
`self._connect() File "/usr/local/lib/python3.8/site-packages/homeconnect/sseclient.py", line 56, in _connect self.resp = requester.get(self.url, stream=True, self.requests_kwargs) File "/usr/local/lib/python3.8/site-packages/requests/sessions.py", line 555, in get return self.request('GET', url, kwargs) File "/usr/local/lib/python3.8/site-packages/requests_oauthlib/oauth2_session.py", line 477, in request url, headers, data = self._client.add_token( File "/usr/local/lib/python3.8/site-packages/oauthlib/oauth2/rfc6749/clients/base.py", line 198, in add_token raise TokenExpiredError() oauthlib.oauth2.rfc6749.errors.TokenExpiredError: (token_expired)
During handling of the above exception, another exception occurred:
Traceback (most recent call last): File "/usr/local/lib/python3.8/site-packages/homeconnect/sseclient.py", line 81, in next next_chunk = next(self.resp_iterator) StopIteration
During handling of the above exception, another exception occurred:
Traceback (most recent call last): File "/usr/local/lib/python3.8/site-packages/homeconnect/api.py", line 226, in _listen for event in sse: File "/usr/local/lib/python3.8/site-packages/homeconnect/sseclient.py", line 91, in next self._connect() File "/usr/local/lib/python3.8/site-packages/homeconnect/sseclient.py", line 56, in _connect self.resp = requester.get(self.url, stream=True, self.requests_kwargs) File "/usr/local/lib/python3.8/site-packages/requests/sessions.py", line 555, in get return self.request('GET', url, kwargs) File "/usr/local/lib/python3.8/site-packages/requests_oauthlib/oauth2_session.py", line 477, in request url, headers, data = self._client.add_token( File "/usr/local/lib/python3.8/site-packages/oauthlib/oauth2/rfc6749/clients/base.py", line 198, in add_token raise TokenExpiredError() oauthlib.oauth2.rfc6749.errors.TokenExpiredError: (token_expired)
During handling of the above exception, another exception occurred:
Traceback (most recent call last): File "/usr/local/lib/python3.8/site-packages/homeconnect/sseclient.py", line 81, in next next_chunk = next(self.resp_iterator) StopIteration
During handling of the above exception, another exception occurred:
Traceback (most recent call last): File "/usr/local/lib/python3.8/site-packages/homeconnect/api.py", line 226, in _listen for event in sse: File "/usr/local/lib/python3.8/site-packages/homeconnect/sseclient.py", line 91, in next self._connect() File "/usr/local/lib/python3.8/site-packages/homeconnect/sseclient.py", line 56, in _connect self.resp = requester.get(self.url, stream=True, self.requests_kwargs) File "/usr/local/lib/python3.8/site-packages/requests/sessions.py", line 555, in get return self.request('GET', url, kwargs) File "/usr/local/lib/python3.8/site-packages/requests_oauthlib/oauth2_session.py", line 477, in request url, headers, data = self._client.add_token( File "/usr/local/lib/python3.8/site-packages/oauthlib/oauth2/rfc6749/clients/base.py", line 198, in add_token raise TokenExpiredError() oauthlib.oauth2.rfc6749.errors.TokenExpiredError: (token_expired)
During handling of the above exception, another exception occurred:
Traceback (most recent call last): File "/usr/local/lib/python3.8/site-packages/urllib3/response.py", line 697, in _update_chunk_length self.chunk_left = int(line, 16) ValueError: invalid literal for int() with base 16: b''
During handling of the above exception, another exception occurred:
Traceback (most recent call last): File "/usr/local/lib/python3.8/site-packages/urllib3/response.py", line 438, in _error_catcher yield File "/usr/local/lib/python3.8/site-packages/urllib3/response.py", line 764, in read_chunked self._update_chunk_length() File "/usr/local/lib/python3.8/site-packages/urllib3/response.py", line 701, in _update_chunk_length raise InvalidChunkLength(self, line) urllib3.exceptions.InvalidChunkLength: InvalidChunkLength(got length b'', 0 bytes read)
During handling of the above exception, another exception occurred:
Traceback (most recent call last): File "/usr/local/lib/python3.8/site-packages/requests/models.py", line 753, in generate for chunk in self.raw.stream(chunk_size, decode_content=True): File "/usr/local/lib/python3.8/site-packages/urllib3/response.py", line 572, in stream for line in self.read_chunked(amt, decode_content=decode_content): File "/usr/local/lib/python3.8/site-packages/urllib3/response.py", line 793, in read_chunked self._original_response.close() File "/usr/local/lib/python3.8/contextlib.py", line 131, in exit self.gen.throw(type, value, traceback) File "/usr/local/lib/python3.8/site-packages/urllib3/response.py", line 455, in _error_catcher raise ProtocolError("Connection broken: %r" % e, e) urllib3.exceptions.ProtocolError: ("Connection broken: InvalidChunkLength(got length b'', 0 bytes read)", InvalidChunkLength(got length b'', 0 bytes read))
During handling of the above exception, another exception occurred:
Traceback (most recent call last): File "/usr/local/lib/python3.8/site-packages/homeconnect/sseclient.py", line 81, in next next_chunk = next(self.resp_iterator) File "/usr/local/lib/python3.8/site-packages/requests/models.py", line 756, in generate raise ChunkedEncodingError(e) requests.exceptions.ChunkedEncodingError: ("Connection broken: InvalidChunkLength(got length b'', 0 bytes read)", InvalidChunkLength(got length b'', 0 bytes read))
The thing with this issue is: even if it’s a connection issue. Shouldn’t this be handled gracefully and retried after say 5 Minutes? (Actually I would recommend 1s, 10s 60s 5m 30m and then 60m intervals)
In case it's useful, here's the latest logs from a home connect integration on Home Assistant that stopped working. It might be chance, but seems to happen ifthe door is opened during the program. `socket.timeout: The read operation timed out
During handling of the above exception, another exception occurred:
Traceback (most recent call last): File "/usr/local/lib/python3.8/site-packages/requests/models.py", line 753, in generate for chunk in self.raw.stream(chunk_size, decode_content=True): File "/usr/local/lib/python3.8/site-packages/urllib3/response.py", line 572, in stream for line in self.read_chunked(amt, decode_content=decode_content): File "/usr/local/lib/python3.8/site-packages/urllib3/response.py", line 793, in read_chunked self._original_response.close() File "/usr/local/lib/python3.8/contextlib.py", line 131, in exit self.gen.throw(type, value, traceback) File "/usr/local/lib/python3.8/site-packages/urllib3/response.py", line 443, in _error_catcher raise ReadTimeoutError(self._pool, None, "Read timed out.") urllib3.exceptions.ReadTimeoutError: HTTPSConnectionPool(host='api.home-connect.com', port=443): Read timed out.
During handling of the above exception, another exception occurred:
Traceback (most recent call last): File "/usr/local/lib/python3.8/site-packages/homeconnect/sseclient.py", line 81, in next next_chunk = next(self.resp_iterator) File "/usr/local/lib/python3.8/site-packages/requests/models.py", line 760, in generate raise ConnectionError(e) requests.exceptions.ConnectionError: HTTPSConnectionPool(host='api.home-connect.com', port=443): Read timed out.
During handling of the above exception, another exception occurred:
Traceback (most recent call last): File "/usr/local/lib/python3.8/site-packages/urllib3/connection.py", line 169, in _new_conn conn = connection.create_connection( File "/usr/local/lib/python3.8/site-packages/urllib3/util/connection.py", line 73, in create_connection for res in socket.getaddrinfo(host, port, family, socket.SOCK_STREAM): File "/usr/local/lib/python3.8/socket.py", line 918, in getaddrinfo for res in _socket.getaddrinfo(host, port, family, type, proto, flags): socket.gaierror: [Errno -3] Try again
During handling of the above exception, another exception occurred:
Traceback (most recent call last): File "/usr/local/lib/python3.8/site-packages/urllib3/connectionpool.py", line 699, in urlopen httplib_response = self._make_request( File "/usr/local/lib/python3.8/site-packages/urllib3/connectionpool.py", line 382, in _make_request self._validate_conn(conn) File "/usr/local/lib/python3.8/site-packages/urllib3/connectionpool.py", line 1010, in _validate_conn conn.connect() File "/usr/local/lib/python3.8/site-packages/urllib3/connection.py", line 353, in connect conn = self._new_conn() File "/usr/local/lib/python3.8/site-packages/urllib3/connection.py", line 181, in _new_conn raise NewConnectionError( urllib3.exceptions.NewConnectionError: <urllib3.connection.HTTPSConnection object at 0xaa10dd48>: Failed to establish a new connection: [Errno -3] Try again
During handling of the above exception, another exception occurred:
Traceback (most recent call last): File "/usr/local/lib/python3.8/site-packages/requests/adapters.py", line 439, in send resp = conn.urlopen( File "/usr/local/lib/python3.8/site-packages/urllib3/connectionpool.py", line 755, in urlopen retries = retries.increment( File "/usr/local/lib/python3.8/site-packages/urllib3/util/retry.py", line 573, in increment raise MaxRetryError(_pool, url, error or ResponseError(cause)) urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='api.home-connect.com', port=443): Max retries exceeded with url: /api/homeappliances/400070520344025240/events (Caused by NewConnectionError('<urllib3.connection.HTTPSConnection object at 0xaa10dd48>: Failed to establish a new connection: [Errno -3] Try again'))
During handling of the above exception, another exception occurred:
Traceback (most recent call last): File "/usr/local/lib/python3.8/threading.py", line 932, in _bootstrap_inner self.run() File "/usr/local/lib/python3.8/threading.py", line 870, in run self._target(*self._args, self._kwargs) File "/usr/local/lib/python3.8/site-packages/homeconnect/api.py", line 236, in _listen self._listen(sse, callback=callback) File "/usr/local/lib/python3.8/site-packages/homeconnect/api.py", line 236, in _listen self._listen(sse, callback=callback) File "/usr/local/lib/python3.8/site-packages/homeconnect/api.py", line 236, in _listen self._listen(sse, callback=callback) [Previous line repeated 30 more times] File "/usr/local/lib/python3.8/site-packages/homeconnect/api.py", line 226, in _listen for event in sse: File "/usr/local/lib/python3.8/site-packages/homeconnect/sseclient.py", line 91, in next self._connect() File "/usr/local/lib/python3.8/site-packages/homeconnect/sseclient.py", line 56, in _connect self.resp = requester.get(self.url, stream=True, self.requests_kwargs) File "/usr/local/lib/python3.8/site-packages/requests/sessions.py", line 555, in get return self.request('GET', url, kwargs) File "/usr/local/lib/python3.8/site-packages/requests_oauthlib/oauth2_session.py", line 515, in request return super(OAuth2Session, self).request( File "/usr/local/lib/python3.8/site-packages/requests/sessions.py", line 542, in request resp = self.send(prep, send_kwargs) File "/usr/local/lib/python3.8/site-packages/requests/sessions.py", line 655, in send r = adapter.send(request, **kwargs) File "/usr/local/lib/python3.8/site-packages/requests/adapters.py", line 516, in send raise ConnectionError(e, request=request) requests.exceptions.ConnectionError: HTTPSConnectionPool(host='api.home-connect.com', port=443): Max retries exceeded with url: /api/homeappliances/400070520344025240/events (Caused by NewConnectionError('<urllib3.connection.HTTPSConnection object at 0xaa10dd48>: Failed to establish a new connection: [Errno -3] Try again')) 2021-03-23 02:21:15 ERROR (MainThread) [homeassistant.components.coronavirus] Error requesting coronavirus data: Cannot connect to host coronacache.home-assistant.io:443 ssl:default [Try again] 2021-03-23 02:21:41 ERROR (MainThread) [luftdaten] Can not load data from luftdaten.info 2021-03-23 02:21:41 ERROR (MainThread) [homeassistant.components.luftdaten] Unable to retrieve data from luftdaten.info 2021-03-23 18:45:03 WARNING (SyncWorker_1) [homeconnect] Token expired. 2021-03-23 18:45:05 ERROR (MainThread) [homeassistant.components.home_connect.switch] Error while trying to stop program: {'key': 'SDK.Error.WrongOperationState', 'description': 'Request cannot be performed since OperationState is not DelayedStart or Run'}`
Does anyone have a hint for me? Everything else on my network e.g. Home Assistant is working fine reading URLs from other integrations.
Still restarting HA because this integration fails with
File "/usr/local/lib/python3.8/site-packages/oauthlib/oauth2/rfc6749/clients/base.py", line 198, in add_token
raise TokenExpiredError()
oauthlib.oauth2.rfc6749.errors.TokenExpiredError: (token_expired)
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/local/lib/python3.8/site-packages/homeconnect/sseclient.py", line 81, in __next__
next_chunk = next(self.resp_iterator)
StopIteration
I suspect the code needs to refresh the token, as per this issue - token not renewing #116 - lots of examples here of how to fix, if anyone has the ability/if David is accepting pull requests: https://www.programcreek.com/python/example/105352/oauthlib.oauth2.TokenExpiredError
Similar issues here. Seems to only work occasionally at best.
Even when I now restart HA I directly receive an error regarding token expiration. No correct status is being delivered to my HA.
2021-04-16 13:21:38 WARNING (SyncWorker_5) [homeconnect] Token expired. 2021-04-16 13:21:43 ERROR (MainThread) [homeassistant.config_entries] Error sett ing up entry Configuration.yaml for home_connect File "/usr/local/lib/python3.8/site-packages/aiohttp/connector.py", line 999, in _create_direct_connection File "/usr/local/lib/python3.8/site-packages/aiohttp/connector.py", line 865, in _resolve_host File "/usr/src/homeassistant/homeassistant/components/home_connect/__init__.py ", line 72, in async_setup_entry File "/usr/src/homeassistant/homeassistant/components/home_connect/__init__.py ", line 104, in update_all_devices File "/usr/src/homeassistant/homeassistant/components/home_connect/api.py", li ne 69, in get_devices File "/usr/local/lib/python3.8/site-packages/homeconnect/api.py", line 129, in get_appliances File "/usr/local/lib/python3.8/site-packages/homeconnect/api.py", line 79, in get File "/usr/local/lib/python3.8/site-packages/homeconnect/api.py", line 73, in request File "/usr/src/homeassistant/homeassistant/components/home_connect/api.py", li ne 61, in refresh_tokens
As stated in the other issue: token refresh is handled by Home Assistant core, so this repository is the wrong place to report issues with it, unless you have a reason to expect that something specific to this beta version is causing the issue.
I'm still not closing this issue because the graceful reconnects suggested above would be a useful improvement. But I don't expect to have time working on it.
Do you know where I could report this on the HA side? Is it the same as this issue ?
No, looks like a different issue. Not sure what you mean be "where you could report it", as an issue obviously...
I’m not sure how to report it. You say “it’s not an issue with my software, it’s home assistant core”. I just don’t know where to begin. Is there any chance you could create the correct issue with them and I could follow it up? All I know is that my dishwasher is saying “program ready to start”, and I’m getting lots of errors about tokens.
I'm having this problem too.
After a few days of working fine, I get:
During handling of the above exception, another exception occurred:
Traceback (most recent call last): File "/usr/local/lib/python3.8/site-packages/homeconnect/sseclient.py", line 81, in next next_chunk = next(self.resp_iterator) File "/usr/local/lib/python3.8/site-packages/requests/models.py", line 760, in generate raise ConnectionError(e) requests.exceptions.ConnectionError: HTTPSConnectionPool(host='api.home-connect.com', port=443): Read timed out.
During handling of the above exception, another exception occurred:
Traceback (most recent call last): File "/usr/local/lib/python3.8/site-packages/urllib3/connection.py", line 169, in _new_conn conn = connection.create_connection( File "/usr/local/lib/python3.8/site-packages/urllib3/util/connection.py", line 73, in create_connection for res in socket.getaddrinfo(host, port, family, socket.SOCK_STREAM): File "/usr/local/lib/python3.8/socket.py", line 918, in getaddrinfo for res in _socket.getaddrinfo(host, port, family, type, proto, flags): socket.gaierror: [Errno -3] Try again
During handling of the above exception, another exception occurred:
Traceback (most recent call last): File "/usr/local/lib/python3.8/site-packages/urllib3/connectionpool.py", line 699, in urlopen httplib_response = self._make_request( File "/usr/local/lib/python3.8/site-packages/urllib3/connectionpool.py", line 382, in _make_request self._validate_conn(conn) File "/usr/local/lib/python3.8/site-packages/urllib3/connectionpool.py", line 1010, in _validate_conn conn.connect() File "/usr/local/lib/python3.8/site-packages/urllib3/connection.py", line 353, in connect conn = self._new_conn() File "/usr/local/lib/python3.8/site-packages/urllib3/connection.py", line 181, in _new_conn raise NewConnectionError( urllib3.exceptions.NewConnectionError: <urllib3.connection.HTTPSConnection object at 0xac0b9700>: Failed to establish a new connection: [Errno -3] Try again
During handling of the above exception, another exception occurred:
Traceback (most recent call last): File "/usr/local/lib/python3.8/site-packages/requests/adapters.py", line 439, in send resp = conn.urlopen( File "/usr/local/lib/python3.8/site-packages/urllib3/connectionpool.py", line 755, in urlopen retries = retries.increment( File "/usr/local/lib/python3.8/site-packages/urllib3/util/retry.py", line 573, in increment raise MaxRetryError(_pool, url, error or ResponseError(cause)) urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='api.home-connect.com', port=443): Max retries exceeded with url: /api/homeappliances/400070520344025240/events (Caused by NewConnectionError('<urllib3.connection.HTTPSConnection object at 0xac0b9700>: Failed to establish a new connection: [Errno -3] Try again'))
During handling of the above exception, another exception occurred:
Traceback (most recent call last): File "/usr/local/lib/python3.8/threading.py", line 932, in _bootstrap_inner self.run() File "/usr/local/lib/python3.8/threading.py", line 870, in run self._target(*self._args, self._kwargs) File "/usr/local/lib/python3.8/site-packages/homeconnect/api.py", line 236, in _listen self._listen(sse, callback=callback) File "/usr/local/lib/python3.8/site-packages/homeconnect/api.py", line 236, in _listen self._listen(sse, callback=callback) File "/usr/local/lib/python3.8/site-packages/homeconnect/api.py", line 236, in _listen self._listen(sse, callback=callback) [Previous line repeated 8 more times] File "/usr/local/lib/python3.8/site-packages/homeconnect/api.py", line 226, in _listen for event in sse: File "/usr/local/lib/python3.8/site-packages/homeconnect/sseclient.py", line 91, in next self._connect() File "/usr/local/lib/python3.8/site-packages/homeconnect/sseclient.py", line 56, in _connect self.resp = requester.get(self.url, stream=True, self.requests_kwargs) File "/usr/local/lib/python3.8/site-packages/requests/sessions.py", line 555, in get return self.request('GET', url, kwargs) File "/usr/local/lib/python3.8/site-packages/requests_oauthlib/oauth2_session.py", line 515, in request return super(OAuth2Session, self).request( File "/usr/local/lib/python3.8/site-packages/requests/sessions.py", line 542, in request resp = self.send(prep, send_kwargs) File "/usr/local/lib/python3.8/site-packages/requests/sessions.py", line 655, in send r = adapter.send(request, **kwargs) File "/usr/local/lib/python3.8/site-packages/requests/adapters.py", line 516, in send raise ConnectionError(e, request=request) requests.exceptions.ConnectionError: HTTPSConnectionPool(host='api.home-connect.com', port=443): Max retries exceeded with url: /api/homeappliances/400070520344025240/events (Caused by NewConnectionError('<urllib3.connection.HTTPSConnection object at 0xac0b9700>: Failed to establish a new connection: [Errno -3] Try again'))
The only workaround I have found is to continually restart home assistant.