Almost every time after machine reboot HA boots normally, but EcoFlowCloud crashes with Failed to set up and doesn't reload automatically causing all EcoFlowCloud related automations to fail indefinitely.
Environment
EcoFlowCloud version: v0.13.1 HACS
Home Assistant Core version: 2024.1.3
Steps to reproduce
Reboot the machine sudo restart
Wait for Home Assistant to boot
Navigate to Integrations
Observe EcoFlowCloudFailed to set up
Or:
Cut off the internet from the machine
Restart HA
Navigate to Integrations
Observe EcoFlowCloudFailed to set up
HA logs
2024-02-03 12:19:10.210 ERROR (SyncWorker_9) [pyecobee] Error connecting to ecobee while attempting to refresh tokens. Possible connectivity outage.
HTTPSConnectionPool(host='api.ecobee.com', port=443): Max retries exceeded with url: /token?grant_type=refresh_token&refresh_token=xxx&client_id=yyy (Caused by NewConnectionError('<urllib3.connection.HTTPSConnection object at 0xffff82a58fd0>: Failed to establish a new connection: [Errno -3] Try again'))
2024-02-03 12:19:10.776 ERROR (MainThread) [homeassistant.components.ecobee] Error refreshing ecobee tokens
2024-02-03 12:19:10.783 ERROR (MainThread) [homeassistant.config_entries] Error setting up entry EcoFlow River 2 for ecoflow_cloud
Traceback (most recent call last):
File "/usr/local/lib/python3.11/site-packages/urllib3/connection.py", line 174, in _new_conn
conn = connection.create_connection(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/urllib3/util/connection.py", line 72, in create_connection
for res in socket.getaddrinfo(host, port, family, socket.SOCK_STREAM):
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/socket.py", line 962, 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.11/site-packages/urllib3/connectionpool.py", line 715, in urlopen
httplib_response = self._make_request(
^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/urllib3/connectionpool.py", line 404, in _make_request
self._validate_conn(conn)
File "/usr/local/lib/python3.11/site-packages/urllib3/connectionpool.py", line 1058, in _validate_conn
conn.connect()
File "/usr/local/lib/python3.11/site-packages/urllib3/connection.py", line 363, in connect
self.sock = conn = self._new_conn()
^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/urllib3/connection.py", line 186, in _new_conn
raise NewConnectionError(
urllib3.exceptions.NewConnectionError: <urllib3.connection.HTTPSConnection object at 0xffff7ff5a390>: 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.11/site-packages/requests/adapters.py", line 486, in send
resp = conn.urlopen(
^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/urllib3/connectionpool.py", line 799, in urlopen
retries = retries.increment(
^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/urllib3/util/retry.py", line 592, in increment
raise MaxRetryError(_pool, url, error or ResponseError(cause))
urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='api.ecoflow.com', port=443): Max retries exceeded with url: /auth/login (Caused by NewConnectionError('<urllib3.connection.HTTPSConnection object at 0xffff7ff5a390>: 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/src/homeassistant/homeassistant/config_entries.py", line 406, in async_setup
result = await component.async_setup_entry(hass, self)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/config/custom_components/ecoflow_cloud/__init__.py", line 83, in async_setup_entry
await hass.async_add_executor_job(auth.authorize)
File "/usr/local/lib/python3.11/concurrent/futures/thread.py", line 58, in run
result = self.fn(*self.args, **self.kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/config/custom_components/ecoflow_cloud/mqtt/ecoflow_mqtt.py", line 51, in authorize
request = requests.post(url, json=data, headers=headers)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/requests/api.py", line 115, in post
return request("post", url, data=data, json=json, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/requests/api.py", line 59, in request
return session.request(method=method, url=url, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/requests/sessions.py", line 589, in request
resp = self.send(prep, **send_kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/requests/sessions.py", line 703, in send
r = adapter.send(request, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/requests/adapters.py", line 519, in send
raise ConnectionError(e, request=request)
requests.exceptions.ConnectionError: HTTPSConnectionPool(host='api.ecoflow.com', port=443): Max retries exceeded with url: /auth/login (Caused by NewConnectionError('<urllib3.connection.HTTPSConnection object at 0xffff7ff5a390>: Failed to establish a new connection: [Errno -3] Try again'))
Resolution
To fix the issue I have to manually navigate to Integrations -> EcoFlowCloud -> Reload.
Integration should gracefully reload itself in such a case, otherwise users are stuck with failed automations if they had power off/on while not being able to maintain the system manually (any manual stuff really defeats the purpose of running HomeAssistant).
Hi!
Almost every time after machine reboot HA boots normally, but
EcoFlowCloud
crashes withFailed to set up
and doesn't reload automatically causing all EcoFlowCloud related automations to fail indefinitely.Environment
Steps to reproduce
sudo restart
Integrations
EcoFlowCloud
Failed to set up
Or:
Integrations
EcoFlowCloud
Failed to set up
HA logs
Resolution
To fix the issue I have to manually navigate to Integrations -> EcoFlowCloud -> Reload.
Integration should gracefully reload itself in such a case, otherwise users are stuck with failed automations if they had power off/on while not being able to maintain the system manually (any manual stuff really defeats the purpose of running HomeAssistant).
Thank you for the integration!