Rm 5.1 Boolean trigger fires even if value does not change

RM 5.1 Ver 2.2.9.146
I noticed some of my rules running even though the boolean trigger value did not change. I made a test rule and sure enough when a trigger was a hub boolean, and it was set to false when it was already false, the trigger fired.

When you set the variable to false, even if already false, that does generate an event with value false. So yes, that will trigger the rule looking for that event. In this regard, variables are not like devices, where ordinarily an event with no state change is discarded by the hub.

I'm not sure if this is how it should be, and will look into it further.

4 Likes

As a work-around while we get this sorted out, use a Predicate rule that the variable must be true. That way, your rule will only trigger on a true transition from true to false, and not by a false-to-false event.

4 Likes

Yes, thank you. Now that I know how it works, I can adjust my code. It's just not very intuitive to me it would work that way. I have never programmed in a language that did.

I look at illuminance whenever it changes and set IlluminanceOverThreshhold true or false. Until the threshold is reached, it will be set false every time illuminance changes. This boolean is used as a trigger for almost all my lighting. I'll add logic to not set it to its current state.

The Predicate could do that for you, prevent it from being triggered unless a state change.

Like this?

Yes, that will do it.

1 Like

I'd say it's probably better in the long run to be consistent. Or is it like that because an event has to fire in order to cause the value to be passed to any connector there may be?

It's an oversight on our part. It will get fixed.

1 Like