stevenjoezhang / hass-iotbull

公牛智家 | Bull IoT for Home Assistant
https://zhangshuqiao.org/2023-02/将公牛智家设备接入Home%20Assistant/
16 stars 3 forks source link

Connection to api.iotbull.com timed out 后不会自动重连 #6

Open Resurrection2981 opened 1 month ago

Resurrection2981 commented 1 month ago

此错误来自自定义集成。

日志记录器: custom_components.bull.api 来源: custom_components/bull/api.py:351 集成: Bull IoT (文档, 问题) 首次出现: 2024年7月7日 19:39:53 (1 次总计出现) 上次记录: 2024年7月7日 19:39:53

Request failed: /v2/home/devices HTTPSConnectionPool(host='api.iotbull.com', port=443): Max retries exceeded with url: /v2/home/devices (Caused by ConnectTimeoutError(<urllib3.connection.HTTPSConnection object at 0x7f109bfefa70>, 'Connection to api.iotbull.com timed out. (connect timeout=10)'))

日志记录器: homeassistant.config_entries 来源: config_entries.py:586 首次出现: 2024年7月7日 19:39:53 (1 次总计出现) 上次记录: 2024年7月7日 19:39:53

Error setting up entry 13395951606 for bull Traceback (most recent call last): File "/usr/local/lib/python3.12/site-packages/urllib3/connection.py", line 174, in _new_conn conn = connection.create_connection( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/urllib3/util/connection.py", line 95, in create_connection raise err File "/usr/local/lib/python3.12/site-packages/urllib3/util/connection.py", line 85, in create_connection sock.connect(sa) TimeoutError: timed out

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/usr/local/lib/python3.12/site-packages/urllib3/connectionpool.py", line 715, in urlopen httplib_response = self._make_request( ^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/urllib3/connectionpool.py", line 404, in _make_request self._validate_conn(conn) File "/usr/local/lib/python3.12/site-packages/urllib3/connectionpool.py", line 1060, in _validate_conn conn.connect() File "/usr/local/lib/python3.12/site-packages/urllib3/connection.py", line 363, in connect self.sock = conn = self._new_conn() ^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/urllib3/connection.py", line 179, in _new_conn raise ConnectTimeoutError( urllib3.exceptions.ConnectTimeoutError: (<urllib3.connection.HTTPSConnection object at 0x7f109bfefa70>, 'Connection to api.iotbull.com timed out. (connect timeout=10)')

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/usr/local/lib/python3.12/site-packages/requests/adapters.py", line 667, in send resp = conn.urlopen( ^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/urllib3/connectionpool.py", line 801, in urlopen retries = retries.increment( ^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/urllib3/util/retry.py", line 594, in increment raise MaxRetryError(_pool, url, error or ResponseError(cause)) urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='api.iotbull.com', port=443): Max retries exceeded with url: /v2/home/devices (Caused by ConnectTimeoutError(<urllib3.connection.HTTPSConnection object at 0x7f109bfefa70>, 'Connection to api.iotbull.com timed out. (connect timeout=10)'))

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/config/custom_components/bull/api.py", line 344, in async_make_request response = await self._hass.async_add_executor_job(func) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/concurrent/futures/thread.py", line 58, in run result = self.fn(*self.args, self.kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/requests/api.py", line 73, in get return request("get", url, params=params, kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/requests/api.py", line 59, in request return session.request(method=method, url=url, kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/requests/sessions.py", line 589, in request resp = self.send(prep, send_kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/requests/sessions.py", line 703, in send r = adapter.send(request, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/requests/adapters.py", line 688, in send raise ConnectTimeout(e, request=request) requests.exceptions.ConnectTimeout: HTTPSConnectionPool(host='api.iotbull.com', port=443): Max retries exceeded with url: /v2/home/devices (Caused by ConnectTimeoutError(<urllib3.connection.HTTPSConnection object at 0x7f109bfefa70>, 'Connection to api.iotbull.com timed out. (connect timeout=10)'))

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/config_entries.py", line 586, in async_setup result = await component.async_setup_entry(hass, self) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/config/custom_components/bull/init.py", line 20, in async_setup_entry await bull_api.async_get_all_devices_list() File "/config/custom_components/bull/api.py", line 214, in async_get_all_devices_list await self.async_get_devices_list() File "/config/custom_components/bull/api.py", line 27, in wrapper res = await func(self, *args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/config/custom_components/bull/api.py", line 197, in async_get_devices_list res = await self.async_make_request( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/config/custom_components/bull/api.py", line 352, in async_make_request raise Exception("connection_failed") Exception: connection_failed

Resurrection2981 commented 1 month ago

不知道为什么我挺频繁出现这个问题,可能是梯子不稳定。 每次出现后,不会自动重连,也没有像 sonoff 或者 bemfa 那样的“重新加载”,只能重启整个HA🥲

stevenjoezhang commented 1 month ago

这个问题我自己倒是也遇到过,我看看怎么处理比较好…