Tracking the number of times a Sump Pump runs using Sonoff S31

Hello, so I am currently using a Sonoff S31 flashed with ESPHome to track power consumption on a few devices around the house. As a result, I can count the number of times a day my Sump Pump runs.

I am watching the Current sensor for any values over 0 Amps as when the sump pump is idle there is 0 draw. The problem with this method is that if the pump runs for under 5 seconds it may miss the run as I have update interval on the current sensor to 5 seconds.

By chance is there a better method for this to watch current state in realtime vs a pull every 5 seconds?

Could you use an on_value_range trigger and manually publish a binary sensor state as an action?

That should be a “push” approach…

interesting, but not sure, this would still require the original sensor to notice the change and then update the binary sensor. Which the snsor is polling at 5 second intervals, i mean i guess you could drop it lower interval but thats really getting aggressive

My answer assumes the gpio12 runs the sump pump. If it does, my solution will work without polling at all.

1 Like

If Nick’s solution doesn’t fit, then you could potentially look at dropping the update interval to 1sec but marking the orginal sensors as internal. And use the above approach on the internal current sensor.

Then you could have some “copy sensors” of the orginals and throttle them to 5 sec etc. So internally they are calculating at 1sec but only push data to HA every x seconds.

I think that could work.

Alternatviely you might be able to wrap them into a single sensor (without using “copy”) if you use a combination of a 1sec update interval, an on_raw_value to trigger the binary sensor publish (with some lambda logic for the >0), and a throttle filter to dial it back to 5 secs etc.

unfortuantely not, there is nothing smart about the sump pump itself, it just has a standard float that runs the pump when required. all I am doing it watching power consumption.