So I have a multi-trigger (open, close & timer) automation to monitor my alarm zones. Is it possible to have a trigger (open) only run once within 5mins? I know I can use a conditional template for the whole automation (below), but since I have other triggers that I want to run within those 5 mins, this wouldn’t work.
Thoughts?
{{(as_timestamp(now()) - as_timestamp(state_attr("automation.<automation ID>", "last_triggered") | default(0)) | int > 300 )}}
If you need the throttle behavior to be specific to a given trigger the easiest approach would be to split the automation. Another option would be to create a trigger-based template sensor or helper to store the timestamp of when the automation ran based on the “open” trigger, then use that entity in your template condition.
I wanted to keep this confined to a single automation. I do like your idea of storing the timestamp of the open trigger fired in a helper. I’ll test that out.
Created an input_datetime
helper to store the last time Opened was triggered, then added the following template condition for that Choose action. Thanks @Didgeridrew
{{ as_timestamp(now()) > (as_timestamp(states('input_datetime.last_zone_opened_time')) + 300) }}