Rule 5.1 Predicate and Repeat While/Until Rule

Bruce, (@bravenel), two questions about the new Rule 5.1 improvements. I looked, but couldn’t find the answer.

  1. Predicates:

If a Predicate is false, are trigger events dropped or, instead, are they queued, such that they fire the rule’s actions when the Predicate becomes True? I can imagine use cases for either design, but knowing the answer is helpful for designing complex Rules.

  1. Repeat While rule, Repeat Until rule:

If a succession of OR conditions becomes True, or a succession of AND conditions becomes False, does evaluation of the rule stop and execution of the actions begin without evaluation of the remaining conditions, or, instead, is the entire rule expression evaluated and then tested? Could be useful to know when ordering the rule expression. Also, is order of evaluation guaranteed to be the written order of the conditions (sub rules) in the rule?

Thanks in advance.

They don't happen, no queuing. If Predicate is false, subscriptions to trigger events are removed, so the rule is not triggered at all. When the Predicate becomes true, the event subscriptions are recreated, and the rule will be triggered again. Even with subscriptions active, the last state of the Predicate is checked before any actions are run, and if false, the rule exits. Net: Predicate false means the rule is not triggered.

Correct, it is a strictly left to right evaluation, and once something to the left of OR is true, or the left of AND is false, it returns true or false and stops evaluating. Of course, you have to take into account parenthetical grouping, but this will hold true for any sub-rule as well.

3 Likes

Download the Hubitat app