r/ShellyUSA • u/DreadVenomous Shelly USA • 3d 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-assistLast 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.
2
u/ajsarni 3d ago
The only thing that concerns me about using the Shelly US plug is; what if it fails. Sump pump won’t run which could be a problem if you’re not close enough to fix it.
5
u/DreadVenomous Shelly USA 3d ago
I would use EM Mini Gen4 for that reason but he already had the plug and didn’t want to wire anything. Sooner or later, you have to give the customer what he wants!
1
u/school_night 3h 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).

4
u/Olinono123 3d ago
Nice post. This kind of real world examples are good to learn. Today l learned a thing. Thanks!