My sump pump died on a Tuesday in March, and I did not find out until I stepped off the basement stairs into two inches of cold water on Saturday. The pump had been sitting there, plugged in, breaker on, float bobbing uselessly on a seized impeller, while a week of snowmelt filled the pit and then the room. Nothing told me. The pump had no brain, and the pit had no voice.
This is the build log for making sure that never happens silently again: an ESP32 running ESPHome watching a high-water float and the pump’s own power draw, Home Assistant correlating the two, and an alert that reaches me before the water reaches my drywall. It is local first, it cost about the price of one emergency plumber visit, and unlike the “smart” sump gadgets on the shelf, no company can turn it off with a bad firmware push or a discontinued app.
Why Not Just Buy a Smart Sump Sensor
There are boxed products for this. Some pump makers sell a Wi-Fi float that pings their app, and there are standalone “sump pump wifi alarm” gadgets that do roughly what I am about to build. I looked hard at them, and I want to be fair: if you buy one, mount it, and it alerts you the day your pump dies, it did its job and I am glad you are dry.
Here is why I did not buy one. The intelligence lives in the vendor’s cloud. The float talks to their servers, the servers decide it is an alarm, and the servers push a notification to the vendor’s app. That is three points of failure I do not own, guarding the one appliance in my house whose failure mode is measured in thousands of dollars of drywall and flooring. When a sump alerting product gets discontinued, or the company folds, or the app stops getting updates and eventually breaks on a new phone OS, your flood alarm quietly stops working and nothing tells you it stopped. A silent failure guarding against a silent failure is the worst possible design.
I wanted the alerting brain in my own basement, on hardware I control, making decisions that execute even if every server on earth went dark. That points at ESPHome and Home Assistant.
Step 0: Understand How Your Pump Fails Before You Buy Anything
Do this first, because it decides which sensors you actually need. Go look at your sump setup and answer three questions.
Where is the pit, and how high can water safely rise before it reaches the floor? Measure the distance from the pump’s own float trigger point up to the lowest point where water would escape the pit (usually the top of the liner or the floor slab). That gap is your safety margin, and it tells you where to mount the high-water float: above the normal pump-on level, but with enough room left that when it trips you still have minutes, not seconds.
Is the pump plugged into an accessible outlet, or hardwired? If it is a normal plug in a nearby GFCI outlet, you have the easy path: sense current with a clamp or a plug-through meter, zero electrical work. If it is hardwired into a junction box, you will clamp a current transformer around one conductor inside that box, which means comfort working near the panel.
Do you have a backup pump or battery backup already? If yes, you will want to monitor it separately, because the whole point of a backup is that it runs when the primary has failed, and you desperately want to know when your last line of defense kicks in. If no, budget for one, because a monitor tells you about a flood but does not stop it.
Ninety percent of finished basements are: pit near a GFCI outlet, primary pump only, a foot or so of safety margin above the pump-on line. If that is you, order an ESP32 board and a vertical float switch and keep reading.
The Hardware
- An ESP32 development board, around $8. This is the whole brain. It runs ESPHome, connects to your Wi-Fi, reads the float and the current sensor, and reports to Home Assistant over your LAN. Get one with screw terminals or solder headers so you can wire the float cleanly.
- A vertical float switch, around $12. This is a simple two-wire normally-open switch that closes when water lifts the float. Mount it above the pump’s own trigger point. It is a dumb, mechanical, extremely reliable part, which is exactly what you want guarding a flood.
- A way to sense pump power. Two honest options here. The zero-work path is a plug-through energy monitor like the Emporia Vue smart plug family, which reports draw with no wiring. The tidier path for a hardwired pump is a clamp current transformer feeding an ADC pin on the ESP32.
- Optionally, a Zooz ZEN16 MultiRelay, around $30, if you want a dry-contact way to trigger a local siren or a backup pump relay directly from Z-Wave without depending on Wi-Fi at all.
- Optionally, a ThirdReality Zigbee water leak sensor 4-pack, around $40, placed flat on the basement floor around the pit as a last-ditch “water is already on the floor” tripwire.
Total for the core build: about $30 for the ESP32, float, and a plug-through meter. Call it one tenth of what a single flooded-basement insurance deductible runs, paid once, for hardware you own and firmware no vendor can revoke.
Step 1: Mount the High-Water Float
Kill power to the pump at the breaker before you reach into the pit. Then mount the vertical float switch to the discharge pipe or a length of PVC zip-tied to the pit wall, positioned so its trigger point sits a few inches above where the pump’s own float turns the pump on, and below the top of the pit. You want a band of water level that means “the pump should have handled this by now and did not.”
Run the float’s two wires up out of the pit to wherever the ESP32 will live. Keep them well away from the pump’s power cord. This is a low-voltage signal circuit and it stays completely isolated from anything mains. Leave a drip loop so water running down the wire drips off before it reaches your board.
Step 2: Sense the Pump’s Power
This is the sensor that lets you tell a dead pump from a busy one. A high float alone cannot distinguish “pump is working hard on a big storm” from “pump is dead and water is rising.” Power draw settles it.
If you took the plug-through route, plug the pump into the energy monitor, plug that into the GFCI outlet, and you are done. The draw shows up in Home Assistant directly. If you are clamping a current transformer, snap it around one conductor of the pump’s cord or one wire inside the junction box, and feed its output through a burden resistor into an ADC pin on the ESP32. Never open the pump’s power connections unless you are genuinely comfortable and the breaker is off.
Step 3: The ESPHome Config
Here is the core of the ESPHome YAML. Wi-Fi credentials live in a separate secrets.yaml and are referenced with !secret, so nothing sensitive is ever in this file.
esphome:
name: sump-monitor
esp32:
board: esp32dev
wifi:
ssid: !secret wifi_ssid
password: !secret wifi_password
api:
encryption:
key: !secret api_key
logger:
binary_sensor:
- platform: gpio
name: "Sump Pit High Water"
pin:
number: GPIO13
mode: INPUT_PULLUP
inverted: true
filters:
- delayed_on: 2s
- delayed_off: 2s
sensor:
- platform: adc
pin: GPIO34
name: "Sump Pump Current"
update_interval: 2s
attenuation: 12db
filters:
- multiply: 30.0
The delayed_on filter debounces the float so a single slosh does not trip an alarm. The current sensor here is a simplified CT read; if you use a plug-through meter instead, you skip this block entirely and pull the power sensor straight from that device in Home Assistant. Flash it with esphome run sump-monitor.yaml, adopt the device in Home Assistant, and you now have two local entities: a high-water binary sensor and a pump current sensor.
Step 4: The Automation That Actually Matters
The naive automation alerts when the float trips. The good automation correlates. Here is the logic, in plain terms: if the pit is high AND the pump has been drawing near-zero current for more than a minute, that is a dead-pump flood in progress, and it should wake me up. If the pit is high AND the pump is drawing current, that is a hard-working pump during a storm, which I want logged and maybe a gentle heads-up, but it is not a five-alarm event.
alias: Sump pump failure alert
trigger:
- platform: state
entity_id: binary_sensor.sump_pit_high_water
to: "on"
for:
minutes: 1
condition:
- condition: numeric_state
entity_id: sensor.sump_pump_current
below: 0.5
action:
- service: notify.mobile_app_phone
data:
title: "SUMP PUMP FAILURE"
message: "Pit is high and pump is drawing no power. Go check the basement now."
- service: light.turn_on
target:
entity_id: light.basement_siren_bulb
data:
color_name: red
flash: long
That local light action is deliberate. Even if my internet is down, that red flashing bulb and a local siren fire, because the ESP32, Home Assistant, and the light all live on my LAN. The phone push is the nice-to-have; the local scream is the guarantee.
The Cloud Backup That Nobody Can Brick
Here is the honest tension in a local-first build: the storm that floods your basement is often the storm that knocks out your internet, and a local siren does no good if you are at work. So I do keep a cloud path, but I keep it as an addition, not a dependency, and I make sure it cannot be unilaterally revoked.
Home Assistant Cloud (Nabu Casa) gives me reliable remote push notifications that fund the project I already depend on, and if it ever went away, my local alerting would not even notice. For true storm resilience I put the ESP32, my router, and the Home Assistant box on a small UPS, so a power blip does not blind the monitor at the exact moment the pump loses power too. The layering matters: local siren first, cloud push second, battery backup underneath all of it. Every layer degrades gracefully instead of taking the whole system down with it.
What This Caught in the First Month
Three weeks after I finished this build, the high-water float tripped at 4:40 in the morning during a heavy rain. My phone lit up, the basement bulb was already flashing red when I got downstairs, and the current sensor told the real story: the pump was drawing normal power. It was not dead. It was just badly outmatched by the volume of water, and the discharge line had partially frozen at the outdoor exit, throttling the flow.
A dumb alarm would have screamed “pump failure” and sent me looking in the wrong place. Because I had power data, I knew the pump was fine and the problem was downstream, and I cleared the discharge line instead of wasting twenty panicked minutes on a healthy pump. That is the whole argument for correlating two signals instead of trusting one.
The Bottom Line
A sump pump is the one appliance in your house whose silent failure is measured in insurance claims, and the factory version of it has no voice at all. You can give it one for about thirty dollars and an evening of work, and when you build it yourself on ESPHome and Home Assistant, the alerting brain lives in your basement instead of on a server you do not own and a company that might not exist in five years.
Buy the cheap ESP32 board and the dumb, reliable vertical float switch, add a way to sense the pump’s power draw, and write the one automation that correlates high water against no power. Put it all on a UPS, add a battery backup pump if you do not have one, and drop a couple of ThirdReality leak sensors on the floor as a final tripwire. Do that, and the next time your pump seizes at 4 a.m., you will be standing over a dry pit with a flashlight instead of stepping off the stairs into cold water on a Saturday. I have been on both sides of that, and local monitoring is the cheapest peace of mind I have ever bought.