Delay Cancel not cancelling

Hello,

This rule doesn't cancel if motion is inactive.

What to I want it to do:
If there is no motion in office for 15 minutes, turn heater, office lights, and electric blanket off.

What is it doing?
It's turning it off after 15 minutes even if there was motion.

Not sure how I can make this rule better - any advice would be greatly appreciated.

thank you

the reason there is a second 0:00:30 (cancel) is becuase i can't work out how to remove that without rebuilding whole action - I had no choice but to insert an action when i build it as i chose wrong option.

When you select (cancel) against an action all you are doing is giving the action the ability TO BE cancelled.
To make the action be cancelled you have to tell the rule to cancel those actions.
Here is one for a WC light.
The Private Boolean stops the rule being continually evaluated while motion is active.
You can ignore this if you wish but this gives an idea of what you need to do.
image

1 Like

thank you. i am working today and my lights and heater are turning off constantly - so much appreciated.

does this look a bit better? it would seem tho that right at the 15 min mark, i'd have to have motion active or it will still turn off. how can i make it check anytime during the 15 min to cancel action?

There are some examples in the first post of this thread that may give you an idea on how to build rules.

Yes, it's better, but your IF will never run (only the ELSE) because your trigger is motion inactive, so "motion active" will always evaluate to false when the rule actions run (which only happens when the trigger event fires). You could switch your trigger to "changed" instead of "inactive," move your "Delay" to the ELSE, and then your rule would probably do what you want.

That being said, if this is all you want, Hubitat Simple Lighting and Motion Lighting can both do this for you with a lot less work. (I know they say "lighting," but they work with any kind of switch device.) If you want to use Rule Machine, I'd suggest reading the Rule 4.0 docs first, which contain an example almost exactly like what you're trying to do.

1 Like

In addition to chaning the trigger to changed, I also think you should move the delay 15 mins into the IF/THEN logic itself.

Probably best to have

ELSE
   OFF: Office Lights, Electric Blanket, Office Heater  ---> delay 15 minutes (cancel)

I updated it to this

i am not sure if it's working yet. i'm thinking this won't work as the cancel delay actions won't run unless it is active at that check time.

So should I have as you say Delay 15 minutes (cancel) & the cancel delayed actions after off electric blanket/heater?

No, you need remove the delay, and build it into the next line down, like below.

image

So edit your last line, and turn on delay, enter 15 mins, and then select cancel on the right (after it updates).

right. i guess i got confused as the cancel delayed action is above. so the dealyed 01:00 (cancel) must be called within in that time period if the cancel delayed action becomes true?

1 Like

That looks how I build my rules, which will do what you are hoping.

I'd also add in and ENDIF to the very end, due OCD. :smile:

1 Like

This rule does the same as your old one--either should work. A delay on one action is the same as a delay and then an action as long as you don't have anything after it (then they're different: a delay action will pause the script there, while a delay on an action delays that action but continues the script).

You're also missing an END-IF. It will silently imply one for you, but it's good practice.

1 Like