michaelarnauts / home-assistant-comfoconnect

Home Assistant integration for Zehnder ComfoAir trough a Zehnder ComfoConnect LAN C.
Other
26 stars 13 forks source link

ComfoConnect disconnecting. #13

Closed tnagels closed 4 months ago

tnagels commented 1 year ago

Since a few days the integration keeps disconnecting from my Comfocontrol. When I try to set the fan speed, I get an error. Setting the speed with the official app works. After restarting the integration, the comfocontrol is connected again.

EDIT: the problems seem to be intermittent. After a few tries I does work again. About 1/3 of the attempts are succesful.

There is a related error in the log:

Logger: homeassistant.components.websocket_api.http.connection
Source: custom_components/comfoconnect/fan.py:156
Integration: Home Assistant WebSocket API ([documentation](https://www.home-assistant.io/integrations/websocket_api), [issues](https://github.com/home-assistant/home-assistant/issues?q=is%3Aissue+is%3Aopen+label%3A%22integration%3A+websocket_api%22))
First occurred: 25 april 2023 om 23:33:48 (4 occurrences)
Last logged: 11:44:23

[140536807260608]
[140536740357184]
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/websocket_api/commands.py", line 199, in handle_call_service
    await hass.services.async_call(
  File "/usr/src/homeassistant/homeassistant/core.py", line 1820, in async_call
    task.result()
  File "/usr/src/homeassistant/homeassistant/core.py", line 1857, in _execute_service
    await cast(Callable[[ServiceCall], Awaitable[None]], handler.job.target)(
  File "/usr/src/homeassistant/homeassistant/helpers/entity_component.py", line 216, in handle_service
    await service.entity_service_call(
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 798, in entity_service_call
    future.result()  # pop exception if have
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 977, in async_request_call
    await coro
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 838, in _handle_entity_call
    await result
  File "/config/custom_components/comfoconnect/fan.py", line 156, in async_set_percentage
    await self._ccb.set_speed(speed)
  File "/usr/local/lib/python3.10/site-packages/aiocomfoconnect/comfoconnect.py", line 210, in set_speed
    await self.cmd_rmi_request(bytes([0x84, UNIT_SCHEDULE, SUBUNIT_01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x03]))
  File "/usr/local/lib/python3.10/site-packages/aiocomfoconnect/bridge.py", line 320, in cmd_rmi_request
    return self._send(
  File "/usr/local/lib/python3.10/site-packages/aiocomfoconnect/bridge.py", line 123, in _send
    raise AioComfoConnectNotConnected()
aiocomfoconnect.exceptions.AioComfoConnectNotConnected
tnagels commented 1 year ago

UPDATE:

As I could not resolve the issue, I rolled back to the official integration. That integration keeps working. So there seems to be an issue specifically with how this HACS integration handles login and (I assume) token expiry.

michaelarnauts commented 1 year ago

I'm sorry. I've already improved the code in the library and this integration, but didn't came to making a release for this.

tnagels commented 1 year ago

No worries, thanks for the work. Just wanted to help to track down the issue in case you had not found it yet. I'm just grateful people like you are putting in the work to build these great integrations so I would not want to complain if something was not working as expected.

tnagels commented 1 year ago

Has this issue been resolved in a new release? I would like to re-install this component, but only if the issue has been solved. Thanks.

michaelarnauts commented 1 year ago

I just merged a merge request that should improve the reconnection logic a lot. I think this should fix your issue.

michaelarnauts commented 4 months ago

Closing since I want to migrate all these issues in one issue. See https://github.com/michaelarnauts/home-assistant-comfoconnect/issues/43 for a possible solution and follow-up.