Goal: If any door is left open for longer than 20 minutes, notify. When closed, notify 'thanks'
I have the trigger set as door stays open for 20 minutes, then capture the device name, notify - then wait for all doors to be closed - and then notify again 'thanks for closing'.
It often works perfect, but something's amiss because it isn't always the right door. For example, right now the "Screen Door" is open, yet "Mud Door" is what was captured? Any ideas?
You are having the same issues as Wrong triggered %device%. Basically, you’ll have two options: 1) individual rules or 2) using a local variable to track the devices. There is an example at the end of the thread that would work for a single rule (Wrong triggered %device% - #16 by pseudonym).
Ah, that looks like exactly my same situation. Looks like I can manage it will within one rule, just bed to define conditions for each and sequence the IF statements. Thanks all!!
Essentially, as we saw in your rule, it waits for any of the triggers to remain on for the duration, and will show the last trigger. I suspect that this is the intended functionality.
In order for this to work the way you’d like, to show what triggered the rule the first time, you would need to cloned the rule and each clone would be triggered by one of the events.
First, select one of the triggers, then clone the rule - you will be offered the option to modify the trigger to the 2nd one. Do this until you have one rule each.
Not sure if this can be done, but adding a toggle to the trigger that would allow to select if the first or the last trigger should be the recorded within the “%devices%” could be a way around this. Tagging @bravenel in case this might be of interest.
Why?
If I said I would give $100 if anyone who could hold their breath for ten minutes, should the person who just closed their mouth get the money or the one turning blue?
Did some further testing and one use case that certainly could be a problem is where the switch 1 is turned on, then 2 is turned on, then 1 is turned off…
I believe this apparent bug with multiple triggers with "stay" (or wait for multiple event with "duration") was previously observed elsewhere, but hasn't been confirmed by staff to my knowledge :
I can reproduce that %device% can be set wrong in this case. A fix for that will be in the next release. When stays is used, %device% will be set to the device that stayed, not the most recent one to have been touched as it is now.