niemyjski / homeassistant-kohler

Kohler Integration for Home Assistant
Apache License 2.0
14 stars 3 forks source link

Python errors in log (possibly after HA update) #24

Open euggersh opened 1 year ago

euggersh commented 1 year ago

Seeing a lot of these errors in the Home Assistant log now. I'm not entirely sure, but it could be related to the 2023.6 Home Assistant Core update, which I believe updated Python.

2023-06-17 19:23:48.244 ERROR (MainThread) [homeassistant.helpers.entity] Update for binary_sensor.kohler_shower_status fails 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 95, in create_connection raise err File "/usr/local/lib/python3.11/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.11/site-packages/urllib3/connectionpool.py", line 714, in urlopen httplib_response = self._make_request( ^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/urllib3/connectionpool.py", line 415, in _make_request conn.request(method, url, httplib_request_kw) File "/usr/local/lib/python3.11/site-packages/urllib3/connection.py", line 244, in request super(HTTPConnection, self).request(method, url, body=body, headers=headers) File "/usr/local/lib/python3.11/http/client.py", line 1283, in request self._send_request(method, url, body, headers, encode_chunked) File "/usr/local/lib/python3.11/http/client.py", line 1329, in _send_request self.endheaders(body, encode_chunked=encode_chunked) File "/usr/local/lib/python3.11/http/client.py", line 1278, in endheaders self._send_output(message_body, encode_chunked=encode_chunked) File "/usr/local/lib/python3.11/http/client.py", line 1038, in _send_output self.send(msg) File "/usr/local/lib/python3.11/http/client.py", line 976, in send self.connect() File "/usr/local/lib/python3.11/site-packages/urllib3/connection.py", line 205, in connect conn = self._new_conn() ^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/urllib3/connection.py", line 179, in _new_conn raise ConnectTimeoutError( urllib3.exceptions.ConnectTimeoutError: (, 'Connection to 192.168.1.168 timed out. (connect timeout=0.25)') 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 798, 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: HTTPConnectionPool(host='192.168.1.168', port=80): Max retries exceeded with url: /values.cgi (Caused by ConnectTimeoutError(, 'Connection to 192.168.1.168 timed out. (connect timeout=0.25)')) During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/usr/local/lib/python3.11/site-packages/kohler/kohler.py", line 202, in fetch response = requests.get(url, params=params, timeout=0.250) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/requests/api.py", line 73, in get return request("get", url, params=params, 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 507, in send raise ConnectTimeout(e, request=request) requests.exceptions.ConnectTimeout: HTTPConnectionPool(host='192.168.1.168', port=80): Max retries exceeded with url: /values.cgi (Caused by ConnectTimeoutError(, 'Connection to 192.168.1.168 timed out. (connect timeout=0.25)')) During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 559, in async_update_ha_state await self.async_device_update() File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 786, in async_device_update await hass.async_add_executor_job(self.update) 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/kohler/binary_sensor.py", line 61, in update self._data.updateBinarySensor(self._sensor) File "/config/custom_components/kohler/init.py", line 337, in updateBinarySensor state = self.getValue(sensor.valueKey) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/config/custom_components/kohler/init.py", line 194, in getValue self._updateValues() File "/usr/src/homeassistant/homeassistant/util/init.py", line 190, in wrapper result = method(args, kwargs) ^^^^^^^^^^^^^^^^^^^^^^^ File "/config/custom_components/kohler/init.py", line 185, in _updateValues self._values = self._api.values() ^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/kohler/kohler.py", line 177, in values return self.fetch(url) ^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/kohler/kohler.py", line 208, in fetch responseText = ex.args[0].args[1].line


IndexError: tuple index out of range
niemyjski commented 1 year ago

Looks network related, make sure your shower ip is correct

euggersh commented 1 year ago

The IP is correct and the integration can access the DTV+ despite these errors constantly appearing in the log.

niemyjski commented 1 year ago

The connection is timing out. I'd double check your firewall rules.

euggersh commented 1 year ago

No firewall rules involved since this is all on the internal network. I can access the DTV's web server just fine from a browser. It's only the HA integration that's having issues.

niemyjski commented 1 year ago

Could you try running against the python library directly to connect to it to see if that works fine. For some reason it looks like the timeout is set to 250ms.

euggersh commented 1 year ago

Can you please elaborate on what you mean by "running against the python library directly"? I'm not familiar with how the integration connects to the device.

Thanks.

niemyjski commented 1 year ago

I'd try to run the following library against your shower and see if it connects: https://github.com/niemyjski/kohler-python