How to connect to Nibe heat pump without the cloud

Yes a pull request would be good. The C version of the program is part of OpenHAB project.

@elupus Is it possible to tweak the read timeout and read interval using some options for the integration? It turns out I’m running into random read timeouts with the MODBUS 40… Thanks.

Probably. Do you have logs?

Sure. What exactly would you need?

home-assistant.log has just this to say:

2022-12-26 22:48:40.235 ERROR (MainThread) [homeassistant.components.nibe_heatpump] Error fetching Nibe Heat Pump data: Failed to update: Timeout waiting for read response for bt1-outdoor-temperature-40004
2022-12-26 23:15:46.460 ERROR (MainThread) [homeassistant.components.nibe_heatpump] Error fetching Nibe Heat Pump data: Failed to update: Timeout waiting for read response for eb100-ep14-bt10-brine-in-temp-40015
2022-12-26 23:23:20.455 ERROR (MainThread) [homeassistant.components.nibe_heatpump] Error fetching Nibe Heat Pump data: Failed to update: Timeout waiting for read response for eb100-ep14-bt10-brine-in-temp-40015
2022-12-26 23:29:47.412 ERROR (MainThread) [homeassistant.components.nibe_heatpump] Error fetching Nibe Heat Pump data: Failed to update: Timeout waiting for read response for bt6-hw-load-40014
2022-12-26 23:36:14.288 ERROR (MainThread) [homeassistant.components.nibe_heatpump] Error fetching Nibe Heat Pump data: Failed to update: Timeout waiting for read response for bt2-supply-temp-s1-40008
2022-12-26 23:58:56.450 ERROR (MainThread) [homeassistant.components.nibe_heatpump] Error fetching Nibe Heat Pump data: Failed to update: Timeout waiting for read response for eb100-ep14-bt10-brine-in-temp-40015
2022-12-27 00:30:18.456 ERROR (MainThread) [homeassistant.components.nibe_heatpump] Error fetching Nibe Heat Pump data: Failed to update: Timeout waiting for read response for eb100-ep14-bt10-brine-in-temp-40015
2022-12-27 00:33:30.329 ERROR (MainThread) [homeassistant.components.nibe_heatpump] Error fetching Nibe Heat Pump data: Failed to update: Timeout waiting for read response for eb100-ep14-bt3-return-temp-40012
2022-12-27 00:37:47.371 ERROR (MainThread) [homeassistant.components.nibe_heatpump] Error fetching Nibe Heat Pump data: Failed to update: Timeout waiting for read response for bt7-hw-top-40013
2022-12-27 02:01:13.456 ERROR (MainThread) [homeassistant.components.nibe_heatpump] Error fetching Nibe Heat Pump data: Failed to update: Timeout waiting for read response for eb100-ep14-bt10-brine-in-temp-40015
2022-12-27 02:10:57.451 ERROR (MainThread) [homeassistant.components.nibe_heatpump] Error fetching Nibe Heat Pump data: Failed to update: Timeout waiting for read response for eb100-ep14-bt10-brine-in-temp-40015
2022-12-27 02:15:14.414 ERROR (MainThread) [homeassistant.components.nibe_heatpump] Error fetching Nibe Heat Pump data: Failed to update: Timeout waiting for read response for bt6-hw-load-40014

Strange. The default timeout is 5 seconds. That should have been enough. The library uses the same. You say you can use the nibe library to read?

Ps. It has a commandline tool too.

pip install nibe[cli]

Then you can use: nibe-cli commandline tool.

Yes, it is strange… I wrote a script reading 20 coils in a row and it works OK. I only get CRC errors if HA is running and your integration tries to read simultaneously too.

Interesting is that in HA it fails on timeout many times in a row and then it is able to successfully read all data in just under 2 seconds.

This is log with debug output enabled:

