How to wait for multiple different triggers and continue with different sequences bases on the fullfilled trigger?

Hey there, im currently facing a question with the new wait_for_trigger-action.

In the blog entry it is stated, that one could list multiple wait conditions and then execute differents actions based an the received state. (see below).

How would one go about doing this?

This is my current situation

- wait_for_trigger:
          - platform: time
            at: "10:30:00"
          - platform: event
            event_type: mobile_app_notification_action
            event_data:
              action: roborock_autoclean_now
          - platform: event
            event_type: mobile_app_notification_action
            event_data:
              action: roborock_autoclean_abort

I either want to wait for a set time or on feedback from a previously made Android nofitication.
Based on the fullfilled trigger i want to execute different actions.


Home Assistant Blog Source:


"This example is simple and probably fairly useless for most of us. However, let’s say you left your garage door open and you leave the “Home” zone. Home Assistant could send you an actionable notification, saying: “Hey, you left the garage door open, shall I close if for you?” with 2 choices: Yes/No.

Where you previously would have needed 3 automations for this. The first for sending a notification and two others for handling the “Yes” or “No” answer. Using the wait_for_trigger this could be done in a single automation.

Right after sending the notification, the wait_for_trigger could halt the script from continuing, until it receives the “Yes” or “No” answer and continue after that and run the actions you’d like based on the answer received." - https://www.home-assistant.io/blog/2020/09/17/release-115/

Did you ever get anywhere with this i have a similar dilemma

Nope, sadly I did not get this to work using automations.
I switched to writing a custom integration for my use case.

I use something along the lines of, would that do it?:

- wait_for_trigger:
          - platform: time
            at: "10:30:00"
          - platform: event
            event_type: mobile_app_notification_action
            event_data:
              action: roborock_autoclean_now
          - platform: event
            event_type: mobile_app_notification_action
            event_data:
              action: roborock_autoclean_abort
- choose:
    - conditions:
        - condition: template
          value_template: '{{ wait.trigger.event.data.action == "roborock_autoclean_now" }}'
      sequence:
        - service: XXX
    - conditions:
        - condition: template
          value_template: '{{ wait.trigger.event.data.action == "roborock_autoclean_abort" }}'
      sequence:
        - service: XXX
2 Likes

Yep, this is what i was looking for.
Thanks for the update @woodmj74.