Action of automation skips some parts sometimes

I have an automation to TTS when the washing machine is done.
And if we have not opened the door after five minutes it TTS again with a slightly different message, and then it repeats this until we have taken care of it.

The issue is that sometimes it skips the first message, and the five minute delay and goes directly to the repeating message.
Not really an issue but it’s strange. I just want to know what could cause this.

{{ states(''sensor.washing_machine_tts'') }} == "The 60 degree wash is done"
or similar
alias: Washing machine done
description: ''
trigger:
  - platform: numeric_state
    entity_id: sensor.washing_machine_program_progress
    above: '99'
  - platform: state
    entity_id: sensor.washing_machine_operation_state
    from: Run
    to: Finished
  - platform: state
    entity_id: sensor.washing_machine_operation_state
    from: Run
    to: Ready
condition: []
action:
  # this is the part that is sometimes skipped
  - service: tts.cloud_say
    data:
      entity_id: media_player.hela_huset
      message: '{{ states(''sensor.washing_machine_tts'') }}'
      language: sv-SE
  - repeat:
      while:
        - condition: or
          conditions:
            - condition: state
              entity_id: binary_sensor.washing_machine_door
              state: 'off'
            - condition: state
              entity_id: sensor.washing_machine_program_progress
              state: '100'
      sequence:
       # and this delay is also skipped
        - delay:
            hours: 0
            minutes: 5
            seconds: 0
            milliseconds: 0
        - choose:
            - conditions:
                - condition: and
                  conditions:
                    - condition: state
                      entity_id: binary_sensor.washing_machine_door
                      state: 'off'
                    - condition: state
                      entity_id: sensor.washing_machine_program_progress
                      state: '100'
              sequence:
                # giving me this message as the first
                - service: tts.cloud_say
                  data:
                    entity_id: media_player.hela_huset
                    message: >-
                      "{{ states('sensor.washing_machine_tts') }} and the door is still closed."
                    language: sv-SE
                - service: homeassistant.update_entity
                  target:
                    entity_id: sensor.washing_machine_json
          default: []
mode: single

And I know this is not an issue with the first TTS got “lost”, I hear the washing machine beep as it’s done and hear the door unlock and I get the second message.

What does the automation trace show?

I don’t have a trace of it.
It last happened a few days ago and I just remembered it now.
Next time it happens I will try and remember to look at the trace.

It happened again.

And then there is in “changed variables”:

this:
  entity_id: automation.washing_machine_done
  state: 'on'
  attributes:
    last_triggered: '2021-09-22T15:06:38.275482+00:00'
    mode: single
    current: 1
    id: '1625663835520'
    friendly_name: Washing machine done
  last_changed: '2021-09-22T14:56:39.045615+00:00'
  last_updated: '2021-09-22T15:06:38.275643+00:00'
  context:
    id: 3488f61fb9510c03dad80b476a240a0a
    parent_id: 0cc92b84a2a769120e0e424f2d7f0850
    user_id: null
trigger:
  id: '2'
  idx: '2'
  platform: state
  entity_id: sensor.washing_machine_operation_state
  from_state:
    entity_id: sensor.washing_machine_operation_state
    state: Run
    attributes:
      friendly_name: Washing machine Operation State
      icon: mdi:state-machine
    last_changed: '2021-09-23T15:39:50.802445+00:00'
    last_updated: '2021-09-23T15:39:50.802445+00:00'
    context:
      id: 63f2e4bffc8bbbbb6b78f680224dcb35
      parent_id: null
      user_id: null
  to_state:
    entity_id: sensor.washing_machine_operation_state
    state: Ready
    attributes:
      friendly_name: Washing machine Operation State
      icon: mdi:state-machine
    last_changed: '2021-09-23T19:18:55.492805+00:00'
    last_updated: '2021-09-23T19:18:55.492805+00:00'
    context:
      id: 51ebd86715eab739266d856911fbe635
      parent_id: null
      user_id: null
  for: null
  attribute: null
  description: state of sensor.washing_machine_operation_state

the rest is “empty”.
I have no clue how to read traces and what I’m looking at.

Stopped because only a single execution is allowed …

It implies the automation was triggered while it was already running. It is configured to operate in mode: single so only one running instance is allowed.

While it was executing its action, the state of sensor.washing_machine_operation_state changed and triggered the automation. The trace shows the “from” state was “Run” so it triggered one of the two State Triggers (because they both use from: Run). However, the automation is already busy and, because it’s operating in single mode, ignores the trigger. By ignoring the state-change, the automation probably failed to work the way you expected it would.

Changing the mode from single to queued or parallel will allow it to execute more than one instance. However, you’ll have to study the action’s logic determine if it makes sense to do that. It contains a repeat so simply allowing the automation to clone its action (parallel) or enqueue another instance of it (queued) might not be the right thing to do.

The reason there is multiple triggers is because sometimes one of them just stops.
Or it skips the “Finished” state.
I’ll probably move it over to Node red then, I’ll probably have more control of the automation there.

Thank you.

I’m not sure what you mean by “stops”. Perhaps you are referring to the delay statement? The running instance contains a 5-minute delay during which any triggering of the three triggers will (because of single mode) produce the error message you received and prevent a second instance from being executed.

Sorry, no.
Since it’s based on the cloud, the API or something in between makes the values freeze.
Sometimes it’s just one value that freezes, sometimes it’s all.
So basing the trigger on as many variables as possible makes it more likely to fire.

If you believe the problem is:

based on the cloud, the API or something in between makes the values freeze.

then I don’t see how your intention to switch to Node-Red will mitigate it. Nevertheless, I wish you luck anyway. Please post the flow when it’s done so others can see how to resolve the issue.

Node red does not have issues with several triggers (if that is the issue). You just block them with a trigger node

How is that different from single mode? It blocks all triggers while the automation’s action is busy.

Trigger node can block for a longer period.
You can set it to unblock when a reset message comes, which can be sent when the door is opened.

Single mode blocks until the automation is no longer busy. However, it cannot be unblocked by a reset message. Will you be using that additional feature to resolve the issue you are experiencing?