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.73k stars 30.85k forks source link

Nibe Heat Pump integration (with S1155) requires restart every 6~8 hours since upgrade to 2023.7.2 #97132

Closed dirixmjm closed 1 year ago

dirixmjm commented 1 year ago

The problem

Hi,

Recently I have upgrade from HAS 2023.4.6 to 2023.7.2 and every since my Nibe Heat Pump integration stops communication to my S1155 every 6 to 8 hours. After a manual restart (in the integrations menu) it starts running again.

I had similar issues on 2023.4.6 but maximally ones a week or less.

What version of Home Assistant Core has the issue?

2023.7.2

What was the last working version of Home Assistant Core?

2023.4.6

What type of installation are you running?

Home Assistant Core

Integration causing the issue

nibe_heatpump

Link to integration documentation on our website

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

Diagnostics information

home-assistant_2023-07-24T08-08-28.684Z.log

Example YAML snippet

No response

Anything in the logs that might be useful for us?

2023-07-24 07:58:00.451 ERROR (MainThread) [homeassistant.components.nibe_heatpump] Unexpected error fetching Nibe Heat Pump data: unpack requires a buffer of 4 bytes
Traceback (most recent call last):
  File "/var/homeassistant/lib/python3.11/site-packages/homeassistant/helpers/update_coordinator.py", line 283, in _async_refresh
    self.data = await self._async_update_data()
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/var/homeassistant/lib/python3.11/site-packages/homeassistant/components/nibe_heatpump/__init__.py", line 265, in _async_update_data
    return await self._async_update_data_internal()
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/var/homeassistant/lib/python3.11/site-packages/homeassistant/components/nibe_heatpump/__init__.py", line 287, in _async_update_data_internal
    async for data in self.connection.read_coils(_get_coils()):
  File "/var/homeassistant/lib/python3.11/site-packages/nibe/connection/__init__.py", line 43, in read_coils
    yield await self.read_coil(coil, timeout)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/var/homeassistant/lib/python3.11/site-packages/tenacity/_asyncio.py", line 88, in async_wrapped
    return await fn(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/var/homeassistant/lib/python3.11/site-packages/tenacity/_asyncio.py", line 47, in __call__
    do = self.iter(retry_state=retry_state)
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/var/homeassistant/lib/python3.11/site-packages/tenacity/__init__.py", line 314, in iter
    return fut.result()
           ^^^^^^^^^^^^
  File "/usr/lib/python3.11/concurrent/futures/_base.py", line 449, in result
    return self.__get_result()
           ^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/concurrent/futures/_base.py", line 401, in __get_result
    raise self._exception
  File "/var/homeassistant/lib/python3.11/site-packages/tenacity/_asyncio.py", line 50, in __call__
    result = await fn(*args, **kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/var/homeassistant/lib/python3.11/site-packages/nibe/connection/modbus.py", line 110, in read_coil
    result = await self._client.read_input_registers(
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/var/homeassistant/lib/python3.11/site-packages/async_modbus/core.py", line 194, in read_input_registers
    return await self._send_message(request)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/var/homeassistant/lib/python3.11/site-packages/async_modbus/core.py", line 142, in _send_message
    return await self.protocol._async_send_message(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/var/homeassistant/lib/python3.11/site-packages/async_modbus/core.py", line 52, in send_message_tcp
    return tcp.parse_response_adu(response_error_adu + response_remainder, adu)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/var/homeassistant/lib/python3.11/site-packages/umodbus/client/tcp.py", line 235, in parse_response_adu
    function = create_function_from_response_pdu(resp_pdu, req_adu)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/var/homeassistant/lib/python3.11/site-packages/umodbus/functions.py", line 140, in create_function_from_response_pdu
    return function.create_from_response_pdu(resp_pdu)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/var/homeassistant/lib/python3.11/site-packages/umodbus/functions.py", line 1070, in create_from_response_pdu
    address, value = struct.unpack('>HH', resp_pdu[1:5])
                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
struct.error: unpack requires a buffer of 4 bytes

Additional information

No response

home-assistant[bot] commented 1 year 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.

(message by CodeOwnersMention)


nibe_heatpump documentation nibe_heatpump source (message by IssueLinks)

elupus commented 1 year ago

There seem to be one entity marked as 32 bit that your pump doesnt seem to provide 32 bits of data. Which entities do you have enabled?

dirixmjm commented 1 year ago

I don't know how to list them easily as text, so here some screenshots.

afbeelding afbeelding afbeelding afbeelding

I have been testing out a few entities, maybe there are even one or two which do not provide data, I'll start disabling them.

elupus commented 1 year ago

Its likely one of the degree minutes or the total energy eme 20

dirixmjm commented 1 year ago

Ok, I have disabled those. I'll check if this resolves the issue. Thanks!

dirixmjm commented 1 year ago

So far it is running stable now. I am closing this issue.

Thank you for the quick support!

elupus commented 1 year ago

Can you deduce which one ot was that caused problems?