Power Unchanged for x minutes

Hello,
I have a PC I access remotely, and typically need quick access. So I have it always on.
I have connected a zigbee power meter switch, which monitors and reports the power usage every 30 seconds. Once in a while though, the PC becomes unresponsive to remote access, and When I realize that ( I try to access it but cannot). I just turn the switch off and then on.. and then wait for 2-3 minutes for it to come back to life.
What I have observed is that.. the times when it becomes un responsive, the power usage is absolutely constant ( the power usage value is stuck, just like the PC) .
So I was wondering if I can create a rule in RM, where the trigger is setup that.. if the power meter value is unchanged for 5 minutes ( i.e gets to a value, and stays at EXACTLY that ), then run the actions to turn the switch OFF and then ON.
The Value typically it gets stuck between is about 60-80 watts.
What are my options ?

Something like this should work for what you asked:

Trigger events:

(device name) power *changed*

Actions to run:

Wait for event: elapsed time --> 0:05:00
Off: (device name)
On: (device name)

The key here is that a trigger event cancels a "Wait" (see: Rule 5.1 | Hubitat Documentation), so if you get a new power event within 5 minutes, the rest of those actions will never run.

If you want to be a little restrictive, you could add:

Required expression:

(device name) power between 60 and 80 W

You might also need to insert a small delay between the "Off" and "On" actions (or just set a delay on the "On" action itself) in case the switch doesn't like those two commands in a row that fast -- or you want to give it a few seconds in between for whatever reason, as you might if this is a computer like it sounds like it is.

(Obligatory comment that I'd try to figure out what's wrong with the computer first, but ... just answering the question. :slight_smile: )

3 Likes

Hello,
thanks for this..added the RM... now, waiting for it to become unresponsive.

for your "obligatory comment".. unfortunately, the PC becomes unresponsive maybe 1 every 2-3 weeks ( and that too randomly). Also, most of the times it happens between 4 am to 5 am (dont know exactly when, I only realize it when I try to access it ).. so I am not that motivated to figure it out :stuck_out_tongue:

I also had another idea, and created a ping device, and setup a RM, that does pings, every minute, added a global variable with how many pings failed, and if three consecutive pings counter failed.. then would restart..
Also added a notification of when exactly it becomes unresponsive ( to get more info, and maybe troubleshoot it in the future. as it stand now, since it is happening once every 2-3 weeks, randomly, I can live with that by just restarting.