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.71k stars 30.84k forks source link

Nibe Integration: Entity toggling between value and Unavailable every few minutes #128818

Closed realzoulou closed 3 weeks ago

realzoulou commented 3 weeks ago

The problem

I notice since I have set up the Integration (1-2 months ago) that Nibe F1245 coil 43416 (Compressor starts EB100-EP14) toggles between a correct value and Unavailable every few minutes. I use LilyGo T-CAN as MODBUS40 replacement. HA logs contain huge amount of warnings like [nibe.nibe.connection.nibegw] Ignoring coil 43416 value 8184 - failed to decode but also other coils

[nibe.nibe.connection.nibegw] Ignoring coil 44298 value 209f - failed to decode
[nibe.nibe.connection.nibegw] Ignoring coil 44300 value f75d - failed to decode

What version of Home Assistant Core has the issue?

core-2024.10.3

What was the last working version of Home Assistant Core?

unknown/never

What type of installation are you running?

Home Assistant Container

Integration causing the issue

Nibe Heat Pump

Link to integration documentation on our website

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

Diagnostics information

2024-10-20_08h52_13

Example YAML snippet

No response

Anything in the logs that might be useful for us?

2024-10-20 08:42:10.266 WARNING (MainThread) [nibe.nibe.connection.nibegw] Ignoring coil 43416 value 8184 - failed to decode
2024-10-20 08:42:10.266 WARNING (MainThread) [nibe.nibe.connection.nibegw] Ignoring coil 44298 value 209f - failed to decode
2024-10-20 08:42:10.267 WARNING (MainThread) [nibe.nibe.connection.nibegw] Ignoring coil 44300 value f75d - failed to decode
2024-10-20 08:42:15.070 WARNING (MainThread) [nibe.nibe.connection.nibegw] Ignoring coil 43416 value 8184 - failed to decode
2024-10-20 08:42:15.071 WARNING (MainThread) [nibe.nibe.connection.nibegw] Ignoring coil 44298 value 209f - failed to decode
2024-10-20 08:42:15.071 WARNING (MainThread) [nibe.nibe.connection.nibegw] Ignoring coil 44300 value f75d - failed to decode
2024-10-20 08:42:23.723 WARNING (MainThread) [nibe.nibe.connection.nibegw] Ignoring coil 43416 value 8184 - failed to decode
2024-10-20 08:42:23.724 WARNING (MainThread) [nibe.nibe.connection.nibegw] Ignoring coil 44298 value 209f - failed to decode
2024-10-20 08:42:23.724 WARNING (MainThread) [nibe.nibe.connection.nibegw] Ignoring coil 44300 value f75d - failed to decode
2024-10-20 08:42:29.348 WARNING (MainThread) [nibe.nibe.connection.nibegw] Ignoring coil 43416 value 8184 - failed to decode
2024-10-20 08:42:29.348 WARNING (MainThread) [nibe.nibe.connection.nibegw] Ignoring coil 44298 value 209f - failed to decode
2024-10-20 08:42:29.349 WARNING (MainThread) [nibe.nibe.connection.nibegw] Ignoring coil 44300 value f75d - failed to decode
2024-10-20 08:42:34.330 WARNING (MainThread) [nibe.nibe.connection.nibegw] Ignoring coil 43416 value 8184 - failed to decode
2024-10-20 08:42:34.331 WARNING (MainThread) [nibe.nibe.connection.nibegw] Ignoring coil 44298 value 209f - failed to decode
2024-10-20 08:42:34.332 WARNING (MainThread) [nibe.nibe.connection.nibegw] Ignoring coil 44300 value f75d - failed to decode

Additional information

I patched ESPHome NibeGw.cpp lines 151 ff to allow ESPHome logs of LilyGo device to show the bytes received via MODBUS from F1245-8 E EM Firmware: 9699R7 (myUplink)

#if ESPHOME_LOG_LEVEL >= ESPHOME_LOG_LEVEL_WARN
            for (byte i = 0; i < msglen && i < DEBUG_BUFFER_LEN / 3; i++) {
              sprintf(debug_buf + i * 3, "%02X ", buffer[i]);
            }
            ESP_LOGW(TAG, "%d bytes from pump: %s", msglen, debug_buf);
#endif

and in ESPHome YAML

logger:
  level: WARN
  logs:
    nibeGW: WARN

and then tried to find the hex bytes that HA Nibe Integration failed to decode:

