Nibe Heatpump Rule

nb-h

This rule was made for two purposes. First to create the right information for my heatpump widget (most important the ‘mode’, what is de heatpump doing). Of course, you can use it to make your own too.

Second to provide the information to test energy conservation improvements. Check out the screenshot below. Long story of course. The biggest influence on the heatpump is the outside temperature. Using a heat-curve it translates that to how hot the heating water must be. But there’s second mechanism using heating minutes (one of the items the binding provides). Depending on how fast the heating water cools it will start a new heating cycles. By deriving the heating minutes in the last 3 hours it’s possible to see it happening (the screenshot). Outside temperature low, heating minutes up. And I’m experimenting with small things, for instance will decreasing ventilation lower the loss and thus reducing the heating minutes for a given outside temperature by a bit. This is work in progress, but that the second purpose of the rule.

What is does:

  • Derive the mode (heating, passive heating, cooling, boiler or nothing) from the pump speeds and in/out temperatures of the heat exchangers.
  • Calculate/store the minutes (per day) spend in each mode.
  • Calculate/store the minutes (per 3 hours) spend in heating mode (my trial).
  • Derive ground temperature (from brine in while running)
  • On the first run it will create new items to store the derived data, they will be added to the Nibe group/equipment item (you select this when installing the rule).
    • Reset_Calc : Resets cached values/history
    • Mode : Derived mode of heatpump (0=off, 1=heating room, 2=passive heating room, 3= heating boiler, 4=cooling)
    • Ground_Temp : ground temperature (derived from brine-in)
    • Heat_Temp : (derived) Supply temperature but only for heating room
    • Boiler_Temp : (derived) Supply temperature but only for heating boiler
    • Brine_Temp : (derived) Brine in temperature but only when brine pump is active
    • Heat_Min : (derived) running 24 hours total of minutes in heating room mode
    • Passive_Min : (derived) running 24 hours total of minutes in passive heating room mode
    • Boiler_Min : (derived) running 24 hours total of minutes in boiler heating room mode
    • Cool_Min : (derived) running 24 hours total of minutes in cooling room mode
    • Heat_Min_3h : (derived) running 3 hours total of minutes in heating room mode

Installation
To install it:

  • (if not already done) install the JS Script and/or Nibe uplink binding (links in Language/Dependencies section
  • Install this rule template from the marketplace (open your openHAB → menu settings → add-ons → automation → search Nibe Heatpump Rule and press install button
  • Create a rule using this template (openyour openHAB → menu settings → automation → Rules → + / add rule button → Choose Nibe Heatpump Rule → select the item for the nibe group/equipment → save)

Language: JS Script ECMA2021

Dependencies: NIBE uplink binding

Screenshots

Changelog

Version 1.7

  • fixed: changes for OH 4.x (% pump speed items fixes)
  • added: put OH root url in template (used in first run to get cache for daily stats)

Version 1.6

  • fixed: bug in cooling detection

Version 1.5

  • added: Made it official, moved code to github (previous versions were on forum topic)
  • added: Change to standard rule using helper methods
  • fixed: install by marketplace (working on it/testing)

Version 1.4

  • added: Calculate rolling sum of minutes active in each mode in last 3 hrs

Version 1.3

  • added: Calculate rolling sum of minutes active in each mode in 24 hrs

Version 1.2

  • added: Estimate ground temperature (lowest brine-in in 24 hrs)

Version 1.0

  • added: Reads heatpump raw data and derives what’s it is doing (nothing, active heating, passive heating, cooling, boiler heating)
  • added: Write result in new item mode (automatic added if needed)
  • added: Store temporary items in cache (that survives rule init/sate) with reset item (added if needed)

Resources

https://raw.githubusercontent.com/supersjellie/openhab-nibe-heatpump/main/rules/heatpump-template.yaml

Well, getting this to work was more difficult than expected. But for me it does, so I’m curious if I it also works for others. And also curious: does anyone else use openHAB to optimize their heatpump? And your tricks to do this?

I defintely control Nibe heatpump with logic implemented in openHab. See

1 Like

Hi, it’s summer and hot over here. So the heatpump started cooling but the widget didn’t show that correctly. I made a mistake when converting the rule to ECMA2021. This caused the old degree minutes to be undefined and undefined!=0 :nerd_face: So the heatpump_mode was not set to 4 (=cooling). Fixed!

old/wrong:
var degreeMinOldValue=Number.parseFloat(degreeMin.previousState).toFixed(1)

new:right:
var degreeMinOldValue=Number.parseFloat(degreeMin.history.previousState()).toFixed(1);

Fixed for OH 4.x. The rule didn’t calculate the pump speed correct because of the changed on % items/formats.