Automation/Timer not firing correctly

Hey folks, I’m not sure what I’m doing wrong, but if it’s my normal, it’s probably pretty stupid. Here’s the automation in question:

alias: Dishwasher Automation
description: ""
trigger:
  - platform: device
    domain: mqtt
    device_id: 2a6fada0fe836ee6378f48fa0e7ac89d
    type: action
    subtype: single
    discovery_id: 0x00158d0008ad967d action_single
condition: []
action:
  - service: light.turn_on
    data:
      color_name: green
    target:
      entity_id: light.dishwasher_light
  - service: timer.start
    data:
      duration: "02:10:00"
    target:
      entity_id: timer.dishwasher_timer
  - service: light.turn_on
    data:
      color_name: red
    target:
      entity_id: light.dishwasher_light
  - service: script.turn_on
    target:
      entity_id: script.google_home_resume
    data:
      variables:
        action:
          - service: tts.google_cloud_say
            data:
              entity_id: media_player.speakers
              message: >-
                <speak> <break time="2s"/>The dishwasher has finished. Feel free
                to empty it out!</speak>
            cache: true
  - device_id: 9ff133866a16231d6f92933f6bbbdd54
    domain: mobile_app
    type: notify
    message: The dishwasher has finished. Feel free to empty it out!
    title: Alert!
mode: single

I think I must be using the timer incorrectly as I had this working properly with a delay (but I know there are plenty of problems inherent with delays).

The intent is that while the dishwasher is running (2 hours, 10 minutes), the dishwasher’s light strip is green. When it finishes, the lights turn red, and I get the notifications. I’ve got a seperate automation that will turn the lights off if the contact sensor on the dishwasher has been open for at least 2 minutes (long enough to empty the dishwasher versus reaching in to grab one clean utensil!).

I can see in the helpers that the timer is counting down, but I guess I’m misunderstanding how it’s supposed to be utilized in an automation?

Could someone point me in the right direction?

When your automation starts the timer it does not wait before turning the light red - it simply continues.

What you may need to do is have a separate automation - triggered by the timer reaching zero - and move all the actions (that come after starting the timer) to this new automation.

That makes sense. I will give that a shot.

Thank you for your time and thoughts!

ETA: Is this the correct way to trigger the second automation?

trigger:
  - platform: state
    entity_id:
      - timer.dishwasher_timer
    from: active

I think that should work.

Also, use the timers restore setting to ensure the timer continues even if HA is restarted.

1 Like

Yep, that I have enabled.

Thanks, friend - I ran it today and it worked exactly as intended!

1 Like