Laundry Automation Not Working

What am I doing wrong here?

My automation detects when my dryer starts and stops, using a Shelly EM, and notifies me when it stops. It should continue to notify me every 5 minutes until I go open the laundry room door (and presumably get the clothes out). However, it continues to notify me even after I open the laundry room door. This gets rather annoying.

I am using a helper to track the current status of the dryer, with the values of “Running” while the dryer is going, “Done” when the dyer has stopped, and “Off” once I’ve opened the door. The state of the helper changes to “Running” and “Done” but never changes to “Off”.

As a note, I plan to replicate this automation for my washer too, so getting it working for the dryer first would be great.

alias: Washer/Dryer Automations
description: ""
triggers:
  - alias: Dryer Turn On
    trigger: numeric_state
    entity_id:
      - sensor.dryer_power
    id: Dryer Turn On
    below: -200
    for:
      hours: 0
      minutes: 0
      seconds: 5
  - alias: Dryer Turn Off
    trigger: numeric_state
    entity_id:
      - sensor.dryer_power
    id: Dryer Turn Off
    above: -200
    for:
      hours: 0
      minutes: 0
      seconds: 5
  - trigger: state
    entity_id:
      - binary_sensor.sensor_laundry_room_door
    to: "on"
    alias: Laundry Room Door Open
    id: Laundry Room Door Open
conditions: []
actions:
  - choose:
      - conditions:
          - condition: trigger
            id:
              - Dryer Turn On
        sequence:
          - action: input_select.select_option
            metadata: {}
            data:
              option: Running
            target:
              entity_id: input_select.dryer_status
      - conditions:
          - condition: trigger
            id:
              - Dryer Turn Off
        sequence:
          - action: input_select.select_option
            metadata: {}
            data:
              option: Done
            target:
              entity_id: input_select.dryer_status
          - repeat:
              sequence:
                - action: notify.notify
                  metadata: {}
                  data:
                    message: Come get the clothes!
                    title: Dryer is Done
                - delay:
                    hours: 0
                    minutes: 5
                    seconds: 0
              until:
                - condition: state
                  entity_id: input_select.dryer_status
                  state: "Off"
      - conditions:
          - condition: trigger
            id:
              - Laundry Room Door Open
        sequence:
          - if:
              - condition: state
                entity_id: input_select.dryer_status
                state: Done
            then:
              - action: input_select.select_option
                metadata: {}
                data:
                  option: "Off"
                target:
                  entity_id: input_select.dryer_status
mode: single

What do the automation traces say?

Your automation is in “single” mode, meaning that while it is sitting in the infinite 5-minute loop, a new trigger (opening the laundry door) does not start another execution.

So anytime it is sending notifications, the helper cannot turn to Off because it is blocked from starting any new runs of the automation.

You probably need parallel mode if you want to combine this all in a single automation. But be careful you don’t trigger it into running multiple times.

Good catch! Up until now I had never run into automations where multiple instances were running at the same time. Should I do Parallel or Restart? I was thinking Restart because when the door opens, then I’d stop the existing instance with infinite loop of notifications, and start a new instance which sets the helper to Off.

I’ll admit I am not really sure how to read automation traces. Is there a good tutorial for that?

Settings > Automations & scenes > Click the 3 dots next to the automation and then click Traces

In this one, you can see it failed due to being outside the timeframe

Thank you. Changing the mode to Restart seems to solve the issue.