asantaga / wiserHomeAssistantPlatform

Platform and related climate/sensors to support the Drayton Wiser Home Heating System
MIT License
240 stars 44 forks source link

Communication error #411

Closed LGO44 closed 9 months ago

LGO44 commented 11 months ago

I 've a new issue

logs

2023-12-11 21:21:23.102 ERROR (MainThread) [custom_components.wiser.coordinator] peer closed connection without sending complete message body (incomplete chunked read) 2023-12-11 21:21:23.102 ERROR (MainThread) [custom_components.wiser.coordinator] Unexpected error fetching wiser (wiser-WiserHeat03F9E3) data: peer closed connection without sending complete message body (incomplete chunked read) Traceback (most recent call last): File "/usr/local/lib/python3.11/site-packages/httpcore/_exceptions.py", line 10, in map_exceptions yield File "/usr/local/lib/python3.11/site-packages/httpcore/_async/http11.py", line 209, in _receive_event event = self._h11_state.next_event() ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/h11/_connection.py", line 469, in next_event event = self._extract_next_receive_event() ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/h11/_connection.py", line 419, in _extract_next_receive_event event = self._reader.read_eof() # type: ignore[attr-defined] ^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/h11/_readers.py", line 204, in read_eof raise RemoteProtocolError( h11._util.RemoteProtocolError: peer closed connection without sending complete message body (incomplete chunked read)

The above exception was the direct cause of the following exception:

Traceback (most recent call last): File "/usr/local/lib/python3.11/site-packages/httpx/_transports/default.py", line 66, in map_httpcore_exceptions yield File "/usr/local/lib/python3.11/site-packages/httpx/_transports/default.py", line 249, in aiter async for part in self._httpcore_stream: File "/usr/local/lib/python3.11/site-packages/httpcore/_async/connection_pool.py", line 347, in aiter async for part in self._stream: File "/usr/local/lib/python3.11/site-packages/httpcore/_async/http11.py", line 337, in aiter raise exc File "/usr/local/lib/python3.11/site-packages/httpcore/_async/http11.py", line 329, in aiter async for chunk in self._connection._receive_response_body(**kwargs): File "/usr/local/lib/python3.11/site-packages/httpcore/_async/http11.py", line 198, in _receive_response_body event = await self._receive_event(timeout=timeout) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/httpcore/_async/http11.py", line 208, in _receive_event with map_exceptions({h11.RemoteProtocolError: RemoteProtocolError}): File "/usr/local/lib/python3.11/contextlib.py", line 155, in exit self.gen.throw(typ, value, traceback) File "/usr/local/lib/python3.11/site-packages/httpcore/_exceptions.py", line 14, in map_exceptions raise to_exc(exc) from exc httpcore.RemoteProtocolError: peer closed connection without sending complete message body (incomplete chunked read)

