Required Expression is False, but Trigger still runs the Actions

I have a rule that has a Required Expression with 3 conditions

As shown, the Required Expression is False (F and F and T) but when the Trigger is true, the Actions run.


and here is the log

Show the whole rule log that show when the RE evaluated as false. Also include the date and time. If your not aware, clicking on the app # will list only logs relevant to this app.

I seem to recall seeing some issues with multiple required expressions on a same device, but it was for the same property. I wonder what would happen if you removed either the cooling or temperature from the required expression…?

1 Like

It's a bit of a shot in the dark without seeing the entire rule, but I might consider changing the trigger to Operating state of Ecobee cooling and then using a while loop with your other two conditions. I use a similar approach to control some HVAC dampers.

Of course that doesn't get to the root of why your existing setup isn't working. That part I can't help with. :man_shrugging:

Oh I’m sure there are many different ways to accomplish the same result. I’m just more concerned that the Required Expression seems to not be working properly (bug?)

1 Like

The first thing I would do is just open the rule and select Done (or Update Rule - same thing except it doesn't close the page) to re-initialize things and make sure all the subscriptions, etc. for the required expression and trigger events are set correctly. If the behavior persists, a screenshot of the entire rule and the logs, filtered to just this app, would probably be the most help for figuring out where there might be a problem (similar to what you provided above, just with less cut out).

Something else you might try: if this is Rule 5.0 or earlier, try re-creating it in Rule 5.1. Older versions will keep working but usually don't get much attention, so whatever might be happening there is best considered a feature at this point (if that is, indeed, the situation). :slight_smile:

1 Like

That cleared things up :+1:

I also learned more about why Required Expression gets in this funky state from this thread Required Expression false .. but it isn't

Great! However I can’t help but think that the temperature part of your required expression is redundant with the trigger. Couldn’t you simply replace the trigger with it?

A required expression changing in evaluation does not cause a trigger. Only a trigger event will (when the required expression is true, if this feature is used--and ignoring other possibilities like manually running or calling from another rule). There might be other ways the rule could be written, but not much can be said without seeing the whole thing--probably not necessary foenrhe original problem at this point. :slight_smile:

1 Like

I was only pointing out that both are subscribed to a temperature change event on the same device, with the trigger not having any conditions on that change.

There is some subtlety that arises when the trigger and the Required Expression are looking at the same device event, as in this case. RM should handle this case correctly, barring some bug no one has reported and I haven't seen. In this case, both the trigger and the Required Expression use the same event handler (stHandlerA), and that subscription does not go away when the Required Expression is false (because it's needed to know when the Required Expression becomes true). So that handler has to deal with both cases, the possible change of truth of the Required Expression and the possible trigger event.

The sequence is that if the Required Expression is true when an event for that device attribute happens, it will first trigger the rule (assuming its value would trigger it), and then it will re-evaluate the truth of the Required Expression. If the Required Expression is false, the rule isn't triggered, and it proceeds to the expression evaluation. The net result is that the rule can only trigger if the Required Expression was true before the event, and irrespective of that, the truth of the Required Expression is re-established. If the Required Expression becomes false in this evaluation, then all trigger subscriptions are removed, but this one that serves both purposes is re-established.

1 Like

I was just testing this and that is indeed what I observe:

Moreover if the rule concerns HVAC straight temp comparisons can be brittle depending on the sensor ("and stays that way for X" could be your friend here) and that's better handled in the trigger AFAIK. In fact I don't see an "and stays" option in the required expression UI.

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