Getting automation to only fire if it hasn't for x minutes

I have automations for my cameras on motion, and I’d like to only have them fire if they haven’t done so for x amount of minutes. The automations themselves work without condition.

I have input_datetime helpers for each, set the condition to fire after it, and have a service update it to now + 10 minutes, but it only fires once.

alias: Front camera motion
description: ""
  - type: motion
    platform: device
    device_id: ff76489da76483cda7ec08dec6743367
    entity_id: binary_sensor.front_motion
    domain: binary_sensor
  - condition: time
    after: input_datetime.ftimer
    enabled: true
  - service: tts.speak
      cache: true
      media_player_entity_id: media_player.kfsuwi
      message: Motion at front door
      language: en
      entity_id: tts.google_en_com
  - service: input_datetime.set_datetime
      entity_id: input_datetime.ftimer
      datetime: "{{ now() + timedelta(minutes = 10) }} "
mode: single

Any help would be appreciated.

Have you looked at the automation trace to see why it isn’t firing again?

  - condition: template
    value_template: |
      {{ now() > this.attributes.last_triggered | default(as_datetime(0), 1) 
      + timedelta(minutes = 5) }}
1 Like

OK so I nuked one of the automations and it’s associated helper, recreated them exactly as they were, and it worked. I have no idea why.

I know it wasn’t working as none of them had been triggered for nearly a day. Maybe there was an extra space somewhere, or a random ascii char, idk, I literally just copy/pasted it from the original.