Rule retriggers ignoring boolean in required expression

This rule was working but has started acting strange:

Once the rule triggers, the first action is to set the boolean that is in the required expression to false. the log shows it does this, but then it triggers again even though the required expression is no longer met as shown in the logs:

Any ideas?

Is washingCompleteBool a local variable or, instead, a Hub (f/k/a global) variable? If not a local variable, is it in use by any other rule that might modify it?

I see that you are doing Run Actions of ā€œNotification - Enableā€. Is it possible that you have some rule doing Run Actions of ā€œNotification - Washing Completeā€ (i.e., this rule you showed)?

A Required Expression doesnā€™t prohibit a Run Actions from running the rule; it only prevents triggering the rule.

2 Likes

I think in the logs after the Boolean is set to False there should be a message saying expression now false, or something to that effect. So it doesn't seem to be setting the required expression false. Perhaps as @672southmain mentions try with a different type variable. If it's a global variable it should be working as I do this type of thing in many rules. If it is local that may be the issue. You can also try the private Boolean.

It's a local variable. Initially I was using a private boolean but changed it.

No "Notification - Enable" is the only rule I have that's actions are triggered by another rule. Nothing else is set to run the actions of this one, so the required expression should've stopped the rule triggering again.

Yeah I was using private Boolean but I had a few issues and needed to flip it manually (rather than create another rule to reset it). I used local rather than global as I found it helpful that its status was visible in the rule itself. If something gets out of whack I can flip it there rather than going into settings, hub variables and looking through the list.

Local variable won't work for required expression

2 Likes

Thanks for that @pseudonym - I wasn't aware. I'll either change it back to a private Boolean or a hub variable. :+1:

I had forgotten about this, too. Good catch.

Perhaps itā€™s just my advanced age, but I believe that this point ought to be documented without having to recall some obscure post made in passing that you youngsters, with perfect recall, can find.

I couldnā€™t find it in the hidden Rule 5.1 docs whose link was posted by Robert Morris (@bertabcd1234) about a month ago in the following post, which documents Required Expressions:

and I couldnā€™t find any mention of this limitation in the documentation on Local Variables, either.

Perhaps itā€™s just me, but it seems that either there should be a warning if Local Variables are used in a Required Expression, or else it should be prohibited. Yes, I saw Bruceā€™s (@bravenelā€™s) remark, in the post that Steve (@pseudonym) linked above, that they worked for some purposes, and thus werenā€™t prohibited in Required Expressions.

1 Like

The Rule 5.1 docs are still a work in progress, both in terms of getting created in the first place and getting updated for 2.3.1 (which is why they are intentionally hard to find now, though feedback is still welcome :smiley: ). However, I have added a note about the caveat with local variables in required expressions to these docs. Thanks!

1 Like