Rule for intermittent pump

Hello all. I’ve been a bit frustrated trying to navigate a rule for a smart outlet controlling a water pump. I am very new to rule machine and a bit confused. I’ve tried reading some older posts on this topic but am at a standstill.

What I’m trying to accomplish is a rule to run a pump through a smart outlet device “Recirculating Pump”

I wish it only to run when not away.
I wish it to run between the hours of 6am and 10pm
I wish it to run for 3 minutes every 15 minutes.
I wish to override it with a virtual switch “Virtual Recirculating Pump” toggle when necessary and then return to schedule

Thank you in advance.

Here's a two rule approach you could try. For the first rule I would use a periodic schedule

Rule 1

Required Expression
Time between 6:00 AM and 10:00 PM
AND
Mode is NOT Away
AND
Virtual Recirculating Pump is off

Trigger Events
Every 15 minutes

Actions to Run
On: Recirculating Pump
Wait for event: --> elapsed time: 0:03:00
Off: Recirculating Pump

Rule 2

Trigger Events
Virtual Recirculating Pump turns on

Actions to Run
Cancel Timed Actions: Rule 1
On: Recirculating Pump
Wait for event: Virtual Recirculating Pump turns off
Off: Recirculating Pump
1 Like

Thank you for responding.

Wow. I will try your suggestions. Don’t think I was even close.

1 Like

This should do what you want in a single Rule:

Thank you.

Could you suggest then a rule for my virtual recirculating pump switch to manually override this automation.

Once the manual override is discontinued would your suggested rule resume seamlessly.

What I posted above has a “Required Expression” which must evaluate to “true” for the Rule to run.

One of the things in that Required Expression is an “override” switch being off. If that switch is on, then the Required Expression is false, and the Actions will not run. As soon as you turn off that switch, the next time interval could have the Required Expression evaluate to true. You’d still need for it to be between 0600 and 2200, and for your Mode to not be “away”. But if those conditions re also met, then the Actions will run.

You don’t need to do anything to cause this to occur. The Required Expression is evaluated each time the Trigger occurs.

I do see I actually messed up the Rule a bit. You want to NOT have “Cancel pending actions when Required Expression becomes false” set, and you do NOT want the delay to be cancelable. The reason for NOT wanting those things is, as written, the above Rule has a 3 minute window each time it runs where, if the Required Expression becomes false (such as if you leave the house, or it’s after 2200, then it would cancel the Delay and (I think) cancel the pending “Off” command, leaving your plug on.

Personally, for things like this, I’d lean toward having a separate Rule (and I think “Basic Rule” would work here, for simplicity) set with a trigger of your plug turning on, then have it wait 3 minutes, then turn it off. This way no matter how the plug is turned on, it’l turn back off after 3 minutes.

Assuming you really don’t want the plug running more than 3 minutes, I’d suggest this: I have some hydroponic pumps that absolutely must not ever run continuously so I actually set the plug’s firmware to turn back off after 90 seconds (my ‘run time’ in my case). Even if they’re disconnected from Hubitat entirely, they still won’t run longer than my defined 90 seconds. If your plug has an “auto off timer” option where you can set it to automatically turn back off after a predefined amount of time, I’d use it.

Thanks Daniel for the detailed explanation. Slowly but surely from people like you I’m learning more about rule machine. Very steep learning curve. Unfortunately the zigbee outlet I have doesn’t have a timeout function but I like the way you constructed the rule. Very helpful and appreciated.

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.