siku2 / hass-komfovent-c5

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

Unable to import component #3

Closed colseven closed 2 years ago

colseven commented 2 years ago

Since yesterday there are problems with the recognition of c5 after restarting Home Assistant. Another restart also leads to the error, yesterday I was able to de-energize the RLT system, after which it was recognized by ha after another restart - unfortunately not anymore today. that's the mistake.

`Logger: homeassistant.setup Source: setup.py:162 First occurred: 06:34:35 (1 occurrences) Last logged: 06:34:35

Setup failed for custom integration komfovent_c5: Unable to import component: No module named 'pymodbus.client.asynchronous'`

siku2 commented 2 years ago

Interesting, I haven't encountered anything like this yet. It's possible that you ended up with an incompatible version of pymodbus. Can you check which version you're running?

colseven commented 2 years ago

Okay, how can I check the pymodbus version because - I couldn't find anything.

colseven commented 2 years ago

Problem since HA Version 2022.4 and only after a reboot.

colseven commented 2 years ago

2022-04-12 06:36:56 ERROR (MainThread) [homeassistant.setup] Setup failed for custom integration komfovent_c5: Unable to import component: cannot import name 'is_installed' from 'pymodbus.compat' (/usr/local/lib/python3.9/site-packages/pymodbus/compat.py)

siku2 commented 2 years ago

The existence of the 'compat' module basically confirms that you're running pymodbus 3 rather than the expected pymodbus 2. Im not sure how this happened because pymodbus 3 doesn't even habe a stable release yet. Are you perhaps using another integration which depends on pymodbus?

colseven commented 2 years ago

Good question, actually nothing new. SolarEdge Modbus will probably use it, but I've had it for a long time. Currently I'm helping myself as follows. Make RLT stromloas and restart HA, then it always works - exactly until HA is restarted.

colseven commented 2 years ago

2022-04-15 11:27:38 ERROR (MainThread) [custom_components.komfovent_c5] Unexpected error fetching state data: Modbus Error: [Connection] Connection lost during request Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 190, in _async_refresh self.data = await self._async_update_data() File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 150, in _async_update_data return await self.update_method() File "/config/custom_components/komfovent_c5/__init__.py", line 60, in __fetch_data return await KomfoventState.read_all(self.client, self.settings_state) File "/config/custom_components/komfovent_c5/__init__.py", line 49, in read_all modes=await Modes(client).read_all(), File "/config/custom_components/komfovent_c5/api/modes.py", line 237, in read_all ahu, registers = await asyncio.gather( File "/config/custom_components/komfovent_c5/api/modes.py", line 247, in ahu_on return bool(await self._client.read_u16(self.REG_AHU_ON)) File "/config/custom_components/komfovent_c5/api/client.py", line 55, in read_u16 await protocol.read_holding_registers(address, count=1) File "/usr/local/lib/python3.9/site-packages/pymodbus/client/asynchronous/async_io/__init__.py", line 35, in execute resp = await asyncio.wait_for(req, timeout=self._timeout) File "/usr/local/lib/python3.9/asyncio/tasks.py", line 481, in wait_for return fut.result() pymodbus.exceptions.ConnectionException: Modbus Error: [Connection] Connection lost during request

colseven commented 2 years ago

Failed to connect: [Errno 110] Connect call failed ('192.168.178.50', 502) 06:22:03 – (WARNUNG) /usr/local/lib/python3.9/site-packages/pymodbus/client/asynchronous/async_io/init.py - Die Nachricht ist zum ersten Mal um 13. Mai 2022, 22:01:13 aufgetreten und erscheint 390783 mal

192.168.178.50 is the IP address to my komfovent

siku2 commented 2 years ago

Is something else connecting to your unit using Modbus? Komfovent can only handle a single client at a time. Otherwise, it just looks like your unit is unreachable (wrong IP, firewall, etc.)

colseven commented 2 years ago

The error actually only came up after I connected my solaredge inverter via modbus, which of course has a different IP of its own. Something is wrong, there is no error message with the solaredge add on. what can i do to fix this, because 400000 errors in a few hours can't be healthy.

colseven commented 2 years ago

Mhm, my Komfovent IP is 192.168.178.50 ... why it will connect to 127.0.0.1 ?

2022-05-15 17:01:10 WARNING (MainThread) [pymodbus.client.asynchronous.async_io] Failed to connect: Multiple exceptions: [Errno 111] Connect call failed ('::1', 502, 0, 0), [Errno 111] Connect call failed ('127.0.0.1', 502) 2022-05-15 17:01:10 WARNING (MainThread) [pymodbus.client.asynchronous.async_io] Failed to connect: Multiple exceptions: [Errno 111] Connect call failed ('::1', 502, 0, 0), [Errno 111] Connect call failed ('127.0.0.1', 502) 2022-05-15 17:01:10 WARNING (MainThread) [pymodbus.client.asynchronous.async_io] Failed to connect: Multiple exceptions: [Errno 111] Connect call failed ('::1', 502, 0, 0), [Errno 111] Connect call failed ('127.0.0.1', 502)

siku2 commented 2 years ago

Unless you specifically entered that IP, this integration can't possibly connect to ipv6 loopback and ipv4 loopback. Must have something to do with the solaredge integration.

colseven commented 2 years ago

Great, disable this in Solaredge, reboot and no Error. THX bild 2022-05-15 um 20 27 09

colseven commented 2 years ago

Solved with: update_interval=timedelta(seconds=40), client = await Client.connect(host, port, connect_timeout=35.0)

no errors since yesterday