I need a little help with my RULE…
I have (3) presence sensors and want to execute different commands, based on if
ALL leave the house, or
ANY leave the house.
I thought my IF/THEN/ELSE would work, but my rule triggers multiple times if ALL leave the house, and so the THEN executes followed by the ELSE, when what I really want is only the ELSE to execute when ALL leave.
The simplest way might be to split this into two rules, one for when one person leaves and the other for when all leave. The latter’s would trigger the same as what you’re using now, but you’d IF based on checking for everyone gone, so it would only run once after all left.
To add to what @Bry mentioned, sometimes it’s preferred to create a separate variable which tracks the aggregate status (eg. if everyone is gone).
Otherwise with the current setup, if all three of you leave at the same time (within 15 seconds of each other based on the delay), then three events each will kick off the rule running, wait the 15 seconds, and all three rule executions will see that everyone is not home and run through the flow.
If you created a separate rule just for tracking the aggregate status and storing it to a variable (without any delays), then the state of that aggregation variable would only change once when all three were not present. You could then use that variable as a trigger or condition in your other rules depending on your needs.