Don’t allow automation to run if has already been run within last X minutes

When the following is used in the automation’s action section, it will get the latest value of last_triggered.

state_attr('automation.presence_home_mode_home_away', 'last_triggered') 

If you recall from my explanation above, last_triggered is updated before executing the action section.

I think I understand that. Any reason my template above wouldn’t work?

last_triggered < 2 seconds
OR
last_triggered > 5 minutes

See the explanation in my previous post.

I’m still missing something. Yes, I understand last_triggered gets updated before the action section. That’s why I suggested that my template conditional be true if last_triggered < 2 seconds or last_triggered > 5 minutes.

Am I still missing something?

I suggest you try what you proposed and observe the result.

The automation’s trace may be useful to understand its behavior.

This came in handy for my application, but I believe the last line should be:

datetime: "{{ now() + timedelta(hours = 1) }} "