Monitoring your sump pump level with Home Assistant
You can easily monitor your sump pump to determine:
- What's the current water level?
- How often is the pump going on?
- Is the pump working?
To accomplish this task we use an ultrasonic range finder sensor. We can then measure the distance from the sensor to the top of the water level:
By examining the history of the level we can determine how often the pump runs (or if it is running at all). This data can then be used to create alarms indicating issues. For example, Here's the graph during a heavy rain storm where we can see the sump pump runs almost constantly. Only a couple minutes after the pump drains the pit the pit fills back up and the pump has to run again.
What you'll need:
- Ultrasonic Range Finder Sensor
- WiFi Board like the ESP8266 D1 Mini
- Hook-up wire, or contact us to pre-connect the devices for you
Here's the sensor wire-tied to the discharge pipe pointing down into the pit.
You'll notice there are two pumps in this pit: A primary AC powered pump and a DC powered backup pump. In a future post we'll show how to automate the backup pump.
ESP Home YAML
The ESP Home Code is trivial:
esphome:
name: sump_pump_level
platform: ESP8266
board: d1_mini
wifi:
ssid: "XXXXX"
password: "XXXXX"
# Enable fallback hotspot (captive portal) in case wifi connection fails
ap:
ssid: "Sump Pump Level Fallback Hotspot"
password: "Lk3Lj0dUfEEw"
captive_portal:
# Enable logging
logger:
# Enable Home Assistant API
api:
password: "XXXX"
ota:
password: "XXXX"
sensor:
- platform: ultrasonic
trigger_pin: D1
echo_pin: D2
name: "Sump Pump Ultrasonic Level"
Automation to notify if the level is too high.
We can then create an automation in Home Assistant to send a notification if the water level is too high. Here' we check if the sensor value is < 0.25M for > 2Min (the pump kicks on at about 0.27M). The automation then shuts down for 2 hrs before restarting and checking again.
alias: sump_pump_level_warning
description: ''
trigger:
- type: value
platform: device
device_id: a1ffdf9781d3485c9bef89560ce1f711
entity_id: sensor.sump1_ultrasonic_sensor
domain: sensor
below: 0.25
for:
hours: 0
minutes: 2
seconds: 0
condition: []
action:
- service: notify.mobile_app_iphone
data:
message: Sump Water Level is Too High
title: Sump Warning
- service: automation.turn_off
data: {}
entity_id: automation.sump_pump_level_warning
- delay: '02:00:00'
- service: automation.turn_on
data: {}
entity_id: automation.sump_pump_level_warning
mode: single