Can't get timer.finished to work as a trigger in automation

I’m working on a pantry door light with and open close sensor. I created a timer helper and have it starting and canceling with the open and close. My problem is the trigger for timer.finished is not activating when the timer finishes. Here is th automation what I’m missing,

alias: Pantry Door With Triggers
description: Adding Triggers to Pantry Door
trigger:
  - platform: event
    event_type: timer.finished
    event_data:
      enity_id: timer.timer_10_mininutes
    id: Pantry Timer Finished
  - type: opened
    platform: device
    device_id: aae8734d4ccfaff6224a96add847d3df
    entity_id: 444ed7775555f27c98f4de45d557a1aa
    domain: binary_sensor
    id: Pantry Opened
  - type: not_opened
    platform: device
    device_id: aae8734d4ccfaff6224a96add847d3df
    entity_id: 444ed7775555f27c98f4de45d557a1aa
    domain: binary_sensor
    id: Pantry Door Closed
condition: []
action:
  - choose:
      - conditions:
          - condition: trigger
            id:
              - Pantry Timer Finished
        sequence:
          - type: turn_off
            device_id: c93da3859af3b7e8f81b06f082183ecc
            entity_id: 640b7456666c06a7c6241f10d2aabf4a
            domain: light
      - conditions:
          - condition: trigger
            id:
              - Pantry Opened
        sequence:
          - type: turn_on
            device_id: c93da3859af3b7e8f81b06f082183ecc
            entity_id: 640b7456666c06a7c6241f10d2aabf4a
            domain: light
            flash: long
          - service: timer.start
            target:
              entity_id: timer.timer_10_mininutes
            data: {}
      - conditions:
          - condition: trigger
            id:
              - Pantry Door Closed
        sequence:
          - type: turn_off
            device_id: c93da3859af3b7e8f81b06f082183ecc
            entity_id: 640b7456666c06a7c6241f10d2aabf4a
            domain: light
          - service: timer.cancel
            target:
              entity_id: timer.timer_10_mininutes
            data: {}
mode: single

No need for a timer:

trigger:
  - platform: state
    entity_id: binary_sensor.your_door_sensor_here # change this
    to: 'on'
  - platform: state
    entity_id: binary_sensor.your_door_sensor_here # change this
    to: 'off'
    for:
      minutes: 10 
action:
  - service: "light.turn_{{ trigger.to_state.state }}"
    target:
      entity_id: light.your_light_here # change this
mode: single

Also do yourself a favour and read this: Why and how to avoid device_ids in automations and scripts

Say I want to move this over and use it on a motion detector can the minutes be reset if motion is detected again. I will try what you said but I would still love to know what I’m doing wrong. Thank You for your help.

That’s a curious way to spell minutes.

timer.timer_10_mininutes

Is that a typo or is that the timer entity’s actual entity_id?

Typing error but not the problem, Its just the timer helper name so its auto filled., but I will correct it.

entity_id is misspelled.

enity_id: timer.timer_10_mininutes
^^^^^^^^
1 Like

Yes, the sensor has to be off continuously for the for time. If you interrupt that it resets and starts counting again.

I want to thank everyone for there help I got it to work. I need to work on my spelling and typing. I’m also going to try and not use device ids as that article pointed out.

1 Like

Sometimes it takes another set of eyes to spot typos.


Please consider marking my post above with the Solution tag (unless you chose to abandon your version of the automation in favor of using tom_l’s suggestion). It will automatically place a check-mark next to the topic’s title which signals to other users that this topic has been resolved. This helps users find answers to similar questions.

For more information about the Solution tag, refer to guideline 21 in the FAQ.

After reading the article tom linked for me and seeing what he said I was able to reduce the automation to this.Mine is longer but all done in the UI no yaml editing.

alias: Pantry Light
description: PantryLight on/off with timer
trigger:
  - platform: state
    entity_id:
      - binary_sensor.pantry_door_sensor
    from: "off"
    to: "on"
condition: []
action:
  - service: light.turn_on
    data: {}
    target:
      entity_id: light.pantry_light_switch
  - wait_for_trigger:
      - platform: state
        entity_id:
          - binary_sensor.pantry_door_sensor
        from: "on"
        to: "off"
    timeout:
      hours: 0
      minutes: 10
      seconds: 0
      milliseconds: 0
  - service: light.turn_off
    data: {}
    target:
      entity_id: light.pantry_light_switch
mode: single

Again thanks for the help, the first one was based on a youtube video lots of information but many more steps than needed.