It’s possible to do but it will take some logic.
I would probably go this route:
Create a counter that starts at 0.
docs:
Create a script that starts the timer-delayed-script, the outcome of this script would be to reset the counter instead of turning off the light.
alias: Light Timer
sequence:
- delay:
minutes: 2
- service: switch.turn_off
data:
entity_id: switch.entry_s_switch_17_0
create a script that cancels the timer and restarts it.
alias: Door is Open
sequence:
# Cancel ev. old timers
- service: script.turn_off
data:
entity_id: script.light_timer
# Set new timer
- service: script.turn_on
data:
entity_id: script.light_timer
Then in your automation, add a condition to check the counter. If the counter is less than 1, fire the notification.
This isn’t the “correct” way to do it, its just one way to do it. I’m sure some other minds could come up with a different solution.
Basically what would happen here is that you would fire your notification, it would add a count to the counter. At the end of the timer, the counter would be reset to zero. Any time the event is fired within 2 minutes of a previous event, it would restart the timer and increment the counter. It wouldn’t reset until there was a full 2 minutes of no movement.