Rainwater and Tanks: Liquid Level, Pump, Dry-Run Protection, Overflow, and a Water Dashboard
Rainwater and Tanks: Liquid Level, Pump, Dry-Run Protection, Overflow, and a Water Dashboard
A rainwater tank feeds the irrigation from Lesson 8 with cheaper water, but it introduces a new risk: a pump running dry can burn out in minutes. This lesson is about hard pump protection, not just a pretty water-level graph.
Dry-run protection has to work without Home Assistant
Many submersible pumps have a built-in float switch: if yours doesn't, add a separate mechanical float switch in the pump's power circuit, independent of HA. A software safeguard in an automation is a second layer, not the only one: a Wi-Fi outage or an HA restart must never unlock the pump to run dry.
Budget around 80 minutes. Example entities: sensor.tank_level_pct, binary_sensor.tank_empty, binary_sensor.tank_overflow, switch.rainwater_pump.
A Problem from Real Life: A Pump Trying to Pump Air
The irrigation script from the previous lesson fires up the rainwater pump. The tank has been empty for a week of drought: the pump runs dry, heats up, and after a few cycles like that, it burns out. A different scenario: heavy rain overfills the tank past its edge, water floods the building's foundation because nobody was watching the overflow. Both cases call for hard, independent safeguards, not just a chart on a dashboard.
Measuring Level: Three Approaches
| Method | Accuracy | Note |
|---|---|---|
| Two-state floats (full/empty) | low, but reliable | the simplest safeguard, recommended as a baseline |
| An ultrasonic/pressure sensor | high, percentage-based | needs calibrating to the tank's shape |
| A mechanical float switch in the pump's circuit | no readout, only a cutoff | a hardware safeguard, independent of HA |
A sensible combination: an ultrasonic or pressure sensor for a percentage readout on the dashboard, plus a mechanical float switch in the pump's own circuit as the last line of defense, independent of the network and of HA.
A Software Lockout for the Pump at Low Level
automation:
- alias: "Rainwater: lock the pump at low level"
id: rainwater_lock_pump_low_level
mode: single
triggers:
- trigger: state
entity_id: binary_sensor.tank_empty
to: "on"
actions:
- action: switch.turn_off
target:
entity_id: switch.rainwater_pump
- action: input_boolean.turn_on
target:
entity_id: input_boolean.pump_locked_low_level
- action: notify.mobile_app_your_phone
data:
title: "Rainwater: tank empty"
message: "Pump locked out by software. Rainwater irrigation paused."
- alias: "Rainwater: unlock the pump once refilled"
id: rainwater_unlock_pump_refilled
mode: single
triggers:
- trigger: state
entity_id: binary_sensor.tank_empty
to: "off"
actions:
- action: input_boolean.turn_off
target:
entity_id: input_boolean.pump_locked_low_level
The irrigation scripts from Lesson 8, if they draw water from the tank, should check input_boolean.pump_locked_low_level as an extra condition before starting the pump: add that condition to the script for whichever zone runs off rainwater.
A Tank Overflow Alert
automation:
- alias: "Rainwater: tank overflow alert"
id: rainwater_tank_overflow_alert
mode: single
triggers:
- trigger: state
entity_id: binary_sensor.tank_overflow
to: "on"
conditions:
- condition: state
entity_id: input_boolean.outdoor_alerts_enabled
state: "on"
actions:
- action: notify.mobile_app_your_phone
data:
title: "Tank: overflow"
message: "Water level has passed the safe edge. Check the overflow drain."
data:
importance: high
tag: "tank-overflow"
This alert doesn't control anything: the physical overflow (a pipe carrying excess water somewhere safe) has to exist independently of any automation as the base-level installation safeguard. HA only tells you something needs checking, like whether the overflow drain is clogged with leaves.
A Water Dashboard: A Card with History and Thresholds
type: vertical-stack
cards:
- type: gauge
entity: sensor.tank_level_pct
name: "Rainwater level"
min: 0
max: 100
severity:
green: 40
yellow: 15
red: 0
- type: history-graph
hours_to_show: 168
entities:
- entity: sensor.tank_level_pct
- type: entities
title: "Pump status"
entities:
- entity: switch.rainwater_pump
name: "Rainwater pump"
- entity: input_boolean.pump_locked_low_level
name: "Low-level lockout"
- entity: binary_sensor.tank_overflow
name: "Overflow"
The 168-hour (one week) graph shows the trend of use and refill: a fast drop with no rain means heavy irrigation use or a leak in the system, worth checking before the tank empties out mid-season.
Ultrasonic vs. Pressure Level Sensors: Which to Choose
| Sensor type | How it works | Pros and cons |
|---|---|---|
| Ultrasonic (on an ESP32, for example) | measures the return time of a sound wave bounced off the water's surface | cheap and easy to mount, but prone to bad readings from condensation, surface foam, and interference during heavy rain refill |
| A pressure sensor (a TL-136 transducer, for instance) | measures the pressure of the liquid column through a thin tube submerged in the tank | more resistant to interference and moisture, costs around $50, recommended when you need a stable, trustworthy reading |
If you go with an ultrasonic sensor despite its limitations, it's worth fitting the tank with a small vent (a mesh-covered opening) that reduces water vapor condensation inside, which is the most common cause of bad readings from this type of sensor.
Filtration and Rainwater Quality for Different Uses
Rainwater collected off a roof carries pollen, leaves, bird droppings, and sediment, so before using it for irrigation, it's worth adding at least a basic pre-filter (a mesh screen at the tank inlet) to keep pumps and solenoid valves from Lesson 8 from clogging. For more demanding uses, like watering edible vegetables, it's worth considering an additional filter at the pump outlet, protecting plants from contaminants that build up in the tank over time.
Submersible vs. Self-Priming Pumps: Matching the Pump to the Tank
| Pump type | Best fit | Advantages |
|---|---|---|
| Submersible | underground or deep tanks, pump sits submerged in the water | quiet operation, no issue with sucking in air |
| Self-priming (above ground) | above-ground tanks, easy service access | easier to service without pulling it out of the water, but more sensitive to running dry |
The dry-run protection described in this lesson's main content matters especially for self-priming pumps: running dry destroys the seals much faster than with submersible pumps, which stay partially cooled by the surrounding water even at low levels.
Cleaning and Maintaining a Rainwater Tank
A rainwater tank needs periodic cleaning of the sediment that builds up on the bottom, usually once every one to two years, depending on how much debris comes off the roof. It's worth planning this as part of the quarterly review from the maintenance module, checking the condition of the level sensor (ultrasonic or pressure, per the comparison in this lesson) at the same time, since it may need cleaning of sediment affecting reading accuracy after a while.
Combining Several Tanks into One Coherent System
On a larger property with several rainwater collection points (different roof sections, different outbuildings), it's worth considering a system of several connected tanks instead of one large one, which gives placement flexibility and easier future expansion. Home Assistant can monitor each tank's level as a separate entity, with one overarching automation deciding which tank to draw from at any given moment, based on comparing current levels.
Automatic Top-Off from the Municipal Supply During a Shortage
For irrigation systems fully dependent on rainwater, a long drought means the risk of an empty tank and no way to water at the most critical moment. A solenoid valve connected to the municipal water line, controlled by an automation that only fires when the tank hits a critically low level, can serve as an emergency top-off, keeping rainwater as the primary source while still not leaving the garden dry through a prolonged drought.
Winter Freezing: Why Draining the System Is Essential
Freezing water in pipes and valves splits the plumbing from the inside
An irrigation system left un-drained for winter, with water still sitting in the pipes and valves, risks cracking during a freeze, because freezing water expands and splits plastic components from the inside. Draining the system before the first hard freeze, mentioned in the checklist in Lesson 15, is one of the most important maintenance tasks for the entire irrigation system, and skipping it tends to be an expensive lesson come spring.
How to Test This Lesson
1. Simulate binary_sensor.tank_empty going "on" in Developer Tools and confirm the pump stops.
2. Physically check the mechanical float switch, if you have one installed.
3. Confirm the overflow pipe drains water to a safe spot, not toward the foundation.
Common Mistakes
The only safeguard living in HA: a restart or a Wi-Fi outage unlocks the pump to run dry.
No physical overflow: excess water spills out uncontrolled right at the tank.
An uncalibrated ultrasonic sensor: the percentage reading doesn't match the actual level.
Practical Task
☐ Install or verify a mechanical safeguard against pump dry-run.
☐ Set up the software lockout at low level and the overflow alert.
☐ Build a water dashboard with a weekly history graph.
Key Takeaways
Dry-run protection has to be mechanical, not just software.
A physical overflow is the foundation; the HA alert is just information.
A dashboard with history helps you catch a leak before the tank runs dry.
What's Next
Next lesson: Specialty Outdoor Sensors: Mailbox, Packages, Bins, the Drainage Pit, Frost, and Technical Alerts. Less obvious sensors that genuinely make everyday life easier.