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:

Sump 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.

sump level during heavy rain

What you'll need:

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.


The ESP Home Code is trivial:


  name: sump_pump_level

  platform: ESP8266

  board: d1_mini


  ssid: "XXXXX"

  password: "XXXXX"

  # Enable fallback hotspot (captive portal) in case wifi connection fails


    ssid: "Sump Pump Level Fallback Hotspot"

    password: "Lk3Lj0dUfEEw"


# Enable logging


# Enable Home Assistant API


  password: "XXXX"


  password: "XXXX"


  - 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: ''


  - type: value

    platform: device

    device_id: a1ffdf9781d3485c9bef89560ce1f711

    entity_id: sensor.sump1_ultrasonic_sensor

    domain: sensor

    below: 0.25


      hours: 0

      minutes: 2

      seconds: 0

condition: []


  - service: notify.mobile_app_iphone


      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