michaelarnauts / home-assistant-comfoconnect

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

Error adding entity select.comfoairq_ventilation_mode for domain select with platform comfoconnect #40

Closed litinoveweedle closed 4 months ago

litinoveweedle commented 4 months ago

Hello,

I got error when setting ventilation mode/speed. I tried then to restart integration, but it completely lost all sensors. I therefore decided to restart HA. On the HA restart I got error as in title.

HA version: 2024.3.3 Integration version: latest / e7132a7

Logger: homeassistant.components.select
Source: helpers/entity_platform.py:865
integration: Select ([documentation](https://www.home-assistant.io/integrations/select), [issues](https://github.com/home-assistant/core/issues?q=is%3Aissue+is%3Aopen+label%3A%22integration%3A+select%22))
First occurred: 7:21:26 PM (1 occurrences)
Last logged: 7:21:26 PM

Error adding entity select.comfoairq_ventilation_mode for domain select with platform comfoconnect
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 865, in _async_add_entity
    await entity.add_to_platform_finish()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1327, in add_to_platform_finish
    await self.async_added_to_hass()
  File "/config/custom_components/comfoconnect/select.py", line 183, in async_added_to_hass
    await self._ccb.register_sensor(self.entity_description.sensor)
  File "/usr/local/lib/python3.12/site-packages/aiocomfoconnect/comfoconnect.py", line 88, in register_sensor
    await self.cmd_rpdo_request(sensor.id, sensor.type)
  File "/usr/local/lib/python3.12/site-packages/aiocomfoconnect/bridge.py", line 168, in _send
    return await asyncio.wait_for(fut, TIMEOUT)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/asyncio/tasks.py", line 520, in wait_for
    return await fut
           ^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/aiocomfoconnect/bridge.py", line 213, in _read_messages
    message = await self._read()
              ^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/aiocomfoconnect/bridge.py", line 199, in _read
    raise ComfoConnectNotAllowed(message)
aiocomfoconnect.exceptions.ComfoConnectNotAllowed: 00000000000f10158001144fd71e1a2e -> 78799a14781e08bc60aa46fe7c3ecac4: 082710052026 
type: CnRpdoConfirmType
result: NOT_ALLOWED
reference: 38

I am also regularly observing some HA warnings about integration timeouts:

Logger: aiocomfoconnect.bridge
Source: custom_components/comfoconnect/__init__.py:151
integration: Zehnder ComfoAir Q
First occurred: 7:25:01 PM (1 occurrences)
Last logged: 7:25:01 PM

Timeout while waiting for response from bridge

Any ideas? I checked other issues like #33 , #36 but I didn't find any solution.

litinoveweedle commented 4 months ago

In addition even the adding of the select.comfoairq_ventilation_mode supposedly failed during HA start., I have this entity in the HA...

litinoveweedle commented 4 months ago

As well error as bellow keeps appearing after HA restart together (same time and count) with the timeouts warnings

Logger: homeassistant.helpers.entity
Source: helpers/entity.py:945
First occurred: 7:25:01 PM (6 occurrences)
Last logged: 7:50:01 PM

Update for select.comfoairq_balance_mode fails
Traceback (most recent call last):
  File "/usr/local/lib/python3.12/asyncio/tasks.py", line 520, in wait_for
    return await fut
           ^^^^^^^^^
asyncio.exceptions.CancelledError

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

Traceback (most recent call last):
  File "/usr/local/lib/python3.12/site-packages/aiocomfoconnect/bridge.py", line 168, in _send
    return await asyncio.wait_for(fut, TIMEOUT)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/asyncio/tasks.py", line 519, in wait_for
    async with timeouts.timeout(timeout):
  File "/usr/local/lib/python3.12/asyncio/timeouts.py", line 115, in __aexit__
    raise TimeoutError from exc_val
TimeoutError

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

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 945, in async_update_ha_state
    await self.async_device_update()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1262, in async_device_update
    await self.async_update()
  File "/config/custom_components/comfoconnect/select.py", line 199, in async_update
    self._attr_current_option = await self.entity_description.get_value_fn(
                                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/aiocomfoconnect/comfoconnect.py", line 244, in get_balance_mode
    result_06 = await self.cmd_rmi_request(bytes([0x83, UNIT_SCHEDULE, SUBUNIT_06, 0x01]))
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/aiocomfoconnect/bridge.py", line 171, in _send
    raise AioComfoConnectTimeout from exc
aiocomfoconnect.exceptions.AioComfoConnectTimeout
litinoveweedle commented 4 months ago

Just check full HA logs and found this:

2024-03-23 19:34:28.269 INFO (MainThread) [aiocomfoconnect.bridge] The connection was closed.
2024-03-23 19:35:01.702 WARNING (MainThread) [aiocomfoconnect.bridge] Timeout while waiting for response from bridge
2024-03-23 19:35:01.702 ERROR (MainThread) [homeassistant.helpers.entity] Update for select.comfoairq_balance_mode fails

The INFO message about bridge connection close is present always before WARNING and ERROR update. Does it means, that connection is closed (WHY?) but not reestablished automatically till first failed message?

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.