Monitoring your Sump Pump with Home Assistant

It’s thunderstorm season! I thought I would do a write up on how I monitor my sump pump(s) and make sure it’s running when it’s supposed to using Home Assistant. (but you could use any home automation platform really!)

I get a lot of questions about this whenever I have someone performing maintenance in my mechanical room and I thought this might be useful for others who might want to keep an eye on their pumps and make sure they’re running when expected.

2 Likes

I don’t understand how fitting a smart switch (that is monitored by home assistant) fixes this problem:

It’s entirely plausible that by the time this occurs the UPS batteries that power my Home Assistant server, network switch, router, and ISP modem will also be depleted and so Home Assistant won’t be able to notify me anyway.

1 Like

You know what? You got me thinking about this more so thank you, I appreciate that!

I updated the post with a “What’s Next” section at the bottom with some ideas. The fact of the matter is, you’re absolutely right. if Home Assistant is offline due to a power outage, this isn’t going to do anything for me, but short of paying for a monthly cellular service for Home Assistant or something else to monitor the pump status, I had a thought that I wrote in about using amateur radio :slight_smile:

I incorporated your suggestions (TP-link wattage monitoring, alerts, etc) in with having a UPS for both the Sump Pump (20 hours of backup) and for the HA server (1 hour backup) and routers. I also have a battery back-up with alarm.com with the cellular option, but haven’t yet sent alerts through that.

It’s a bit more complex than I think it should be, seems like a good area for a disruption to the market.

Read this with interest because we have just been through a major storm event and the sump pump was pushed to it’s limits even having to disconnect the piping so it had minimum discharge length minimum head simply throwing the water out the back door. It Peaking at around 300 watts and 6000 litres an hour for around 3 hours.

My thought at the time was we’re screwed if we lose power. But your numbers for your battery backup don’t make sense. Thats a low pressure bildge pump in your photo with little chance of achieving any where remotely near the volume stated against any sort of back pressure. And battery backup is not going to be able to feed a decent pump unless you have a Tesla Powerwall. As for emergency control it’s pretty simple run it flatout and risk burnout.

It was monitored and controlled by Home Assistant but during the even it was only used for manual control on the phone for clearing blockages and changing pipe work. The plumped pipework was to restrictive and prone to blockage representing around a 5 metre backpressure limiting it to around 1500 ltr/hr.

The 2 staging of the two mains powered pumps in your setup is very neat and worthwhile. The Bilge pump I suspect is of little use other than to keep minor leaks under control during a blackout. Maybe a small generator which would be useful for many things around the house or even trips.

I’m not sure if you were saying the battery backup incapable of running a decent pump was yours or OP’s; but I’m fairly certain you can run such a setup on far less than a Tesla Powerwall. We currently have 2 deep cycle marine batteries powering our backup sump-pump via inverter. This setup could hypothetically run for 2 days straight. We have field tested the setup during a day-long rainstorm, and it powered along just fine (solely from the batteries).

I’ve been doing something simple. I zip-tied a Samsung SmartThings contact sensor to the pipe coming out of my sump pump well. I use the vibration sensor only.

I know the frequency that it runs, along with how long it runs. I also set up a notification/warning if it does not run for a period of time.

I know this is an older topic so … sorry. But I’m currently trying to work with my sump pump and a Shelly plug. I have everything imported into hassio just fine but now I’m trying to find a way I can pump all of the usage data into something more friendly to view. I’d like to be able to see how many times the pump ran on a given date, for example.

You could use the counter helper to increment a counter everytime it runs and then log and clear that counter each month.

I don’t really need to count them, but I do keep a log of every time it runs along with the weather conditions. Check out this other blog post here:

(I’d really like to change this over to the Google Sheets integration, but haven’t had the time)

I built an SQL sensor to tell me the average of the time(s) between that last 5 runs. Gives me a good feel for cycles.

Also… I have a philosophical objection to putting a smart plug on a device as important as a sump pump, so I’m using a contact sensor on the discharge tube. (Accelerometer)

What did you use for the weather integration? I can’t seem to get that portion working.

Can you explain more of what you have done? I have been struggling with this. I bought a smart plug that can monitor power but decided not to use it for the same reasons, I don’t dare trust this to a smart plug that can be turned off or just go off because of something out of my control. I ended up with a Aqara Vibration monitor on the discharge pipe as it shakes pretty well when kicked on. I am new to this Home Assistant, but I want to know how much time elapses between detecting the pump started and when it started again, so I know how frequently it is running. I would prefer to know the time between states, but all I can do now is graph when it detects and when it clears. I have to manually look and count the interval between them. I know, pure novice here. The issue is the binary sensor, so I am struggling with calculations and so forth. I would love to see how you do it to better understand how I need to proceed. I then can move in to monitoring battery backup state etc. once I get down the basics.

So here’s what I’ve done…
Step 1: Attach your sensor to the discharge tube coming out of your sump pump. I’m using an old Samsung SmartThings contact sensor that has an accelerometer sensor. I’m connecting directly to Home Assistant via the ZHA integration.

Step 2: I’m using MariaDB for the Home Assistant database. This has a benefit of allowing me more history, but also allowing me to do SQL queries against the data there. I configured it like the normal way, following the general instructions. (I’m not an expert, luckily I can follow instructions)

Step 3: Set up an SQL sensor to query the Maria DB. I have a screenshot here of the configuration, but you won’t be able to read the entirety of the query. I’ve added the complete text of the query below. Basically, the sensor is averaging the time(s) between the last 5 runs of the pump. I’m using LIMIT 5, but you can change it to whatever works for you. This gives me a gauge of how frequently the pump is running.

Again… I’m not an SQL expert, I’m guessing this query could be written more elegantly, but it works.

SELECT ROUND(AVG(Difference)), AVG(Difference)
FROM (SELECT one.state_id,
	one.entity_id,
	one.state,
	one.old_state_id,
	one.attributes_id,
	one.origin_idx,
	one.context_id,
	one.last_updated_ts,
	off.last_updated_ts AS 'Previous',
	(SELECT TIMESTAMPDIFF(MINUTE, FROM_UNIXTIME(off.last_updated_ts), FROM_UNIXTIME(one.last_updated_ts))) AS 'Difference'
FROM states AS one
JOIN states AS off
	ON off.state_id = one.old_state_id
WHERE one.entity_id = 'binary_sensor.sump_pump_accelerometer' AND one.state = 'on'
ORDER BY state_id DESC LIMIT 5) AS A;

Has anyone tried to integrate Raspisump into HA?
I have been using it for years but have not looking into integrating the 2.

here is my idea of how to monitor the pump Pump Monitoring. Why do I need to monitor the pump? | by Phuwadon Danrahan | Sep, 2024 | hittheroad.dev