Shutting something off after power usage exceeded for X minutes

Hi, I have a coffee grinder that my employees are sometimes leaving on after they use it. As it’s an expensive piece of equipment and runs fairly silent with no lights, I need to make sure it turns off. I have it hooked up to a smartthings outlet with a power monitor, there are 2 devices I have on this switch one of them constantly draws 58 watts and the grinder pulls around 140 watts when on, 0 when off. I am trying to find a way to shut it off if the power usage is above a certain level for X number of minutes. The power switch on the grinder is a momentary switch so if the power is shut off on the outlet, it will stay shut off if the switch is powered back on. So it’d be nice if I could just power cycle the switch instead of another routine to turn the switch back on.

Any suggestions?

TIA

Look up webCoRE. It’s “The” rule engine to cook up all kinds of automations. This one is pretty simple.

If power stays below 60 watts for 2 minutes
Then using outlet
Turn off
Wait 10 seconds
Turn on

1 Like

Thanks I spent around 10 minutes trying to figure out webcore. The installation instructions aren’t correct as there is no settings button to add the repository but I probably just need to poke around a bit more.

Hi thanks for this information. I got webcore up and running. The script is working but the problem is either polling or reporting. The script does not run unless I refresh the power outlet and it shows the current power consumption.

From what I’ve read the power outlet should only report a change in the power usage. How do I get this to refresh so that the script will run? This outlet is the Iris Zwave outlet, square model I got at Lowes.

Maybe try one of the other options. There is a a option that says stays greater than and you then set a time limit. It would be one statement, you should not have to do anything to get the device to poll.

1 Like

As stated, use Stays…

Thanks, using stay and the code looks a lot cleaner now. But still the same problem, the device is not reporting the power change so it doesn’t work unless I refresh the outlet from within the Smartthings app.

The outlet is model 3210-L. Looking at the event logs in the API it only reports the power usage when I refresh the device. I am starting to think this is a limitation of the outlet so hoping there’s a way to either poll/automate refreshing or enable it to send status changes.

Ok I found the issue. The device handler was SmartPower Outlet. In the API, current states only showed switch and power. So I changed it to SmartPower Outlet V1 which doesn’t have the power feature. So then I switched it back to SmartPower Outlet. Then I saw I had gained an additional state which was CheckInterval. Now the device reports the power soon after I turn the grinder on. So the device handler seemed to be the issue, not sure why switching it back and forth fixed it.

Now this is working perfectly. Thank you so much everyone for your help!

1 Like

I have a few of those myself, but I don’t have any setup to monitor power. Which DTH are you using?
I am just using the default one now, but I know there are a couple of others out there. Maybe it is a problem in the DTH.

Maybe try one of these.

1 Like

I “almost” use the Iris (same model you have) exclusively for power monitoring. I find that power monitoring has more useful benefits than just on/off Automations.

For example, I just did this Piston, which is really close to your usage to turn off a power supply that uses 40 watts by just being on:

1 Like

I am having a similar issue as Badfish. I am new to WebCore but borrowed rontalley’s code and set up so if my shallow well pump stays running for more than an hour it will turn off the switch to prevent the pump from burning up. Rontalley’s code works perfect when testing using a Fan and with a simple Neo Zwave switch using just the built in SmartThings Power Metering Switch Device Handler.

The problem I am having is with the Zooz high voltage device which is need to handle the shallow well pump. The code runs fine and will alert if the switch is turned on, will alert if the switch is turned off and will alert if the switch “stay greater” than X power for X minutes however with the Zooz device the code just loops at notifying and never makes it to the turn off part of the code. Looking at the trace in WebCore the stay greater part of the code will turn green as it should when the power exceeds the value for the defined time but then after a few seconds go back to red causing the loop. I have tweaked every reporting interval in the device handler for the Zooz device and even tried using just the power metering device handler with the Zooz plug with the same results.

Any suggestions?

It’s been a while but this is my code below. Hope it helps.