I suggest native support for rate limiting automations.
There is a forum thread suggesting different solutions how to rate limit automations:
However, these are either quite verbose, like adding a separate script that disables, delays and enables the automation, or rely on script sematics that prevent running a script twice in parallel.
It would be easiest to be able to specify the rate limit directly in the automation definition, for example
automation:
- alias: 'Some notification'
trigger:
...
condition:
...
# No more than once per 5 minutes
rate_limit:
minutes: 5
action:
service: notify.notify
data:
message: 'Some notification'
Iām not sure where it would be best to put the rate_limit expression ā in the trigger, condition or at the top level?
Turns out that adding a delay at the end of an automation action only works if the automation runs a script and the delay is at the end of the script. Putting a delay directly inside the automation action doesnāt rate limit the automation. Apparently, HA runs the automation action even when the previous delay hasnāt ended.
I agree a ārate_limitā would be better. Iām starting to see the need for that with my speech automations. I only want to hear about the thermostat every so often.