Wait_for_trigger check to see if script was run again?

I have been working with the notification service to call an actionable notification on our iPhones using the following script:

alias: Garage Motion Critical Push Actionable Notification Script
sequence:
  - variables:
      TURN_OFF: "{{ 'turn_off_' ~ context.id }}"
      CANCEL: "{{ 'close_' ~ context.id }}"
      TAG: "{{ 'tag_' ~ context.id }}"
  - service: notify.all_devices_notification_group
    data:
      title: Garage Motion Detected
      message: Stop Notifications?
      data:
        url: /lovelace-mobile/garage/
        clickAction: /lovelace-mobile/garage/
        tag: "{{ TAG }}"
        persistent: true
        visibility: public
        entity_id: camera.sidmesh_garage
        push:
          sound:
            critical: 1
            volume: 1
            name: US-EN-Alexa-Motion-In-Garage.wav
        actions:
          - action: "{{ TURN_OFF }}"
            title: Start Again After 1 Hour of No Motion
          - action: "{{ CANCEL }}"
            title: Leave On
  - wait_for_trigger:
      - platform: event
        event_type: mobile_app_notification_action
        event_data:
          action: "{{ TURN_OFF }}"
      - platform: event
        event_type: mobile_app_notification_action
        event_data:
          action: "{{ CANCEL }}"
    continue_on_timeout: true
    timeout: "3000"
  - choose:
      - conditions:
          - condition: template
            value_template: "{{ wait.trigger.event.data.action == TURN_OFF }}"
        sequence:
          - service: input_boolean.turn_off
            data: {}
            target:
              entity_id: input_boolean.announce_garage_motion
      - conditions:
          - condition: template
            value_template: "{{ wait.trigger.event.data.action == CANCEL }}"
        sequence:
          - stop: ""
    default:
      - service: notify.all_devices_notification_group
        data:
          message: clear_notification
          data:
            tag: "{{ TAG }}"
mode: parallel

This is currently working well, but in the current script the notification will stay on the user’s iPhone screen waiting for a response for 3000 seconds, at which time the notification is cleared from the iPhone, assuming the script received no response. I did this to prevent multiple notifications from stacking up if the user is not monitoring his/her phone. A better solution, for me, would be to have a third ‘wait_for_trigger’ option that fires when the script is run again, killing the current notification using the ‘clear_notification’ service, and only leaving the current notification on the user’s screen. This would, in theory, just leave the most recent notification for the user to respond to.

So, my question is, how do I check to see if this script has been run again? Something like, {{wait.trigger.event.entity_id == script.garage_motion_critical … }} ? I am just not familiar with how to check if this script runs again ? I need someone much smarter than me :laughing:

Thank you.