Rule Machine AND

I would assume that if I have multiple trigger events in a rule that it would wait until all of the events are true before performing the action. What I am finding is that the rule action occurs if any of the events occur. This is acting more like and OR statement rather than an AND statement.

Here is my Capture

It's not generally the case that multiple trigger events all need to be "true" before a rule will trigger; trigger events are just events, which are just an instant in time and cannot be "true" or "false" per se. (This gets more complicated with the latest Rule 5.1 update that adds "sticky triggers," which check that the state resulting from such an event remains true for a certain period of time.) Regardless, any trigger matching will cause the rule actions to run.

However, you have a single "all" trigger here. This is also a more nuanced approach that should wait until all the devices (in that particular trigger) reach the desired state before truly triggering. See the new "all devices for triggers" option in Rule 5.1, as described here: Sticky Triggers and Other New Rule 5.1 Features

So, if that's what you're seeing, I'd say it's a bug. @bravenel would be the one to look into this. You'll probably get farther with log entries that verify the issue (I haven't tried to replicate), but perhaps there is a problem he can see offhand...

1 Like

I thought triggers were meant to be OR'd except the question was referring to the first trigger that wants "all"

Yes, all devices is new in the 2.3.1. That won't fire until all of the devices are in the indicated state, or in other words, it fires when upon the event of the last of the multiple devices attaining that state.

1 Like

That is not what I am seeing here at least not with the other rule I am running. I built a dashboard and when any of the devices close, the stat will go back to cool. Then they go to off after a second door has been opened for the time delay that I have created. The cool on rule runs even though a device is still open as I can see it toggle the thermostat in the dashboard.

Here is the other rule.

Question as thus may be interpreted a couple.l of ways.

Ie device one turns true , later device 2 and even later device 3. Does it fire even if device 1 has flipped back to false. Ie do all have to be true at the time it fires or not?

Thanks in advance.

1 Like

All have to be in the state.


And, there is a bug with this.

Fix in the next release.


Fix for this is now released:


downloaded and tried it. If the original door closes and another is open, the thermostat goes back to cool and then delays for 20 seconds then turns it back off. The fix should start at the beginning of the AND statement and check that all are closed. It does not appear to be doing this. I would expect the AND rule to stop when it encounters any door that is open so i would never expect the thermostat to re-enable until all doors are closed.

Do you know what? I think I'd make the door combination into the predicate for each rule - "all off" and "any on" then use the door changing state as the trigger for them and use a wait and test again action for the second. However, it's been useful doing it your way if it's helping to test the Stays trigger.

Are you suggesting to create a trigger for each door individually and then wait before testing the next door? My ultimate goal is to have a delay time of 5 minutes so it seems like that would take forever to play out. I only used twenty seconds so I wouldnt have to wait an eternity for it to change.

No... but actually my idea might not be that good after all. a) I don't actually know if predicates support AND and b) if they do, they might have the same problem. I'll have a go at making the rule and see.

I've had another think and I'd probably turn it into just one rule, which triggers if any of the doors you are interested in changes state. And have conditional actions so if all the doors are "off" the mode cools, and if any of them are on, it waits the 20 seconds, and checks again. Not exactly what you wanted as it won't necessarily be the same door still open....

I had more time to test this and downloaded the latest release this morning. It appears to be working as I no longer see the toggle from cooling to off. However if any two doors are open, the system immediately goes to off. I would expect it to wait the 20 seconds before shutting off. If I open 1 door, it waits the 20 seconds but as soon as I open 2, the system turns off. Here are my rules. Is this a bug or should I be doing this some other way?

Could you turn on all Logging for the rule with stays for 20 seconds, and show what happens with a screenshot of the logs.

So I turned on the logs and can’t get the issue to repeat itself. It does appear to be working now. If I can break it again, I will let you know.

Thank you for your support and attentiveness.

Download the Hubitat app