2022-12-27 11:00:02.369 DEBUG (MainThread) [homeassistant.components.nibe_heatpump] Finished fetching Nibe Heat Pump data in 5.048 seconds (success: False)
2022-12-27 11:01:09.142 DEBUG (MainThread) [homeassistant.components.nibe_heatpump] Finished fetching Nibe Heat Pump data in 6.820 seconds (success: False)
2022-12-27 11:02:14.322 DEBUG (MainThread) [homeassistant.components.nibe_heatpump] Finished fetching Nibe Heat Pump data in 5.002 seconds (success: False)
2022-12-27 11:03:19.360 DEBUG (MainThread) [homeassistant.components.nibe_heatpump] Finished fetching Nibe Heat Pump data in 5.038 seconds (success: False)
2022-12-27 11:04:24.389 DEBUG (MainThread) [homeassistant.components.nibe_heatpump] Finished fetching Nibe Heat Pump data in 5.068 seconds (success: False)
2022-12-27 11:05:29.322 DEBUG (MainThread) [homeassistant.components.nibe_heatpump] Finished fetching Nibe Heat Pump data in 5.001 seconds (success: False)
2022-12-27 11:06:34.413 DEBUG (MainThread) [homeassistant.components.nibe_heatpump] Finished fetching Nibe Heat Pump data in 5.093 seconds (success: False)
2022-12-27 11:07:39.745 DEBUG (MainThread) [homeassistant.components.nibe_heatpump] Finished fetching Nibe Heat Pump data in 5.424 seconds (success: False)
2022-12-27 11:08:44.324 DEBUG (MainThread) [homeassistant.components.nibe_heatpump] Finished fetching Nibe Heat Pump data in 5.002 seconds (success: False)
2022-12-27 11:09:46.049 INFO (MainThread) [homeassistant.components.nibe_heatpump] Fetching Nibe Heat Pump data recovered
2022-12-27 11:09:46.049 DEBUG (MainThread) [homeassistant.components.nibe_heatpump] Finished fetching Nibe Heat Pump data in 1.727 seconds (success: True)
2022-12-27 11:10:51.376 ERROR (MainThread) [homeassistant.components.nibe_heatpump] Error fetching Nibe Heat Pump data: Failed to update: Timeout waiting for read response for bt2-supply-temp-s1-40008
2022-12-27 11:10:51.379 DEBUG (MainThread) [homeassistant.components.nibe_heatpump] Finished fetching Nibe Heat Pump data in 5.058 seconds (success: False)
2022-12-27 11:11:56.358 DEBUG (MainThread) [homeassistant.components.nibe_heatpump] Finished fetching Nibe Heat Pump data in 5.037 seconds (success: False)
2022-12-27 11:13:01.369 DEBUG (MainThread) [homeassistant.components.nibe_heatpump] Finished fetching Nibe Heat Pump data in 5.048 seconds (success: False)
2022-12-27 11:14:06.718 DEBUG (MainThread) [homeassistant.components.nibe_heatpump] Finished fetching Nibe Heat Pump data in 5.398 seconds (success: False)
2022-12-27 11:15:11.363 DEBUG (MainThread) [homeassistant.components.nibe_heatpump] Finished fetching Nibe Heat Pump data in 5.042 seconds (success: False)
2022-12-27 11:16:16.375 DEBUG (MainThread) [homeassistant.components.nibe_heatpump] Finished fetching Nibe Heat Pump data in 5.054 seconds (success: False)
2022-12-27 11:17:21.356 DEBUG (MainThread) [homeassistant.components.nibe_heatpump] Finished fetching Nibe Heat Pump data in 5.036 seconds (success: False)

Anyway, can I supply some options to the integration to try and raise the default timeout and polling interval? Maybe I will find the right values to get a reliable read out…

There is no option for controlling it. You have to patch the library. Its this line: nibe/nibe/connection at a23b7bd5067dd75e01e6a32d40d646f21d23e53e · yozik04/nibe · GitHubinit.py#L10

Does however feel like something else is going on.

Thanks for the support!

It seems like I have been successfully able to tweak it to have a continuous read out. I will test it more and if it remains stable & reliable I will send in some PR into @yozik04 's library. I had to add a short delay in between of each read_coil and raise the default timeout value a bit.

