siku2 / hass-komfovent-c5

Home Assistant integration for Komfovent C5 air ventilation systems.
MIT License
7 stars 2 forks source link

Failed Setup and AssertionError on Domekt R 400 L-H #14

Open anton4 opened 1 year ago

anton4 commented 1 year ago

I am getting the following error in the logs and setup fails. image

This error originated from a custom integration.

Logger: custom_components.komfovent_c5
Source: custom_components/komfovent_c5/api/client.py:105
Integration: Komfovent C5 (documentation, issues)
First occurred: 22:11:32 (14 occurrences)
Last logged: 22:15:17

Unexpected error fetching komfovent_c5 data:
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 283, in _async_refresh
    self.data = await self._async_update_data()
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/komfovent_c5/__init__.py", line 81, in _async_update_data
    self.__settings = await api.Settings(self.__client).read_all()
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/komfovent_c5/api/settings.py", line 161, in read_all
    registers = await self._client.read_many_u16(
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/komfovent_c5/api/client.py", line 115, in read_many_u16
    await self._read_batch(batch_start, count=batch_end - batch_start)
  File "/config/custom_components/komfovent_c5/api/client.py", line 105, in _read_batch
    assert not response.isError()
AssertionError

I am running Home Assistant version 2023.8.2, but the same error was also with 2023.4, 2023.5, 2023.6, 2023.7. I have tested with 0.26 and 0.33 version of hass-komfovent-c5.

When setting up modbus manually in HA configuration like so, it works:

modbus:
  name: "Komfovent"
  type: tcp
  host: 192.168.5.13
  port: 502
  delay: 2
  retry_on_empty: true
  close_comm_on_error: false
  message_wait_milliseconds: 200

  switches:
    - name: "Komfovent Switch Power"
      slave: 1
      address: 0
      command_on: 1
      command_off: 0

  sensors:
    - name: "Komfovent Start/Stop Status"
      address: 1999
      input_type: holding
      data_type: uint8
      scan_interval: 60
    - name: "Komfovent Current Mode"
      address: 2000
      input_type: holding
      data_type: uint16
      scan_interval: 60
...
siku2 commented 1 year ago

@anton4 this error most likely indicates that the integration is trying to read registers that your device doesn't support. Can you enable debug logging for the integration and then add the full logs here? That will tell us which registers it's trying to read.

anton4 commented 1 year ago

Here is the debug logs: 023-09-05 14:04:42.450 DEBUG (MainThread) [custom_components.komfovent_c5.api.client] connecting to ('192.168.5.13', 502) 2023-09-05 14:04:42.450 DEBUG (MainThread) [pymodbus.logging] Connecting to 192.168.5.13:502. 2023-09-05 14:04:42.450 DEBUG (MainThread) [pymodbus.logging] Connecting comm 2023-09-05 14:04:42.454 DEBUG (MainThread) [pymodbus.logging] Connected to comm 2023-09-05 14:04:42.455 DEBUG (MainThread) [pymodbus.logging] send: 0x0 0x1 0x0 0x0 0x0 0x6 0x0 0x3 0x1 0xc1 0x0 0x26 2023-09-05 14:04:42.455 DEBUG (MainThread) [pymodbus.logging] Adding transaction 1 2023-09-05 14:04:42.456 DEBUG (MainThread) [pymodbus.logging] recv: 0x0 0x1 0x0 0x0 0x0 0x3 0x0 0x83 0x2 2023-09-05 14:04:42.457 DEBUG (MainThread) [pymodbus.logging] recv: 0x0 0x1 0x0 0x0 0x0 0x3 0x0 0x83 0x2 2023-09-05 14:04:42.457 DEBUG (MainThread) [pymodbus.logging] Processing: 0x0 0x1 0x0 0x0 0x0 0x3 0x0 0x83 0x2 2023-09-05 14:04:42.457 DEBUG (MainThread) [pymodbus.logging] Factory Response[131] 2023-09-05 14:04:42.457 DEBUG (MainThread) [pymodbus.logging] Getting transaction 1 2023-09-05 14:04:42.457 ERROR (MainThread) [custom_components.komfovent_c5] Unexpected error fetching komfovent_c5 data: Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 283, in _async_refresh self.data = await self._async_update_data() ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/config/custom_components/komfovent_c5/init.py", line 81, in _async_update_data self.settings = await api.Settings(self.client).read_all() ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/config/custom_components/komfovent_c5/api/settings.py", line 161, in read_all registers = await self._client.read_many_u16( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/config/custom_components/komfovent_c5/api/client.py", line 115, in read_many_u16 await self._read_batch(batch_start, count=batch_end - batch_start) File "/config/custom_components/komfovent_c5/api/client.py", line 105, in _read_batch assert not response.isError() AssertionError 2023-09-05 14:04:42.460 DEBUG (MainThread) [custom_components.komfovent_c5] Finished fetching komfovent_c5 data in 0.010 seconds (success: False) 2023-09-05 14:04:42.460 DEBUG (MainThread) [custom_components.komfovent_c5.api.client] closing the connection 2023-09-05 14:04:42.461 DEBUG (MainThread) [pymodbus.logging] Connection lost comm due to None 2023-09-05 14:04:46.112 DEBUG (SyncWorker_4) [pymodbus.logging] Current transaction state - TRANSACTION_COMPLETE 2023-09-05 14:04:46.112 DEBUG (SyncWorker_4) [pymodbus.logging] Running transaction 3596 2023-09-05 14:04:46.112 DEBUG (SyncWorker_4) [pymodbus.logging] SEND: 0xe 0xc 0x0 0x0 0x0 0x6 0x1 0x4 0x13 0x8f 0x0 0x1 2023-09-05 14:04:46.112 DEBUG (SyncWorker_4) [pymodbus.logging] New Transaction state "SENDING" 2023-09-05 14:04:46.113 DEBUG (SyncWorker_4) [pymodbus.logging] Changing transaction state from "SENDING" to "WAITING FOR REPLY" 2023-09-05 14:04:46.116 DEBUG (SyncWorker_4) [pymodbus.logging] Changing transaction state from "WAITING FOR REPLY" to "PROCESSING REPLY" 2023-09-05 14:04:46.116 DEBUG (SyncWorker_4) [pymodbus.logging] RECV: 0xe 0xc 0x0 0x0 0x0 0x5 0x1 0x4 0x2 0x1 0xa5 2023-09-05 14:04:46.116 DEBUG (SyncWorker_4) [pymodbus.logging] Processing: 0xe 0xc 0x0 0x0 0x0 0x5 0x1 0x4 0x2 0x1 0xa5 2023-09-05 14:04:46.117 DEBUG (SyncWorker_4) [pymodbus.logging] Factory Response[ReadInputRegistersResponse': 4] 2023-09-05 14:04:46.117 DEBUG (SyncWorker_4) [pymodbus.logging] Adding transaction 3596 2023-09-05 14:04:46.117 DEBUG (SyncWorker_4) [pymodbus.logging] Getting transaction 3596 2023-09-05 14:04:46.117 DEBUG (SyncWorker_4) [pymodbus.logging] Changing transaction state from "PROCESSING REPLY" to "TRANSACTION_COMPLETE" 2023-09-05 14:04:46.122 DEBUG (SyncWorker_3) [pymodbus.logging] Current transaction state - TRANSACTION_COMPLETE 2023-09-05 14:04:46.122 DEBUG (SyncWorker_3) [pymodbus.logging] Running transaction 3597 2023-09-05 14:04:46.122 DEBUG (SyncWorker_3) [pymodbus.logging] SEND: 0xe 0xd 0x0 0x0 0x0 0x6 0x1 0x4 0x13 0x92 0x0 0x1 2023-09-05 14:04:46.123 DEBUG (SyncWorker_3) [pymodbus.logging] New Transaction state "SENDING" 2023-09-05 14:04:46.124 DEBUG (SyncWorker_3) [pymodbus.logging] Changing transaction state from "SENDING" to "WAITING FOR REPLY" 2023-09-05 14:04:46.124 DEBUG (SyncWorker_3) [pymodbus.logging] Changing transaction state from "WAITING FOR REPLY" to "PROCESSING REPLY" 2023-09-05 14:04:46.124 DEBUG (SyncWorker_3) [pymodbus.logging] RECV: 0xe 0xd 0x0 0x0 0x0 0x5 0x1 0x4 0x2 0xc 0x38 2023-09-05 14:04:46.125 DEBUG (SyncWorker_3) [pymodbus.logging] Processing: 0xe 0xd 0x0 0x0 0x0 0x5 0x1 0x4 0x2 0xc 0x38 2023-09-05 14:04:46.125 DEBUG (SyncWorker_3) [pymodbus.logging] Factory Response[ReadInputRegistersResponse': 4] 2023-09-05 14:04:46.125 DEBUG (SyncWorker_3) [pymodbus.logging] Adding transaction 3597 2023-09-05 14:04:46.125 DEBUG (SyncWorker_3) [pymodbus.logging] Getting transaction 3597 2023-09-05 14:04:46.125 DEBUG (SyncWorker_3) [pymodbus.logging] Changing transaction state from "PROCESSING REPLY" to "TRANSACTION_COMPLETE" 2023-09-05 14:04:46.130 DEBUG (SyncWorker_10) [pymodbus.logging] Current transaction state - TRANSACTION_COMPLETE 2023-09-05 14:04:46.131 DEBUG (SyncWorker_10) [pymodbus.logging] Running transaction 3598 2023-09-05 14:04:46.131 DEBUG (SyncWorker_10) [pymodbus.logging] SEND: 0xe 0xe 0x0 0x0 0x0 0x6 0x1 0x4 0x13 0x93 0x0 0x1 2023-09-05 14:04:46.131 DEBUG (SyncWorker_10) [pymodbus.logging] New Transaction state "SENDING" 2023-09-05 14:04:46.131 DEBUG (SyncWorker_10) [pymodbus.logging] Changing transaction state from "SENDING" to "WAITING FOR REPLY" 2023-09-05 14:04:46.133 DEBUG (SyncWorker_10) [pymodbus.logging] Changing transaction state from "WAITING FOR REPLY" to "PROCESSING REPLY" 2023-09-05 14:04:46.133 DEBUG (SyncWorker_10) [pymodbus.logging] RECV: 0xe 0xe 0x0 0x0 0x0 0x5 0x1 0x4 0x2 0x0 0x1c 2023-09-05 14:04:46.133 DEBUG (SyncWorker_10) [pymodbus.logging] Processing: 0xe 0xe 0x0 0x0 0x0 0x5 0x1 0x4 0x2 0x0 0x1c 2023-09-05 14:04:46.133 DEBUG (SyncWorker_10) [pymodbus.logging] Factory Response[ReadInputRegistersResponse': 4] 2023-09-05 14:04:46.133 DEBUG (SyncWorker_10) [pymodbus.logging] Adding transaction 3598 2023-09-05 14:04:46.133 DEBUG (SyncWorker_10) [pymodbus.logging] Getting transaction 3598 ....

spectrality-github commented 1 year ago

image I have even much older version REGO-700VE-L-EC-C5 and same problem. Now trying to remove modbus registers one by one from your integration to find which are not available in my unit. At least for now I found that 480-487 are not available for sure.

PS: found list of registers which are probably for my old 2015 C5 version. Will try to remove everything which is not supported and check would this integration will work at all or no. Vortvent-Komfovent-C5-modbus-registerlijst-EN-2015.pdf

siku2 commented 1 year ago

@spectrality-github, thanks for the list. I will go over it as well.

spectrality-github commented 1 year ago

Made few fast changes to remove not supported registers and can confirm that now it working with my old 2015 REGO-700VE-L-EC-C5 image image image image

Also made small change in client.py, as it was not working in latest HA version with updated pymodbus version which don't support anymore params in modbus client image

Maybe you can add option to select version of C5. So we will not need to manually update your integration after each update.

And thank you one more time for such nice and professionally build integration.

siku2 commented 1 year ago

Thanks a lot for your efforts, @spectrality-github. I went ahead and created a new release including the changes. Can you test the new version and let me know how it goes? Same goes for you too, @anton4

spectrality-github commented 1 year ago

New version is working for me out-of-the-box. Thanks

Device info still shows RHP 400 V C5 :) but it it jus cosmetics what don't affect anything. image And I believe my C5 don't provide AHU name.

siku2 commented 1 year ago

I actually removed the model name in the latest version, but existing config entries can only replace it, not remove it. If it bothers you you'll have to re-create the config entry :P

siku2 commented 1 year ago

Can you elaborate on the missing ahu name part though? Is it empty or how can you tell that it's missing?

spectrality-github commented 1 year ago

In my case AHU name contains just "Komfovent" image Thanks

siku2 commented 1 year ago

It's the same for me as well, yeah. I don't think the AHU name is very useful unfortunately.

I'm still waiting for feedback from you, @anton4. I hope this issue can be closed.

anton4 commented 1 year ago

I noticed that your last update requires HA 2023.9 However I am using Sungrow PV inverter integration with HA and at the moment there are modbus issues with 2023.9 version so I am still holding back the upgrade from 2023.8 to 2023.9. Once these modbus issues are sorted out I will upgrade to 2023.9.x and try your fixed version. image

siku2 commented 1 year ago

@anton4, I lowered the required version back down to 2023.08 since the changes I had to make for the new HA version are backwards compatible. Let me know how it goes.

anton4 commented 1 year ago

I am getting this error when trying to install version 0.3.5 and I think it's related to that in github Releases there is Downloads missing for version 0.3.5 (see screenshot attached).


2023-09-13 10:08:12.956 ERROR (MainThread) [homeassistant.components.websocket_api.http.connection] [140628372089152] Error handling message: Unknown error (unknown_error) anton4 from 215.129.19.27 (Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/115.0.0.0 Safari/537.36)
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/websocket_api/decorators.py", line 26, in _handle_async_response
    await func(hass, connection, msg)
  File "/config/custom_components/hacs/websocket/repository.py", line 216, in hacs_repository_download
    await repository.async_install()
  File "/config/custom_components/hacs/repositories/base.py", line 899, in async_install
    await self.async_install_repository()
  File "/config/custom_components/hacs/repositories/base.py", line 995, in async_install_repository
    raise HacsException("Could not download, see log for details")
custom_components.hacs.exceptions.HacsException: Could not download, see log for details```

![image](https://github.com/siku2/hass-komfovent-c5/assets/5539972/5447e57e-cb80-4d1f-a252-9f927bc18c56)
siku2 commented 1 year ago

My bad, it looks like the release automation broke.

siku2 commented 1 year ago

@anton4, really sorry for the delay, but the release should be fixed now.

anton4 commented 1 year ago

Thanks for the fixed release, however I am still getting AssertionError, only the line numbers have changed -

2023-09-14 08:10:37.007 ERROR (MainThread) [custom_components.komfovent_c5] Unexpected error fetching komfovent_c5 data: 
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 283, in _async_refresh
    self.data = await self._async_update_data()
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/komfovent_c5/__init__.py", line 91, in _async_update_data
    return await KomfoventState.read_all(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/komfovent_c5/__init__.py", line 48, in read_all
    monitoring=await api.Monitoring(client).read_all(
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/komfovent_c5/api/monitoring.py", line 335, in read_all
    block1 = await self.read_block1(units=units, is_extended=is_extended)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/komfovent_c5/api/monitoring.py", line 313, in read_block1
    registers = await self._client.read_many_u16(
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/komfovent_c5/api/client.py", line 114, in read_many_u16
    await self._read_batch(batch_start, count=batch_end - batch_start)
  File "/config/custom_components/komfovent_c5/api/client.py", line 104, in _read_batch
    assert not response.isError()
AssertionError