home-assistant / core

:house_with_garden: Open source home automation that puts local control and privacy first.
https://www.home-assistant.io
Apache License 2.0
73.72k stars 30.84k forks source link

Unexpected error fetching Nibe Heat Pump data #118598

Closed m-wo closed 3 months ago

m-wo commented 5 months ago

The problem

Lately, not sure if related to a HA update but I haven‘t read any changes in the changelogs, I have trouble with my Nibe Heat Pump integration that cannot read data anymore via modbus tcp. Double checked connectivity and everything, device is up2date as well.

Error from the logs:

Logger: homeassistant.components.nibe_heatpump Source: helpers/update_coordinator.py:315 integration: Nibe Heat Pump (documentation, issues) First occurred: 09:04:00 (3 occurrences) Last logged: 09:06:00

Unexpected error fetching Nibe Heat Pump data Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 315, in _async_refresh self.data = await self._async_update_data() ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/components/nibe_heatpump/coordinator.py", line 155, in _async_update_data return await self._async_update_data_internal() ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/components/nibe_heatpump/coordinator.py", line 177, in _async_update_data_internal async for data in self.connection.read_coils(_get_coils()): File "/usr/local/lib/python3.12/site-packages/nibe/connection/init.py", line 43, in read_coils yield await self.read_coil(coil, timeout) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/tenacity/_asyncio.py", line 142, in async_wrapped return await fn(*args, kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/tenacity/_asyncio.py", line 58, in call do = await self.iter(retry_state=retry_state) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/tenacity/_asyncio.py", line 110, in iter result = await action(retry_state) ^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/tenacity/_asyncio.py", line 78, in inner return fn(*args, *kwargs) ^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/tenacity/init.py", line 390, in self._add_action_func(lambda rs: rs.outcome.result()) ^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/concurrent/futures/_base.py", line 449, in result return self.get_result() ^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/concurrent/futures/_base.py", line 401, in get_result raise self._exception File "/usr/local/lib/python3.12/site-packages/tenacity/_asyncio.py", line 61, in call result = await fn(args, kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/nibe/connection/modbus.py", line 85, in read_coil result = await self._client.read_input_registers( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/async_modbus/core.py", line 194, in read_input_registers return await self._send_message(request) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/async_modbus/core.py", line 142, in _send_message return await self.protocol._async_send_message( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/async_modbus/core.py", line 42, in send_message_tcp response_error_adu = await reader.readexactly(exception_adu_size) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/sockio/aio.py", line 36, in wrapper return await coro ^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/sockio/aio.py", line 383, in readexactly return await self._readexactly(n) ^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/sockio/aio.py", line 50, in wrapper reply = await f(self, *args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/sockio/aio.py", line 331, in _readexactly return await self.reader.readexactly(n) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/asyncio/streams.py", line 750, in readexactly raise exceptions.IncompleteReadError(incomplete, n) asyncio.exceptions.IncompleteReadError: 0 bytes read on a total of 9 expected bytes

What version of Home Assistant Core has the issue?

core-2024.5.5

What was the last working version of Home Assistant Core?

core-2024.4

What type of installation are you running?

Home Assistant OS

Integration causing the issue

nibe_heatpump

Link to integration documentation on our website

https://www.home-assistant.io/integrations/nibe_heatpump/

Diagnostics information

No response

Example YAML snippet

No response

Anything in the logs that might be useful for us?

No response

Additional information

No response

home-assistant[bot] commented 5 months ago

Hey there @elupus, mind taking a look at this issue as it has been labeled with an integration (nibe_heatpump) you are listed as a code owner for? Thanks!

Code owner commands Code owners of `nibe_heatpump` can trigger bot actions by commenting: - `@home-assistant close` Closes the issue. - `@home-assistant rename Awesome new title` Renames the issue. - `@home-assistant reopen` Reopen the issue. - `@home-assistant unassign nibe_heatpump` Removes the current integration label and assignees on the issue, add the integration domain after the command. - `@home-assistant add-label needs-more-information` Add a label (needs-more-information, problem in dependency, problem in custom component) to the issue. - `@home-assistant remove-label needs-more-information` Remove a label (needs-more-information, problem in dependency, problem in custom component) on the issue.

(message by CodeOwnersMention)


nibe_heatpump documentation nibe_heatpump source (message by IssueLinks)

elupus commented 5 months ago

Start be rebooting the heatpump and disabling all entities in HA. The new firmwares are known for having several crashing bugs on modbus.

Then enable entities a few at a time.

Shuties commented 5 months ago

I have the same issue, the heatpump becomes unavailable after some time, and randomly it pops back up. maybe once every other day. Rebooting the heatpump and disabling all entities in HA cannot be a long term solution? If i'm away i would ofcourse like to monitor my heatpump, and this makes it impossible. Is it problem in the NIBE firmware or the integration? Using a S1256 with version 2.27.5

Logbook looks the same as OP's. Latest HA versions installed on home assistant green.

elupus commented 5 months ago

There is problems with firmware on the pumps. We should not be able to crash them by reading parameters from them. Even if we did do something wrong, they should not crash like they do.

Sometimes its an soft crash, where they become unresponsive over modbus. Sometimes they just crash hard and reboot.

One you figure out which entries crash the pumps, it should be reported ro nibe.

Shuties commented 5 months ago

So, i should try restarting, with all entities disabled, and then enable one by one until i find out which one makes it crash? Have i understood it correctly?

elupus commented 5 months ago

Yup

m-wo commented 5 months ago

I've followed your advice and disabled most of the entities, I'm not down to the absolute minimum that are required for automation and I'm still getting the errors. Even if I'd go and disable the last entities, I'd still be dependent on them. How would I report them to Nibe then?

elupus commented 5 months ago

Ignore your automations too start with. We need to find the entity that isn't working.

Shuties commented 5 months ago

I have not had the problem again since i updated the software to a new release since a week ago. Just wanted to let you know. 3.0.10 is the version im running, and no problems in a whole week.

philippe-tc commented 5 months ago

I'm havoing the same kind of problems since updating my Nibe S1255 to software version 3.0.10. The error log of my HA (core 2024.5.5 and OS 12.2) says:

Logger: homeassistant.components.nibe_heatpump Bron: helpers/update_coordinator.py:315 integratie: Nibe Heat Pump (documentatie, problemen) Eerst voorgekomen: 14:34:09 (4 gebeurtenissen) Laatst gelogd: 14:37:18

Unexpected error fetching Nibe Heat Pump data Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 315, in _async_refresh self.data = await self._async_update_data() ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/components/nibe_heatpump/coordinator.py", line 155, in _async_update_data return await self._async_update_data_internal() ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/components/nibe_heatpump/coordinator.py", line 177, in _async_update_data_internal async for data in self.connection.read_coils(_get_coils()): File "/usr/local/lib/python3.12/site-packages/nibe/connection/init.py", line 43, in read_coils yield await self.read_coil(coil, timeout) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/tenacity/_asyncio.py", line 142, in async_wrapped return await fn(*args, kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/tenacity/_asyncio.py", line 58, in call do = await self.iter(retry_state=retry_state) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/tenacity/_asyncio.py", line 110, in iter result = await action(retry_state) ^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/tenacity/_asyncio.py", line 78, in inner return fn(*args, *kwargs) ^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/tenacity/init.py", line 390, in self._add_action_func(lambda rs: rs.outcome.result()) ^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/concurrent/futures/_base.py", line 449, in result return self.get_result() ^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/concurrent/futures/_base.py", line 401, in get_result raise self._exception File "/usr/local/lib/python3.12/site-packages/tenacity/_asyncio.py", line 61, in call result = await fn(args, kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/nibe/connection/modbus.py", line 85, in read_coil result = await self._client.read_input_registers( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/async_modbus/core.py", line 194, in read_input_registers return await self._send_message(request) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/async_modbus/core.py", line 142, in _send_message return await self.protocol._async_send_message( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/async_modbus/core.py", line 39, in send_message_tcp await writer.drain() File "/usr/local/lib/python3.12/site-packages/async_modbus/core.py", line 113, in drain await self._write_coro File "/usr/local/lib/python3.12/site-packages/sockio/aio.py", line 31, in wrapper await self.open() File "/usr/local/lib/python3.12/site-packages/sockio/aio.py", line 287, in open self.reader, self.writer = await coro ^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/sockio/aio.py", line 153, in openconnection transport, = await loop.create_connection( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/asyncio/base_events.py", line 1120, in create_connection raise exceptions[0] File "/usr/local/lib/python3.12/asyncio/base_events.py", line 1102, in create_connection sock = await self._connect_sock( ^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/asyncio/base_events.py", line 1005, in _connect_sock await self.sock_connect(sock, address) File "/usr/local/lib/python3.12/asyncio/selector_events.py", line 641, in sock_connect return await fut ^^^^^^^^^ File "/usr/local/lib/python3.12/asyncio/selector_events.py", line 681, in _sock_connect_cb raise OSError(err, f'Connect call failed {address}') OSError: [Errno 113] Connect call failed ('192.168.2.105', 502)

elupus commented 5 months ago

Your pump has either crashed or you have not enabled modbus. Restart it and check that modbus is enabled.

m-wo commented 4 months ago

v3.1.7 has been released - not much about Modbus fixes but I hope this solves it.

elupus commented 3 months ago

We can't do much about this. The pump need to be restarted.