Smart water heating off-grid with Home Assistant & Victron

Published at Oct 24, 2023

If you have solar panels and not connected to grid, you may want a way to smartly consume the surplus of energy when you reach the full capacity of your battery. Here is your guide!

I built my own camper van with the primary challenge of achieving electrical self-sufficiency. To that end, I invested in the most extensive system that would both fit within my budget and be physically accommodated by the van, aiming to power everything electrically—including hot water and cooking.

My setup is composed of 2 solar panels of 375W each (so 750W in total), a 300A 12V battery (3600Wh) and AC converter of 1600W. All from Victron Energy, with a raspberry pi as VenusOS and another one with Home Assistant. They are both connected through modbus (and mqtt, but that's still on test, subscribe to my newsletter if you wanna know how).

Another important thing to know is the power of the heater, mine goes to 1000W on the AC converter when heating. It's connected to power with a Shelly 1PM, it's a smart outlet that give me the power used in real time. You will need this for theses automations.

So let's begin!

Automatically heat water when battery is almost full

The first one is fairly simple and straight foward. If my battery reaches 99% for more than 2 minutes, turn on the heater !

Initially, I experimented with the MPPT's state to check if it was in absorption mode. But, my van is equipped with an Orion unit that charges my batteries while driving, providing a power inflow of 360W per hour. This is essentially equivalent to having a third solar panel, but with the added advantage of functioning at night as well. So I simplified the auto ON feature.

You have the trigger, now some conditions:

  • The heater is off, obviously
  • There is no other high-load/power-hungry device using the AC Converter at the moment

And if all the conditions are good, we switch on the device and I send myself a notification.

Copied!
1alias: "Heater : AUTO ON when battery almost full"
2description""
 3trigger:
4 - platform: numeric_state # If battery is >98% for 2 minutes
5 entity_idsensor.victron_battery_soc
6 for:
7 hours0
8 minutes2
9 seconds0
10 above98
11condition:
12 - condition: device # Heater is OFF
13 typeis_off
14 device_id1b6be566b42a0ba75a45fe7a7f22891c
15 entity_id7b9fe952bccc587d2713bb62dcf06ff8
16 domainswitch
17 - condition: numeric_state # The load on the AC is low
18 entity_idsensor.ac_loads
19 below200
20 alias: No other device is using the AC converter (<200W)
21action:
22 - type: turn_on # Turn on the heater
23 device_id1b6be566b42a0ba75a45fe7a7f22891c
24 entity_id7b9fe952bccc587d2713bb62dcf06ff8
25 domainswitch
26 - service: notify.notify # Send a notification to my mobile device
27 data:
28 message: "Heater on ! "
29 title: Battery full !
30modesingle

Turn OFF when the water is hot

Most of theses small heaters works the same way. You set a temperature on the back, when it's too low, they heat full power with a resitance then they shut off until the temperature is low again.

So in this automation we monitor the power usage, and shut it off when it finishes it's cycle. I also added a condition to not turn it off if I still have more than 95% power on my battery.

Copied!
1alias: "Heater : Auto OFF when not using power"
2description""
 3trigger:
4 - platform: state # Monitor battery state of charge
5 entity_id:
6sensor.victron_battery_soc
7 - platform: state # Monitor heater power usage
8 entity_id:
9sensor.shelly_1pm_power
10condition:
11 - conditionand
12 conditions:
13 - condition: numeric_state # if battery below < 95%
14 entity_idsensor.victron_battery_soc
15 below95
16 - condition: device # if heater is on
17 typeis_on
18 device_id1b6be566b42a0ba75a45fe7a7f22891c
19 entity_id7b9fe952bccc587d2713bb62dcf06ff8
20 domainswitch
21 - type: is_power # if heater is not heating < 100W
22 conditiondevice
23 device_id1b6be566b42a0ba75a45fe7a7f22891c
24 entity_id1548f61ecfeceb0e0919e95615edb350
25 domainsensor
26 below100
27 alias: Not using any power
28action:
29 - type: turn_off # Turn OFF
30 device_id1b6be566b42a0ba75a45fe7a7f22891c
31 entity_id7b9fe952bccc587d2713bb62dcf06ff8
32 domainswitch
33 - service: notify.notify # Send notification
34 data:
35 message: Switching off the water heater!
36 title: Water is hot!
37modesingle

Security: don't drain my battery !

Suppose the heater fails to complete its cycle due to extreme cold or simultaneous usage of other power-draining appliances. To prevent the battery from being completely depleted, I've created an automation that shuts off the heater if the battery level drops below 88%.

It's important to note that this automation is triggered only once when the battery falls below the 88% threshold. it doesn't continually monitor the battery's charge state. What does this imply?

  • You can still manually activate the heater, even under 88%, which will run its full heating cycle and then automatically turn off, as per our initial automation.
  • However, if you start the heater with a battery at 88% and it drops to 87%, you'll need to manually turn the heater back on. A minor inconvenience for the added layer of safety.
Copied!
1alias: "Heater : AUTO OFF if battery SOC < 88%"
2description""
3trigger: # Trigger only once it passed below 88
4 - platformnumeric_state
5 entity_idsensor.victron_battery_soc
6 below88
 7condition:
8 - conditiondevice
9 typeis_on
10 device_id1b6be566b42a0ba75a45fe7a7f22891c
11 entity_id7b9fe952bccc587d2713bb62dcf06ff8
12 domainswitch
13action:
14 - typeturn_off
15 device_id1b6be566b42a0ba75a45fe7a7f22891c
16 entity_id7b9fe952bccc587d2713bb62dcf06ff8
17 domainswitch
18 - servicenotify.notify
19 data:
20 message: Switching off the water heater!
21 title: Battery is discharging (<88%)
22modesingle

Security: let my AC converter breathe !

My AC converter is rated for 1600W, but struggles to maintain performance when the load exceeds 1200W. This issue comes partly from design limitations and partly from its placement, which restricts adequate airflow, causing it to overheat.

To mitigate this, I've implemented an automation that prioritizes other high-load devices, such as my rice cooker and electric bike charger, over the water heater.

Copied!
1alias: "Heater : AUTO OFF if AC load > 1200w"
2description""
 3trigger:
4 - platformstate
5 entity_id:
6sensor.ac_loads
 7condition:
8 - conditionand
9 conditions:
10 - conditiondevice
11 typeis_on
12 device_id1b6be566b42a0ba75a45fe7a7f22891c
13 entity_id7b9fe952bccc587d2713bb62dcf06ff8
14 domainswitch
15 - conditionnumeric_state
16 entity_idsensor.ac_loads
17 above1200
18action:
19 - typeturn_off
20 device_id1b6be566b42a0ba75a45fe7a7f22891c
21 entity_id7b9fe952bccc587d2713bb62dcf06ff8
22 domainswitch
23 - servicenotify.notify
24 data:
25 message: Switching off the water heater!
26 title: Another high-load device has been turned on
27modesingle

Conclusion

As of late October, I've been living with these automations for two months. During the summer, I consistently had hot water every evening. Now, as the days shorten and the weather getting worse, the availability of hot water depends on my electricity consumption throughout the day. While I prefer hot showers, I'm not against taking a cold one sometimes.

The key advantage is that I never waste solar power; it's always allocated for some use. This setup can be replicated for other power-intensive appliances, whether it's heating the van or charging an electric bike.

An added benefit is that my battery never stays at 100% charge; it generally dips below 95% before nightfall.

What I appreciate most about these four automations is their autonomy. They function well on their own, but still offer me the flexibility to manually heat water or turn off the heater in anticipation of less sunny days ahead.

#home assistant #automation

Syntax highlighting provided by torchlight.dev