The above exception was the direct cause of the following exception:

Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 300, in _async_refresh self.data = await self._async_update_data() ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 256, in _async_update_data return await self.update_method() ^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/config/custom_components/wiser/coordinator.py", line 159, in async_update_data raise ex File "/config/custom_components/wiser/coordinator.py", line 137, in async_update_data await self.wiserhub.read_hub_data() File "/usr/local/lib/python3.11/site-packages/aioWiserHeatAPI/wiserhub.py", line 126, in read_hub_data await self._build_objects() File "/usr/local/lib/python3.11/site-packages/aioWiserHeatAPI/wiserhub.py", line 140, in _build_objects self._domain_data = await self._wiser_rest_controller._get_hub_data( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/aioWiserHeatAPI/rest_controller.py", line 164, in _get_hub_data return await self._do_hub_action( ^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/aioWiserHeatAPI/rest_controller.py", line 107, in _do_hub_action response = await getattr(client, action.value)( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/httpx/_client.py", line 1757, in get return await self.request( ^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/httpx/_client.py", line 1530, in request return await self.send(request, auth=auth, follow_redirects=follow_redirects) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/httpx/_client.py", line 1631, in send raise exc File "/usr/local/lib/python3.11/site-packages/httpx/_client.py", line 1625, in send await response.aread() File "/usr/local/lib/python3.11/site-packages/httpx/_models.py", line 909, in aread self._content = b"".join([part async for part in self.aiter_bytes()]) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/httpx/_models.py", line 909, in self._content = b"".join([part async for part in self.aiter_bytes()]) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/httpx/_models.py", line 927, in aiter_bytes async for raw_bytes in self.aiter_raw(): File "/usr/local/lib/python3.11/site-packages/httpx/_models.py", line 985, in aiter_raw async for raw_stream_bytes in self.stream: File "/usr/local/lib/python3.11/site-packages/httpx/_client.py", line 146, in aiter async for chunk in self._stream: File "/usr/local/lib/python3.11/site-packages/httpx/_transports/default.py", line 248, in aiter with map_httpcore_exceptions(): File "/usr/local/lib/python3.11/contextlib.py", line 155, in exit self.gen.throw(typ, value, traceback) File "/usr/local/lib/python3.11/site-packages/httpx/_transports/default.py", line 83, in map_httpcore_exceptions raise mapped_exc(message) from exc httpx.RemoteProtocolError: peer closed connection without sending complete message body (incomplete chunked read)

Wiser configuration: image

Core 2023.12.1 Supervisor 2023.11.6 Operating System 11.2 Interface utilisateur 20231208.2

steleebrooks commented 11 months ago

I also have a similar error following the recent update.

Hub reset, attempted to rollback the integration but same error exists, was working fine before

Below is the rerror that I am seeing -

Logger: custom_components.wiser.coordinator Source: custom_components/wiser/coordinator.py:155 Integration: Drayton Wiser Integration for Home Assistant (documentation, issues) First occurred: 13:34:53 (31 occurrences) Last logged: 13:54:40

Connection error trying to communicate with Wiser Hub 192.168.1.128 for url http://192.168.1.128:80/data/v2/domain/. Error is All connection attempts failed

Wiser Hub firmware version

3.14.0

System info

Core 2023.12.1 Supervisor 2023.11.6 Operating System 11.2 Frontend 20231208.2

msp1974 commented 11 months ago

Is this all the time or occasionally?

LGO44 commented 11 months ago

This happens occasionally once or twice per day

bangcrash commented 11 months ago

I have not yet updated to 3.4.1 and I'm having the same problem with version 3.3.11. The strange part is that if I send a command to the Away Mode switch an error is logged but the command successfully changes the state of the switch. I'm using NodeRed and the error is:

"Call-service error. Response error trying to communicate with Wiser Hub <Hub_IP> for url http://<Hub_IP>:80/data/v2/domain/System. Error is 400, message="Data afterConnection: close:\n\n b'0'\n ^", url=URL('http://<Hub_IP>:80/data/v2/domain/System')"

The error in HA is:

`Logger: homeassistant.components.websocket_api.http.connection Source: components/websocket_api/commands.py:238 Integration: Home Assistant WebSocket API (documentation, issues) First occurred: 12:43:05 (3 occurrences) Last logged: 12:45:26

[139732725383232] Response error trying to communicate with Wiser Hub for url http://:80/data/v2/domain/System. Error is 400, message="Data after Connection: close:\n\n b'0'\n ^", url=URL('http://:80/data/v2/domain/System') Traceback (most recent call last): File "/usr/local/lib/python3.11/site-packages/aiohttp/client_reqrep.py", line 965, in start message, payload = await protocol.read() # type: ignore[union-attr] ^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/aiohttp/streams.py", line 622, in read await self._waiter File "/usr/local/lib/python3.11/site-packages/aiohttp/client_proto.py", line 224, in data_received messages, upgraded, tail = self._parser.feed_data(data) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "aiohttp/_http_parser.pyx", line 557, in aiohttp._http_parser.HttpParser.feed_data aiohttp.http_exceptions.BadHttpMessage: 400, message: Data after Connection: close:

b'0'
   ^

The above exception was the direct cause of the following exception:

Traceback (most recent call last): File "/usr/local/lib/python3.11/site-packages/aioWiserHeatAPI/rest_controller.py", line 112, in _do_hub_action await getattr(self._session, action.value)( File "/usr/local/lib/python3.11/site-packages/aiohttp/client.py", line 601, in _request await resp.start(conn) File "/usr/local/lib/python3.11/site-packages/aiohttp/client_reqrep.py", line 967, in start raise ClientResponseError( aiohttp.client_exceptions.ClientResponseError: 400, message="Data after Connection: close:\n\n b'0'\n ^", url=URL('http://<>:80/data/v2/domain/System')

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/components/websocket_api/commands.py", line 238, in handle_call_service response = await hass.services.async_call( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/core.py", line 2067, in async_call response_data = await coro ^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/core.py", line 2104, in _execute_service return await target(service_call) ^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/helpers/entity_component.py", line 272, in handle_service return await service.entity_service_call( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 878, in entity_service_call single_response = await _handle_entity_call( ^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 948, in _handle_entity_call result = await task ^^^^^^^^^^ File "/config/custom_components/wiser/switch.py", line 243, in async_turn_on await fn(True) File "/usr/local/lib/python3.11/site-packages/aioWiserHeatAPI/system.py", line 130, in set_away_mode_enabled if await self._send_command({"RequestOverride": {"Type": 2 if enabled else 0}}): ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/aioWiserHeatAPI/system.py", line 101, in _send_command result = await self._wiser_rest_controller._send_command(WISERSYSTEM, cmd) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/aioWiserHeatAPI/rest_controller.py", line 208, in _send_command return await self._do_hub_action(method, url, command_data) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/aioWiserHeatAPI/rest_controller.py", line 136, in _do_hub_action raise WiserHubConnectionError( aioWiserHeatAPI.exceptions.WiserHubConnectionError: Response error trying to communicate with Wiser Hub for url http://:80/data/v2/domain/System. Error is 400, message="Data after Connection: close:\n\n b'0'\n ^", url=URL('http://:80/data/v2/domain/System')`

msp1974 commented 11 months ago

@bangcrash if you are on HA2023.12.x you have to upgrade to at least 3.4 of the integration. There still seems to be the odd person having issues with this but HA2023.12 broke the integration on v3.3.11 and below.

bangcrash commented 11 months ago

@msp1974 Thanks very much. I am on 2023.12.x so I have just upgraded to 3.4 and it has solved the problem.

msp1974 commented 11 months ago

@LGO44 - I have worked out how to fix what HA2023.12 broke with aiohttp and reverted to using this in v3.4.2 (just released). Can you please install this version and tell me if you still get these errors. Thanks

LGO44 commented 11 months ago

@msp1974 , since I have installed the V3.4.2 this afternoon, I got no error . I've update also the core to the version 2023.12.4

I think that you forget to update the manifest.json by this version.

msp1974 commented 11 months ago

You're right and also the version in const.py. Too much Xmas sherry me thinks! 😀

LGO44 commented 11 months ago

You're right and also the version in const.py. Too much Xmas sherry me thinks! 😀

Yes perhaps, but it only happens to those who are alive.

msp1974 commented 9 months ago

Closing as released v3.4.3 which correctly set versions.