I was suggesting a hard coded solution for a set number of notifications.
The following basic structure may look primitive, but I find it to be more customizable, with zero chance of an infinite loop.
IF Door’s contact stays open for 121 sec <-- Trigger
Then
Send first notification (friendly reminder)
Wait 2 minutes
IF Door’s contact is open <-- Condition
Then
Send second notification (slightly aggressive)
Wait 2 minutes
END IF
IF Door’s contact is open <-- Condition
Then
Send third notification (stress the urgency)
Flash (centrally located light) briefly
Wait 5 minutes (notice I changed this)
END IF
IF Door’s contact is open <-- Condition
Then
Send fourth notification (Get off your butt!)
Flash one light in each of the main rooms
Voice Alert (Alexa/Google/Sonos etc)
Wait 5 minutes
END IF
IF Door’s contact is open <-- Condition
Then
Send fifth & last notification (slowly drags index finger across throat)
Turn on one light in every room
Send Urgent SMS to home owners
END IF
END IF
Pro Tip:
The last block can also send a SMS to a trustworthy neighbor… In case the logic gets that far down in the code without the door closing. (although I would not add that code during testing, LOL)