Control a water heater and ground source heat pump based on cheap hours of spot priced electricity

Thanks for explaining the splicing, makes things easier to understand.

I was more refering to this:

Shouldn’t these control signals logically form one block, not separate hours?


As explained in the description, there are two different algorithms.

The waterheater.js aims at finding the cheapest consecutive slot (if that is a word, halvin yhtäjaksoinen jakso). Nothing prevents you from using this one with your heat pump if you want to guarantee consequtive periodi. But that’s only within the day, so you might want to tweak the date helper to adjust the period to be like 21-20 and not 00-23.

Nibe.js will find N absolute cheapest individual hours by design. But to ensure that you will have at least some heating also during the day, you can use the slicing to force that.

I personally heat mostly during the nights, and nibe.js has been doing that for me because most of the time the absolute cheapest hours are consecutive hours during the night. But the heating period starts often already at 21, 22 or 23 and then continues over midnight.


I have had some trouble getting the wifi tasmota relay to obey the code control. After some tinkering around I found out I had not set MQTT qos at all. Setting it to 2 seems to have stopped the strange behavior of the relay, and now it follows control as it should