Every 10 seconds my automation starts with webhook, but i only want it every 30 sec max

Hi,

i have a doorbell camera, when motion is detected , it sends a webhook , so my automation starts with a notify service … but motion is detected every 10 seconds, so every 10 secs my automation starts, so i have 3 messages , i only want one …

how can i easily solve this in an automation itself? or do i need to create some extra timer sensor, that counts from 0 to 30 , and my automation fires based on that automation? i think it can be simpler?
i also added a delay for 30 seconds at the end of the automation, but that doesnt help …seems multiple same automations can be fired

here is my current automation with webhook event

thnx


- alias: 'Deurbell webhook SS' 
  hide_entity: true
  trigger:
    - platform: webhook
      webhook_id: deurbel
  action:
  - service: camera.snapshot
    data_template:
      entity_id: camera.deurbel
      filename: !secret snapshot_deurbel    
  - service: notify.html5
    data_template:
      message: "Er staat iemand aan de deur!"
      title: "Deurbel"
      target:       
        - !secret notify_html5_1      
      data:
        tag: alert
        image: !secret snapshot_buiten_deurbel_webhook
        vibrate:
          - 300
          - 100
          - 400
        renotify: 1 #(do not notify when replace message)/1(notify again)
        ttl: 86400
        priority: high
        url: !secret camera_url
  # - delay: '00:00:30'

Try adding this condition:

  condition:
    condition: template
    value_template: >
      {% set last = as_timestamp(state_attr('automation.deurbell_webhook_ss', 'last_triggered')) %}
      {{ last is none or as_timestamp(now()) - last > 30 }}

This will check when the automation last triggered. It will let the actions run only if the automation has never triggered (i.e., last is none), or if it last triggered at least 30 seconds ago.

Ah, gonna try that… Thnx!!