Help on wait for trigger and action if trigger does not come

I am trying to achieve the following:
If any of the door sensors in a group trigger and actionable notification is sent to the iphone. At this moment a sound of a ticking clock plays warning me to disable the alarm or tak another action.
This all works.

What i want is if NO action is taken after 30 seconds that my phone plays another sound and the sirens around the house go off. I can not get that to work so on timeout or plain after 30 seconds play that sounds file,

This is my config so far:

- alias: 'Manual - Door sensor trigger alarm'                                                                                                  
  trigger:
    - platform: state
      entity_id: group.door_sensors
      from: "off"
      to: 'on'

  condition:     
    condition: template
    value_template: "{{states('alarm_control_panel.home_alarm') != 'disarmed'}}"

  action:
    - service: alarm_control_panel.alarm_trigger
      entity_id: alarm_control_panel.home_alarm  

    - service: notify.Mynotifygroup
      data_template:
        title: 'Alarm'
        message: >
          {% for entity in trigger.to_state.attributes.entity_id %}
            {% if states(entity) == 'on' %}
              {{ state_attr(entity, 'friendly_name')}} is open
          Alarm pending - disarm within 30 seconds
             {% endif %}
          {% endfor %}
        data:
          push:
            sound:
              name: "30secClock.wav"
              critical: 1
              volume: 1
          actions:
          - action: URI
            title: Open dashboard
            uri: /lovelace-alarm/default_view
          - action: DISABLE_ALARM
            title: Disarm alarm

    - wait_for_trigger:
        - platform: event
          event_type: mobile_app_notification_action
          event_data:
            action: DISABLE_ALARM
      continue_on_timeout: false
    - service: alarm_control_panel.alarm_disarm
      target:
        entity_id: alarm_control_panel.home_alarm
      data:
        code: 'xxxx'

    - service: Mynotifygroup
      data_template:
        title: 'Alarm'
        message: >
            sounding alarm
        data:
          push:
            sound:
              name: "siren.wav"
              critical: 1
              volume: 1

Any help is appreciated or maybe there is even an easier way to achieve this.

Well, unless I’m blind, you didn’t actually set a timeout…

Another remark: Maybe that is fine for you, but you do realize that is one door is already open, opening a second one does not trigger this again? If you want them all to trigger regardless the states of the others, you should provide the entire list as triggers.

Yeah i know the lat remark but if a thief enters at nigh one door open and then a trigger is enough for me :slight_smile:

I guessed that, just wanted to make sure. And warn those who copied your code and used it in another context.

Another concern: The trigger is door opening, and the condition is the alarm is armed. So you may still be vulnerable when a door was open somewhere when you armed the alarm. Now I know that you need time to get out the house though a door, but I would put in a trigger for alarm is armed in there too, with a delay that enables you to leave the house.

Do you know the Alarmo integration? It does a lot of this hard work for you.

For the life of me cant get it to work.

What i want to achieve is:

  1. on the notification if you press disarm if want to disarm the alarm and then stop.
  2. If the button is not pressed within 20 seconds i want to set the alarm control panel to triggered.

With the config below the first bullet point works. I have no clue how to get the second bullet point working though
This is the config now:

- alias: 'Manual - Door sensor trigger alarm'                                                                                                  
  trigger:
    - platform: state
      entity_id: group.door_sensors
      from: "off"
      to: 'on'

  condition:     
    condition: template
    value_template: "{{states('alarm_control_panel.home_alarm') != 'disarmed'}}"

  action:
    - service: notify.mynotifygroup
      data_template:
        title: 'Alarm'
        message: >
          {% for entity in trigger.to_state.attributes.entity_id %}
            {% if states(entity) == 'on' %}
              {{ state_attr(entity, 'friendly_name')}} is open
          Alarm pending - disarm within 30 seconds
             {% endif %}
          {% endfor %}
        data:
          push:
            sound:
              name: "30secClock.wav"
              critical: 1
              volume: 1
          actions:
          - action: URI
            title: Open dashboard
            uri: /lovelace-alarm/default_view
          - action: DISABLE_ALARM
            title: Disarm alarm

    - wait_for_trigger:
        - platform: event
          event_type: mobile_app_notification_action
          event_data:
            action: DISABLE_ALARM
      timeout: 00:00:10
      continue_on_timeout: false

    - service: alarm_control_panel.alarm_disarm
      target:
        entity_id: alarm_control_panel.home_alarm
      data:
        code: 'xxx'

Well, you want to continue after the timeout, here.

Did you achieve this at the end? Trying to do the same but don’t know how to.