Automation not working as intended

HI All,

I have an automation that tells me my gate is open, with an action notification to close the gate if i hit the button on the actionable notification, it doesnt seem to be working as it automitaclly closes the gate without me pressing the button.

can someone tell whats wrong in the code? for now ive had to disable the switch turn trigger to close the gate to prevent it from automatically closing the gate by itself

description: ""
trigger:
  - platform: state
    entity_id:
      - binary_sensor.gate_2
    to: "on"
    for:
      hours: 0
      minutes: 10
      seconds: 0
condition: []
action:
  - service: notify.mobile_app_sm_n986b
    data:
      message: TTS
      data:
        ttl: 0
        priority: high
        media_stream: alarm_stream
        tts_text: Gate Left Open
      title: "Gate Left Open "
  - service: notify.mobile_app_sm_n986b
    data:
      title: Actionable
      message: "Gate Left Open "
      data:
        actions:
          - action: CLOSE_GATE
            title: Close Gate
          - action: URI
            title: GO to Page
            uri: /lovelace-new/0
  - wait_for_trigger:
      - platform: event
        event_type: mobile_app_notification_action
        event_data:
          action: CLOSE_GATE
        context: {}
    timeout: "00:00:10"
    continue_on_timeout: true
  - service: switch.turn_on
    target:
      entity_id: switch.sonoff_100114d268_1
    data: {}
    enabled: false
mode: single 

You have a timeout of ten seconds with a continue: true, so presumably if you do nothing, the gate will close in 10 seconds on its own.

So I must just set cont to false? That all?

Yes.

or remove the timeout or make it longer. Because if you keep the 10 seconds timeout, even with the false option, and you don’t respond within 10 seconds, you won’t be able to action it even if you wanted to.(until the next event fires, which I presume will be never as the gate wont open or close again without manual intervention)

If you remove or extend the timeout, and you never action the gate close using the notification action, I think the script will hang there forever, so you might want to make its mode: restart as well. Or maybe you want it to hang there, waiting for you.