I'm trying to trigger a warning to occur if a door is left open for 4 minutes, and again if it is still open after 8 minutes. In RM4 I had two rules, one for each case duration, using the old-school pattern of triggering on the contact changed event, then in the OPEN case using delayed events for the warning, and in the CLOSED case cancelling delayed events. Both rules have EXACTLY the same structure except for the length of the delay.
These rules are much cleaner using Sticky Triggers: the four-minute version would look like:
Trigger Events:
- Master Bedroom door open and stays that way for 0:04:00
Actions:
- Notify My Phone: %device% left open since %time% (at %now%)
- speak('Quick! Close the Master Bedroom door before the cat gets here!', 100, 'Marlene') on Master Bedroom Speaker
This works really well. If the door is left open, the warning happens, and if it is closed within 4 minutes, nothing happens (in the logs it shows the Sticky Trigger failing when the door closes, as expected).
Next, I thought I would combine both rules into one, since the only difference is the duration of the Sticky Trigger:
Trigger Events:
- Master Bedroom door open and stays that way for 0:04:00
- Master Bedroom door open and stays that way for 0:08:00
Actions:
- Notify My Phone: %device% left open since %time% (at %now%)
- speak('Quick! Close the Master Bedroom door before the cat gets here!', 100, 'Marlene') on Master Bedroom Speaker
Now, I start getting warnings at 8 minutes, even if the door is already closed at 8 minutes. Am I misunderstanding the semantics of two stick triggers? I assumed that the triggers would run independently, so if the door is open for 1 minute I get no warning; if it is open for 7 minutes, I get a warning at 4 minutes, and if it is open for 10 minutes, I get two warning, at 4 minutes and again at 8.)
[quote="jmason888, post:1, topic:91454, full:true"]
I'm trying to trigger a warning to occur if a door is left open for 4 minutes, and again if it is still open after 8 minutes. In RM4 I had two rules, one for each case duration, using the old-school pattern of triggering on the contact changed event, then in the OPEN case using delayed events for the warning, and in the CLOSED case cancelling delayed events. Both rules have EXACTLY the same structure except for the length of the delay.
These rules are much cleaner using Sticky Triggers: the four-minute version would look like:
Trigger Events:
- Master Bedroom door open and stays that way for 0:04:00
Actions:
- Notify My Phone: %device% left open since %time% (at %now%)
- speak('Quick! Close the Master Bedroom door before the cat gets here!', 100, 'Marlene') on Master Bedroom Speaker
This works really well. If the door is left open, the warning happens, and if it is closed within 4 minutes, nothing happens (in the logs it shows the Sticky Trigger failing when the door closes, as expected).
Next, I thought I would combine both rules into one, since the only difference is the duration of the Sticky Trigger:
Trigger Events:
- Master Bedroom door open and stays that way for 0:04:00
- Master Bedroom door open and stays that way for 0:08:00
Actions:
- Notify My Phone: %device% left open since %time% (at %now%)
- speak('Quick! Close the Master Bedroom door before the cat gets here!', 100, 'Marlene') on Master Bedroom Speaker
Now, I start getting warnings at 8 minutes, even if the door is already closed at 8 minutes. Am I misunderstanding the semantics of two stick triggers? I assumed that the triggers would run independently, so if the door is open for 1 minute I get no warning; if it is open for 7 minutes, I get a warning at 4 minutes, and if it is open for 10 minutes, I get two warning, at 4 minutes and again at 8.)
(In connection with Feature Request: RM5.1 Time Since Event exceedds %some_variable%, if there is a way to add a variable to Time Since Event, this feature also has exactly the same setup.)