Global variable after delay


Request - I’d like to be able to set a delay pending cancellation on a global variable.

Here is my use case - I have two motion sensors on opposite corners of my great room. One of the motion sensors is a bosch motion sensor that reduces activation with pets, the other is an iris V2. I want the lights to turn on only when both motion sensors are activated and then turn off when both are inactive after a delay of 4 minutes, pending cancellation.

I have a GV set by a trigger based on activation of the bosch motion sensor. then I have a rule that evaluates that GV and the activity of the other motion sensor and turns the lights on. then when false it turns off the lights after a delay.

I want it to turn off the GV after a delay pending cancellation also.

I have tried motion zone controller with triggered activation, but this does not evaluate the current value of the second motion sensor, it just triggers a window and then if the other sensor turns active it turns on.

I also recognize that motion lighting allows for something like this, but I want to be able to control this rule with other rules.


Create a rule with a delay in it and set the GV there?

I thought about that, but then it won’t be cancelled if there is motion.

It can be if you use the false actions for that. So, in your main rule, set rule truth/false and then define your delay and GV setting in each. There's a couple ways you can accomplish this. You could also just create 2 actions and call them from within your rules as well.

Motion action (sets my GV to true with a delay of 5 minutes)

good call. actually, i can actually have it run actions after a delay and cancel on truth change. so I will just have it run an action that sets that GV and i can keep all the time in the main rule.


1 Like