[Reactor] Variables not updating correctly in latest-25201-2aa18550
-
After updating to latest-25201-2aa18550, I found that an old rule (probably 2-3 years old) has started experiencing a weird behavior.
As you can see from this screenshot:It seems that while rain variable is false and wind is true, debugmessage (and other similar variables) are not updated correctly. If I press on the Play Icon on the variable inside the rule, it is then updated. It was working OK previously, so maybe it's the new version.
As you can see from this screenshot, the first one is updated manually, but the second one is still showing the old value:
The rule has just some action in the SET part doing notifications and calling MQTT endpoints for logging.
Anyone with the same problem? /cc @toggledbits
-
No changes have been made to variable evaluation for some time. Definitely no changes for 25201.
In your
raintripped
variable, you make reference tobadweather_trigger
andbadweather_lastevent
, but the source for those isn't shown. If their values don't change (even if they are evaluated by some other mechanism),raintripped
will not be updated. The use oftime()
does not generate any continuous evaluation, so this (raintripped
) variable is entirely dependent on those other two variables changing value (not just being evaluated). Same applies towindtripped
.If you have been editing these, particularly the deep dependencies like
debugmessage
, you probably will need a restart to get a full deep dependency scan. Current versions of Reactor can't do a full-depth scan when you edit a variable and add dependencies in mid-run. So I recommend a restart after making changes when the dependencies may run deeper than one level. -
I'm 100% sure it used to work before. I did a restart and nothing changed.
I have "Force re-evaluation of expressions and conditions" in the rule and I was under the impression that was forcing updates. Now back to change a couple of rules that have the same problem. I'll move them to Script Action to set the values, but as I said I'm 100% sure it used to work OK before.
Thanks. -
Clearly there's a lot of context you haven't posted, so I really don't have enough to go on.
I can tell you that if a rule is in mid-evaluation, the re-evaluation of variables and triggers in the same rule won't happen instantly or more than once -- infinite loops have to be prevented. What will happen is that a request for re-evaluation will be queued for later, but it's not deterministic when that runs (except that it won't run before the current evaluation completes). If there's already a pending request for re-evaluation queued, new requests are ignored. This is all to prevent infinite loops in rule evaluations where rules manipulate devices and rule-based variables in Reactions that are also part of the rule's dependencies.
And to be specific, the "Force re-evaluation" only queues a request to re-evaluate the rule's triggers and local variables at some point in the future. It does not instantly and immediately re-evaluate every dependent variable of the variable being set.