Garage tilt sensor template - delay before state change

I have a garage door open/close sensor set up on two different doors using a Smarthings multipurpose sensors and a notification for when they open or close. Everything works well for the most part. I am getting an issue where when the door sometimes shakes when it hits around 200 tilt and I’ll get an open->closed->open notification back to back.

Off another post, it looks like I can add a condition to delay it triggering again for 2 seconds which would work for notifications.

  - condition: template
    value_template: "{{ ( as_timestamp(now()) - as_timestamp(state_attr('automation.garage_door_notification), 'last_triggered')) | int(0) ) > 2 }}"

But I’d prefer to do get the sensor to not switch on, off, on to begin with. Is there a way to get the sensor to only switch to on after the event data has been > 200 for greater than 2 seconds? This is how I have the sensor set up currently.

- trigger:
  - platform: event
    event_type: zha_event
      device_ieee: '28:6d:97:00:01:0c:73:35'
        attribute_name: "z_axis"
  - name: "Garage Door 2 Status"
    unique_id: garage_door_2_status
    device_class: garage_door
    state: >
      {% if > 200 %}
      {% else %}
      {% endif %}

You probably have a reason not to, but seems the easiest thing would be to use the “for:” option in the automation that generates the notification.

Thanks, that is a lot simpler to keep the notification from getting the extra triggers. I’m still learning the ins and outs of how to do all this stuff, and a few times I’ve realized I’ve skipped the simple solution and overdone it a bit.

No worries, done the same too many times to count.