Condition that x seconds have passed since rule was last run

I want to switch my front lights on when motion is detected by my front door camera.

To this end I have the camera calling a URL linked to a rule when motion is detected. The rule works and the lights switch off after 5 minutes. My problem is that the lights switching off triggers a new motion event so the rule is triggered again, and again, and again.

What I'd like to do is create a condition that says that "at least 5 minutes and 10 seconds have passed since the last time the rule was active". I can set the time that the rule was last fired into a variable, is there a way to add difference between current time and the variable time to the condition?

Thanks

Probably don't need to. Can you post a screenshot of the rule?

Setting the variables is me trying things.

I'd suggest this approach: Add a SET PRIVATE BOOLEAN (for this rule) to FALSE as your first Action. Then, for the last Action, introduce SET PRIVATE BOOLEAN (also for this rule of course) to TRUE, with a delay of 00:05:10.

Then, by including in REQURED EXPRESSION another entry, namely "PRIVATE BOOLEAN == TRUE", you assure that the rule will only fire at the cadence defined by the delay above. Does that make sense?

4 Likes

Exactly where I was headed.

1 Like

Thank you guys, great idea!!!

2 Likes

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