ESPHome Custom Sensor for Well Pump Pressure Tank Cycles
Monitoring well pump pressure tank cycles with ESPHome lets you catch a waterlogged bladder tank, a failing pressure switch, or a short-cycling pump long before it burns out your motor. This guide walks through building a custom sensor setup in ESPHome that counts pump cycles, tracks run time, and pings you in Home Assistant the moment something looks off, using parts you’ve probably already got in a drawer somewhere.
Why Monitor Pressure Tank Cycles at All?
A healthy well pump system cycles on and off pretty rarely, maybe every few minutes during active water use, not every few seconds. When a pressure tank loses its air charge (waterlogging) or the bladder tears, the pump starts “short cycling”: switching on and off rapidly, sometimes dozens of times a minute. Here’s what that costs you:
- Motor life drops fast, sometimes a pump rated for 10+ years dies in two or three
- Electricity gets wasted running a motor that barely needs to work that hard
- Nobody notices until the pump dies outright, and it’s always at 6am on a Sunday when you need a shower
Most pressure switches and tanks ship with zero telemetry. No gauge, no alert, nothing. ESPHome closes that gap for the cost of a cheap board and a clamp sensor.
What You’ll Need
- An ESP32 or ESP8266 board (go ESP32 if you can, better ADC accuracy and more GPIO to play with)
- A current transformer (CT) clamp, like the non-invasive SCT-013-000, to read pump motor amperage without ever touching line voltage
- A burden resistor matched to your CT clamp (33Ω is the common value for ESPHome’s standard CT setup)
- Optionally, a pressure transducer (0.5-4.5V analog output, something like a 0-100psi sensor) wired through a voltage divider to keep it within safe ADC range
- A dry enclosure near the pressure tank or well pressure switch, since this stuff doesn’t love moisture
The CT clamp route is the safest option here. You clamp it around one of the motor’s supply wires and never make direct contact with line voltage at all.
ESPHome Configuration: Detecting Pump State
Start by reading motor current through the built-in ct_clamp sensor platform, then derive a simple “pump running” boolean from it using a template binary sensor:
sensor:
-
platform: ct_clamp sensor: source_sensor name: “Well Pump Current” update_interval: 1s id: pump_current
-
platform: adc pin: GPIO34 id: source_sensor attenuation: 11db update_interval: 1s
binary_sensor:
- platform: template name: “Well Pump Running” id: pump_running lambda: |- return id(pump_current).state > 1.5; filters:
- delayed_on: 500ms
- delayed_off: 500ms
The delayed_on/delayed_off filters debounce the noise, so a brief current spike from a fridge compressor kicking in nearby doesn’t get logged as a fake cycle.
Counting Cycles and Measuring Run Time
Next, add a counter that bumps up every time the pump flips from off to on, along with a running tally of total run duration:
sensor:
- platform: template name: “Pump Cycles Today” id: pump_cycles_today accuracy_decimals: 0 unit_of_measurement: “cycles”
binary_sensor:
- platform: template name: “Well Pump Running” id: pump_running on_press: then:
- sensor.template.publish: id: pump_cycles_today state: !lambda ‘return id(pump_cycles_today).state + 1;’
Reset the counter once a day, either in ESPHome itself or through a Home Assistant automation, so you end up with a clean “cycles per day” number you can compare against a normal baseline (for most households that’s somewhere between 20 and 60 cycles a day, depending on household size and fixture count).
Setting Up Home Assistant Alerts
Once those entities show up in Home Assistant, build an automation that flags short-cycling before it becomes a real problem:
- Trigger:
Well Pump Runningturns on - Condition: time since the last “on” event is under 60 seconds
- Count repeated triggers in a 5-minute window using a
triggerhelper or a counter entity - Action: fire off a mobile notification, something like “Well pump short-cycling detected, check pressure tank air charge”
A workable rule of thumb: if the pump cycles more than 6 times in 5 minutes with no obvious heavy water draw happening (no sprinklers, no laundry, nobody filling a pool), that’s a solid sign of a waterlogged tank.
Interpreting the Data
- Long, infrequent cycles (pump runs a minute or two, rests 5+ minutes) = tank is healthy
- Short, frequent cycles (pump runs 5-15 seconds, over and over) = check tank pre-charge with a tire gauge at the Schrader valve, tank empty, pump off
- Cycle frequency creeping up over weeks = early bladder wear, worth watching in a Home Assistant history graph before it turns into a full failure
Conclusion
An ESPHome custom sensor takes a silent, failure-prone corner of your home (the well pump and pressure tank) and turns it into something you can actually monitor. A CT clamp, a handful of YAML lines, and a couple of Home Assistant automations buy you early warning on waterlogged tanks and short-cycling pumps. That’s potentially hundreds of dollars saved on a pump replacement, and no more waking up to a dry well on a Sunday morning.