"Wait for a trigger" timout breaks out of "Repeat" loop

I’m trying to make a script that notifies my phone when the washing machine is finished, and re-sends the notification every 30min until the notification is acknowledged. I thought I could put the notification inside of a “Repeat” loop that continues until a notification action is received.

Inside the loop, I have a “Wait for a trigger” block with a timeout. The problem is that if the “Wait for a trigger” timeout triggers, the “Repeat” loop terminates and the script finishes. What I want it to do is to go back to the beginning of the “Repeat” loop when the timeout triggers. How do I achieve this? (I used a 10 second timeout in the script for testing. It will be longer in the final script.)

alias: Washing machine - Notify script
sequence:
  - variables:
      action_wait: "{{ 'WAIT_' ~ context.id }}"
      action_done: "{{ 'DONE_' ~ context.id }}"
  - repeat:
      until:
        - condition: template
          value_template: "{{ wait.trigger.event.data.action == action_done }}"
      sequence:
        - service: notify.mobile_app_PHONE_NAME
          data:
            message: >-
              The washer has finished running. Clothes are ready to be moved to
              the dryer.
            title: Wash Cycle Complete
            data:
              icon_url: /local/icon/washing-machine-alert.png
              actions:
                - action: "{{ action_wait }}"
                  title: Remind me in 30min
                - action: "{{ action_done }}"
                  title: Clothes have been moved
        - wait_for_trigger:
            - platform: event
              event_type: mobile_app_notification_action
              event_data:
                action: "{{ action_wait }}"
            - platform: event
              event_type: mobile_app_notification_action
              event_data:
                action: "{{ action_done }}"
          continue_on_timeout: true
          timeout:
            hours: 0
            minutes: 0
            seconds: 10
            milliseconds: 0
        - service: notify.mobile_app_PHONE_NAME
          data:
            message: waiting...
  - service: notify.mobile_app_PHONE_NAME
    data:
      message: Done!
mode: single
icon: mdi:washing-machine-alert

Here is the trace timeline when I let “Wait for a trigger” timeout.
image

When I use repeat I usually just add a delay to keep the repeat going in a timely manner and make sure the condition in the repeat is going to break the loop by itself.

So remove the wait for trigger and add a delay

I think you’ve implemented exactly this. Perhaps have a look at it as an alternative.