In State Triggers you can add a “For” time period, for example if an occupancy sensor changes to detected for 5 seconds it will trigger after 5 seconds.
For other sensor like door/window or camera person detection, I want to trigger immediately when the state changes to open/detected, but I don’t want additional triggers in the next minute if, for example, the door is opened/closed multiple times, or additional persons are detected.
With and “After” time period I could specify 60 seconds and the trigger wil only execute if the last time the state changed was 60 seconds or more ago, but won’t trigger if it was less than 60 seconds ago.
In other words, the sensor will be debounced for the next 60 seconds after the first state change.
The default script mode is “Single” which means that only one instance of the script can be running at a time. So, you can “debounce” by putting a delay at the end of the script so that it does not let any other instances of the script start until the delay is complete.
I have automations with multiple triggers that I want to throttle based on a long period, such as once per day, so I use a template to check against the last_triggered attribute condition like:
This works because last_trigged is only updated if the automation’s conditions pass, and not every time one of its triggers is activated. It will work after a restart unlike setting a delay action, and doesn’t require creating/starting/checking a separate timer to persist after restart.
If the Time condition could also be configured to use an entity attribute and a time offset, then it could be used to do the same thing, but it would be nice to have a dedicated condition that only requires a time offset from the automation’s last execution.