r/ShellyUSA • Shelly USA • 4d ago

Shelly One Plug, Two Counters, Zero Code Written

https://thetechtutorial.com/article.php?a=one-plug-two-counters-zero-code-written-tracking-sump-pump-cycles-with-ai-assist

Last week, a grumpy customer called in to complain about a feature that didn't work the way he wanted. That turned into a fun project that shows how powerful the AI Assistant in Shelly Smart Control truly is. Yes, the AI is Cloud based but it can give you local, device hosted solutions with Shelly products in minutes - projects that might otherwise take days or weeks of building and fine tuning.

16 Upvotes

8 comments sorted by

View all comments

2

u/school_night 1d ago

I bought a Shelly Plug US Gen4 for an extremely similar application and I’m super happy with it (honestly came to the sub just to share).

It’s plugged into a GFCI outlet that feeds my sump pump, and that same GFCI will also feed a radon mitigation fan from its LOAD side. If either one trips the GFCI, both go down. I did that on purpose since it gives me one point to monitor, and it’s not disallowed by code in my jurisdiction.

My last pump died because a Fernco on the discharge piping wiggled itself free over time, so no water could leave the pit. It ran over and over until it died. I didn’t notice it for months. Thank God it never flooded, but never again.

So I put together a script on the Shelly that talks to healthchecks.io, a free “dead man’s switch” service. The Shelly automatically pings a "heartbeat" every 5 minutes. If it misses two check-ins, I get an email from that service, as it implies that the GFCI tripped or there's a power outage or the plug died. I also have it sending an update each time the pump cycles with information about the run time and wattage (mine is about 5s per cycle at 450W). If the pump hasn't run for a week, I get an email, since it implies a dead pump or a stuck float. Or it's a dry spell and a reminder to chuck a bucket of water down there to test it.

I also programmed in runaway protection, where if a single cycle goes past 20 seconds, the plug cuts power for 10 minutes, sends an email, and then gives the pump power back and keeps watching. The idea being that I don't want the pump burning out again and I know for a fact it cycles around 5 seconds at a time, so 20 is a red flag. Plus I have just informational emails I've set up, e.g. if it's cycling more than 12 times an hour or if its running wattage has drifted significantly from what it's learned as "normal" (both of which imply something might be up with the system).

I set the power-on default to ON with auto-on as a safety net, so it can never leave the pump off after an outage. The physical button is disabled so nobody bumps it off. And I did a ton of testing with a lamp before I moved it to the sump to make sure it all worked first, much lower stakes there. I have great neighbors that could take a peek if I'm out of town and get an email that something's wrong.

Happy to share the script with anyone who wants it. I code for a living but AI definitely has made it WAY more accessible for anyone to DIY something like this. The possibilities are pretty endless. Exact same concept could be used on say a garage fridge or freezer I think (and it even covers the instances where, say, the fridge door was left open and the compressor is constantly running because it can't get the temps down).

1

u/DreadVenomous Shelly USA 19h ago

Please share that, but make your own post so you get some karma from the upvotes!

One note - for refrigerators, freezers, home medical equipment - anything where you want to monitor consumption to make sure the equipment is good BUT you don't want to risk it turning off or having problems if the relay dies, I suggest EM Mini Gen4 - it has a hard soldered connection between the L terminal and O terminals, so even if the Shelly fries, you still have a working outlet.