Cheapest price water boiler heating with overload protection

This is my run on a cheapest price water boiler heating project. I hope someone can use my approach for their own setup :slight_smile:

I’ve heard the idea of a smart boiler more than once, however, I had different requirements than those. Most I saw were only using excess solar power to heat up the boiler where I wanted to have a slightly different approach. I have a energy contract which uses different prices every hour (dynamic contract) for both using power from the grid as for delivering power to the grid. I would like to use the cheapest energy to heat up the boiler, not specifically using solar.

The energy prices for a typical day in summer are lowest during the day when the sun in shining, however, during winter it might me in the middle of the night where energy is cheapest. Because I know the price a day ahead, it can be scheduled when the best time is to heat up the boiler.

Also something for me to take into account is that I only have a 1 fase connection which is limited to 35A (with a very slow fuse) which makes about 8 kW max. Besides the boiler, we have an electric car which will be charged during the cheapest hours as well. The car can charge with about 6 kW and most boiler will use about 2 kW. Then we have the rest of the house with dishwasher, washing machine, dryer, microwave etc. We can easily trip the breaker when not considering the different loads, so I wanted to create something for that as well.

So, first things first… hardware.

  • I bought a Tesy boiler of 120 liters which heats with 2 kW. I hang it next to the gas heater we currently use. This gas heater has a so called ZN (Zonneboiler Naverwarming / sunboiler afterheat) function which makes that it can deal with preheated water. So, cold water to new boiler, output of new boiler to gas heater, done. If the boiler is out of hot water, the gas heater will take over.
  • Then, I wanted to be able to managed the amount of power the heater is using, so if both the car and heater are on the heater will reduce power (instead of switching off) to not trip the fuse. For that, I used the DMX dimmer solution I found here: DIY Boiler Solar Energy Storage - #3 by Farnsworth Most those DMX dimmers are 10A max, which makes 2.3 kW, so we are well within specs.
  • I have to measure the complete power used in the house, for that I already had the P1 port connected too HA.
  • I want to know the amount of hot water which is used from the boiler, for that I bought a flow meter with temp sensor from Ali.
  • A d1 mini running esphome is used for reading the flow meter, temp sensor and controlling the DMX dimmer.
  • TTL to RS485 converter for DMX control.
  • Shelly plug s for power usage monitoring. These can run up to 2.5 kW, so again, well within specs.
  • 3d printed cases for the electronics

After installing all the hardware, I had to come up with something to decide when to heat the boiler. I decided to threat the boiler as it was a normal battery. I have to put about 8 kWh into it to charge it fully. This would make the “SOC” 100%. As soon as all hot water is used, the SOC will be 0%. When treading it like that, all kinds of integrations are available to help deciding the best moment to charge. I went with “EV smart charging” (GitHub - jonasbkarlsson/ev_smart_charging: Electric vehicle smart charging for Home Assistant.).

For this integration we need:

  • SOC of the battery
  • Energy prices (nordpool is used)

Within the app there are plenty of settings which can be set to customize it to your needs, most important once I use:

  • Low price charging enabled
  • Use pricelimit, to avoid crazy high prices for heating the water
  • Charging ready time, set to 19:00 as shower is used most in the evening
  • Charging speed, 20%. This makes 5 hours to fully charge to have some margin

Now the integration will return a “charging on/off sensor” which can be used to enable the DMX dimmer. It will also show the scheduled time to charge and how long it will take to fully charge the battery.

Because the SOC will be leading in calculating the correct times to charge, this was my next focus. First the charging. Because I know the power used by the shelly plug I use that data to decide the SOC increase every minute. This is not a set percentage, because the DMX dimmer might run lower than 100%. I created a derivative sensor which shows me how much power is used every minute. This is then used every minute to calculated the percentage increase of the SOC, by multiplying with 12.5% (8 kWh to fully charge, so 12.5% per kWh). This makes that I still have a reliable number even when the dimmer is not at 100%.

Now the discharge. I can measure the amount of hot water used by the flow meter. For every liter of water used, I decrease the SOC by 0.8333% (100% divided by 120 liters), easy as that.

Now to enable charging I use the output sensor of the integration as mentioned. However, I want to take into consideration that 8 kW is the max of the main fuse. So if the output sensor is on, but the current load is between 5.5 kW and 7.5 kW, I increase the DMX dimmer with 10% steps. Every time the P1 power usage changes (every 10 sec), it is then decided if the dimmer should increase power or not. If the power is below 7.5 kW the power is increased with another 10%. If the power is above 8 kW, the dimmer is set to 0% to protect the fuse.

This pretty much completes the setup. It does the trick perfectly. The amount of gas used for showering has decreased significantly and the boiler heats up most days (only skips when prices are to high).