Hey folks - I have a rule that reminds me that my garage doors are open. I have two garage doors, and opening either triggers the rule to start repeating. Every 30 minutes (starting 15 minutes after the door is opened), I get a message on my phone to remind me that the doors are open. This works great, unless I open both garage doors at the same time. This sometimes causes multiple instances of the rule to run simultaneously, leading to multiple alerts happening every 30 minutes.
Any thoughts to how to prevent a second instance of the rule from running in a more foolproof manner than I have below? I tried to set a variable which helps but still doesn't catch all cases.
Here is an example of the triggers happening simultaneously (the virtual switches are being pushed by IFTTT integration), and consequently, two alerts happening 15 minutes later.
- 2021-10-09 11:47:25.070 am info - Both garage doors have been open since 11:32 AM
- 2021-10-09 11:47:25.047 am info - Both garage doors have been open since 11:32 AM
- 2021-10-09 11:32:24.008 am info - Setting Garage-Door-Alert-Running global variable to true.
- 2021-10-09 11:32:23.993 am info - Setting Garage-Door-Alert-Running global variable to true.
- 2021-10-09 11:32:23.819 am info - Garage Door Alert - Start Triggered
- 2021-10-09 11:32:23.819 am info - Garage Door Alert - Start Triggered
- 2021-10-09 11:32:23.601 am info - Garage Door Side - Virtual Switch was turned on
- 2021-10-09 11:32:23.601 am info - Garage Door Main - Virtual Switch was turned on
Here is the rule...
Triggers: Garage Door Main - Virtual Switch, Garage Door Side - Virtual Switch(off, off) any turns on
IF (Variable Garage-Door-Alert-Running(false) = false(T) [TRUE]) THEN
Log: 'Setting Garage-Door-Alert-Running global variable to true.'
Set Garage-Door-Alert-Running to true
Delay 0:15:00
Repeat every 0:30:00 (stopable)
IF (Garage Door Main - Virtual Switch, Garage Door Side - Virtual Switch(off, off) all is on(F) [FALSE]) THEN
Set Display-Name to 'Both garage doors have'
IF (Variable Garage-Door-Main-Open-Time(02:45 PM) > Garage-Door-Side-Open-Time(11:32 AM)(T) [TRUE]) THEN
Set Display-Time to Garage-Door-Side-Open-Time(11:32 AM)
ELSE
Set Display-Time to Garage-Door-Main-Open-Time(02:45 PM)
END-IF
ELSE-IF (Garage Door Main - Virtual Switch(off) is on(F) [FALSE]) THEN
Set Display-Name to 'Main garage door has'
Set Display-Time to Garage-Door-Main-Open-Time(02:45 PM)
ELSE
Set Display-Name to 'Side garage door has'
Set Display-Time to Garage-Door-Side-Open-Time(11:32 AM)
END-IF
Notify iPhone M: '%Display-Name% been open since %Display-Time%'
Log: '%Display-Name% been open since %Display-Time%'