Smart water heating off-grid with Home Assistant & Victron
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
- Turn OFF when the water is hot
- Security: don't drain my battery !
- Security: let my AC converter breathe !
- Conclusion
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.
1alias: "Heater : AUTO ON when battery almost full" 2description: "" 3trigger: 4 - platform: numeric_state # If battery is >98% for 2 minutes 5 entity_id: sensor.victron_battery_soc 6 for: 7 hours: 0 8 minutes: 2 9 seconds: 010 above: 9811condition:12 - condition: device # Heater is OFF13 type: is_off14 device_id: 1b6be566b42a0ba75a45fe7a7f22891c15 entity_id: 7b9fe952bccc587d2713bb62dcf06ff816 domain: switch17 - condition: numeric_state # The load on the AC is low18 entity_id: sensor.ac_loads19 below: 20020 alias: No other device is using the AC converter (<200W)21action:22 - type: turn_on # Turn on the heater23 device_id: 1b6be566b42a0ba75a45fe7a7f22891c24 entity_id: 7b9fe952bccc587d2713bb62dcf06ff825 domain: switch26 - service: notify.notify # Send a notification to my mobile device27 data:28 message: "Heater on ! "29 title: Battery full !30mode: single
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.
1alias: "Heater : Auto OFF when not using power" 2description: "" 3trigger: 4 - platform: state # Monitor battery state of charge 5 entity_id: 6 - sensor.victron_battery_soc 7 - platform: state # Monitor heater power usage 8 entity_id: 9 - sensor.shelly_1pm_power10condition:11 - condition: and12 conditions:13 - condition: numeric_state # if battery below < 95%14 entity_id: sensor.victron_battery_soc15 below: 9516 - condition: device # if heater is on17 type: is_on18 device_id: 1b6be566b42a0ba75a45fe7a7f22891c19 entity_id: 7b9fe952bccc587d2713bb62dcf06ff820 domain: switch21 - type: is_power # if heater is not heating < 100W22 condition: device23 device_id: 1b6be566b42a0ba75a45fe7a7f22891c24 entity_id: 1548f61ecfeceb0e0919e95615edb35025 domain: sensor26 below: 10027 alias: Not using any power28action:29 - type: turn_off # Turn OFF30 device_id: 1b6be566b42a0ba75a45fe7a7f22891c31 entity_id: 7b9fe952bccc587d2713bb62dcf06ff832 domain: switch33 - service: notify.notify # Send notification34 data:35 message: Switching off the water heater!36 title: Water is hot!37mode: single
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.
1alias: "Heater : AUTO OFF if battery SOC < 88%" 2description: "" 3trigger: # Trigger only once it passed below 88 4 - platform: numeric_state 5 entity_id: sensor.victron_battery_soc 6 below: 88 7condition: 8 - condition: device 9 type: is_on10 device_id: 1b6be566b42a0ba75a45fe7a7f22891c11 entity_id: 7b9fe952bccc587d2713bb62dcf06ff812 domain: switch13action:14 - type: turn_off15 device_id: 1b6be566b42a0ba75a45fe7a7f22891c16 entity_id: 7b9fe952bccc587d2713bb62dcf06ff817 domain: switch18 - service: notify.notify19 data:20 message: Switching off the water heater!21 title: Battery is discharging (<88%)22mode: single
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.
1alias: "Heater : AUTO OFF if AC load > 1200w" 2description: "" 3trigger: 4 - platform: state 5 entity_id: 6 - sensor.ac_loads 7condition: 8 - condition: and 9 conditions:10 - condition: device11 type: is_on12 device_id: 1b6be566b42a0ba75a45fe7a7f22891c13 entity_id: 7b9fe952bccc587d2713bb62dcf06ff814 domain: switch15 - condition: numeric_state16 entity_id: sensor.ac_loads17 above: 120018action:19 - type: turn_off20 device_id: 1b6be566b42a0ba75a45fe7a7f22891c21 entity_id: 7b9fe952bccc587d2713bb62dcf06ff822 domain: switch23 - service: notify.notify24 data:25 message: Switching off the water heater!26 title: Another high-load device has been turned on27mode: single
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.
Syntax highlighting provided by torchlight.dev