If trigger and action refer to the same switch, will this cause a loop?

I have a rule with several triggers such as presence, temperature change, and switch change. If the action involves toggling the same switch used in the trigger, then will the rule be triggered again repeatedly?

Is there a cooldown option per rule to prevent this?

Likely so.

There are a couple of ways to handle this. The most common way is by using the "private boolean" which is a boolean variable that exists within each rule. The boolean defaults as true and then can be turned false while the rule is running. A defined expression based on the boolean will prevent the rule from executing more than once.

Here's an example of a rule using private boolean to prevent multiple occurrences - not quite your use case but you get the idea.

1 Like

Probably.

There's a few ways to do this. Off the top of my head, you can have your first action be to set a private boolean to false. Make a required expression for the rule as "private boolean=true"...that would prevent another run. Just add another action for "private boolean=true" whenever you are ready for the rule to run again.

1 Like

@brad5, @FriedCheese2006: thanks for essentially the same tip! So was wondering what that private boolean was for...
For the last action of setting the Private Boolean back to True, if I add a delay of 60 seconds to that action, then wouldn't that essentially be a 60 second cooldown?

I haven't used it for that but it sounds logical!

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