2024-10-20 08:42:10.266 WARNING (MainThread) [nibe.nibe.connection.nibegw] Ignoring coil 43416 value 8184 - failed to decode
2024-10-20 08:42:10.266 WARNING (MainThread) [nibe.nibe.connection.nibegw] Ignoring coil 44298 value 209f - failed to decode
2024-10-20 08:42:10.267 WARNING (MainThread) [nibe.nibe.connection.nibegw] Ignoring coil 44300 value f75d - failed to decode

matches with NibeGw.cpp logs: [08:42:12][W][nibeGW:155]: 87 bytes from pump: 5C 00 20 68 51 44 9C 84 00 48 9C 34 01 4D 9C E1 01 4E 9C B9 01 4F 9C 0E 01 50 9C FB 00 59 9C E1 00 5A 9C E8 00 5C 5C 9C EB 00 5D 9C EE 00 EC 9F 00 00 ED 9F 00 00 01 A8 21 01 98 A9 81 84 FF FF 00 00 0A AD 20 9F FF FF 00 00 0C AD F7 5D FF FF 00 00 EA AC 00 00 AF

home-assistant[bot] commented 3 weeks 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 3 weeks ago

Could you remove these registers from your logset file? My guess something is wrong with that data.

elupus commented 3 weeks ago

Also could be due to all invalid wordswap setting on your pump.

realzoulou commented 3 weeks ago

Word swap checkbox is checked in the pump. If it was wrong, wouldn't then the value never be correctly shown. I added a screen shot in Diagnostic information, which shows that it toggles every now and then.

realzoulou commented 3 weeks ago

@elupus I manually edited nibegw.py to match with https://github.com/yozik04/nibe/pull/185/commits/ed3ef0c091953071d53fbf39900b6fad01249f53 and restarted HA. No more HA logs "Ignoring coil ..." and also coil 43416 (Compressor starts EB100-EP14) does not toggle anymore 👍

I restarted HA at 16:37 and since then compressor starts remains stable (now at 33922) image

realzoulou commented 3 weeks ago

@elupus But I saw now an issue with other coils. Example: 44298 (Heat Meter - HW Cpr and Add EP14) value dropped from ~10628.5 kWh down to 4074.9 kWh image

I also use HACS MyUplink (https://github.com/jaroschek/home-assistant-myuplink) and both 44298 and 44300 are now showing much smaller values in your integration compared to HACS MyUplink. Previously they always showed exact same value. image

Seems https://github.com/yozik04/nibe/commit/ed3ef0c091953071d53fbf39900b6fad01249f53 is not ok.

elupus commented 3 weeks ago

You did not try what i asked you? Disable the parameters in your LOGSET file.

elupus commented 3 weeks ago

But. Nice that you tested that patch! Not sure i can merge that though

realzoulou commented 3 weeks ago

@elupus I removed 43416, 44298 and 44300 from LOG.SET and reloaded the Nibe integration. Result: No warnings in HA anymore, and astonishingly (for me at least) the coils are still reported in HA. The values are also "stable", means they do not change to "Unavailable" state every few minutes. So the original issue is gone and I will close this issue now. I was under the impression that the Integration can only report coils, that I add to LOG.SET file and install then to the pump. Apparantly my fault...

elupus commented 3 weeks ago

@realzoulou Can you paste your logset? Also what firmware version are you on?

realzoulou commented 3 weeks ago

@elupus My pump is F1245-8 with FLM, Firmware: 9699R7 (myUplink version)

LOG.SET issue LOG.SET w/o issue ModbusManager descr.
40004 40004 BT1 Outdoor Temperature
40008 40008 BT2 Supply temp S1
40013 40013 BT7 HW Top
40014 40014 BT6 HW Load
40015 40015 EB100-EP14-BT10 Brine In Temp
40016 40016 EB100-EP14-BT11 Brine Out Temp
40025 40025 BT20 Exhaust air temp. 1
40026 40026 BT21 Vented air temp. 1
40028 40028 AZ1-BT26 Temp Collector in FLM 1
40029 40029 AZ1-BT27 Temp Collector out FLM 1
40940 40940 Degree Minutes (32 bit)
43009 43009 Calc. Supply S1
43416 Compressor starts EB100-EP14
44298 Heat Meter - HW Cpr and Add EP14
44300 Heat Meter - Heat Cpr and Add EP14
44266 44266 Cool Degree Minutes
realzoulou commented 2 weeks ago

I removed now all entries from LOG.SET and I find still all data being available. No idea why I thought LOG.SET is a must for the integration to work.

elupus commented 2 weeks ago

You get reports faster for things in log set. But its not needed otherwise.

Ps. I checked those problematic parameters on my pump and it reacts different from yours.

I think there is a bug in the firmware on your series of pumps. Maybe nibe fixes that at some point.