2022-12-27 15:39:07.943 DEBUG (MainThread) [homeassistant.components.nibe_heatpump] Finished fetching Nibe Heat Pump data in 13.826 seconds (success: True)
2022-12-27 15:40:20.774 DEBUG (MainThread) [homeassistant.components.nibe_heatpump] Finished fetching Nibe Heat Pump data in 13.658 seconds (success: True)
2022-12-27 15:41:33.898 DEBUG (MainThread) [homeassistant.components.nibe_heatpump] Finished fetching Nibe Heat Pump data in 13.780 seconds (success: True)
2022-12-27 15:42:46.749 DEBUG (MainThread) [homeassistant.components.nibe_heatpump] Finished fetching Nibe Heat Pump data in 13.632 seconds (success: True)

At least it looks like it could now be usable like this.

In my opinion raising default timeout to more than 5 seconds is wrong. It is a plenty of time. Short timeout between reads feels also strange as there is a lock that won’t let you to read next until a response for previous is received.

I’m still testing it and trying around what could work… But previously it failed in around 99% of cases, after adding 1 second delay in between each read_coil() it fails in about 50% of cases usually on one specific coil… If I increase the timeout it gets even better but never to 100% success rate and the read out starts to fail on random coils.

Without the added delay it practically could not read anything. Just once in maybe 10-15 minutes it had a successful run.

Currently I’m on default_timeout of 7 s and 1 s delay. This works in about 75% of the time.
The recommendation in the MODBUS 40 manual is timeout of 2,1 seconds. Somewhere on the internet forums I found out someone recommending to use 3 seconds timeout and 1 second delay (which he/she wrote is very important). With 2,1 or 3 s timeout the read out is very unstable for me. But that description was meant for some kind of PLC application…

I think you need to try an another RS485 module… Very suspicious. I am using same lib code and it almost never fails.

And you use it straight with Nibe MODBUS 40 same as me? I thought that serial connection to MODBUS 40 was untested? But sure I can try to get my hands on different USB dongle.

Hi @elupus,

I am not able to find the pump speed in the integration:

Currently I am using this modbus command to get it:

  • name: “Wärmepumpe - Drehzahl Heizungsumwälzpumpe (GP1)”
    unique_id: Nibe.address.1636
    unit_of_measurement: “%”
    data_type: int16
    device_class: power_factor
    address: 1636
    input_type: input
    scale: 1
    precision: 1
    state_class: measurement
    slave: 1

I activated every sensor in the integration with “pump” but I was not able to find it.
Am I blind or is it possible that the GP1 speed sensor is missing?

Thanks

There seem to be another sensor: heating-medium-pump-speed-gp1-31103

Not sure why that sensor you mention is not exported from the pumps.

Thanks for your feedback.
heating-medium-pump-speed-gp1-31103 is not reporting the write value.
I tried every sensor with pump and did not get the right pump speed.

Should I export all registers from my heat pump?

These sensors are also not working for me:
switch.hot_water_comfort_40695_2
switch.heating_sg_ready_40761_2

What pump do you have. That sensor you mention is only listed for F-series pumps. The pdf you linked is only valid for S-series pumps.

These sensors (switch.hot_water_comfort_40695_2 + switch.heating_sg_ready_40761_2) are only for F-Series?
I am using a Nibe VVM S320 from the pdf above.

Are there any “More hot water” and “SG ready” switch for the S-series?

The S320 does have those sensors. I think i misread something.

@elupus is there any way to tell which sensors are effectively available for the VVM320 (non-s-version) from the entire export list?? (nibe/vvm225_vvm320_vvm325.json at a23b7bd5067dd75e01e6a32d40d646f21d23e53e · yozik04/nibe · GitHub)

Or is the only option activating them all and see what changes? :sweat_smile:

Pretty much the latter. They are all available if you have all accessories ;). But there is no known mapping between accessories and parameters, so we cant now which are available.

1 Like