Use actual door state ( "open" or "closed") as trigger for garage door automation

Hello,

I have been googling a lot lately trying to find a way to solve the issue without any help. As least not the way I wanted it to work.

The issue:
I have a garage cover that reports either state “open” or “closed”. I would like to check this state at a given time every day (let’s say 23:00). If the state = open (the trigger) and time is after 23:00 (the condition) I would like to close the door. However I cannot get the trigger to work correctly by checking the garage cover state.

I am not interested in the trigger checking a change in the state of the door (from close to open) as the door may have been left open for a long period of time. So comes 23:00, the door is open (the state haven’t changed) but I still want to close it.

I tried a value template without any help:

  trigger:
  - platform: template
    value_template: "{{ is_state('cover.garage_door', 'open') }}"
  condition:
  - condition: time
    after: '23:00:00'

Is checking a current state as trigger possible? What am I missing here?

Cheers.

Trigger at 23:00, check the door state as a condition.

trigger:
  - platform: time
    at: "23:00:00"
condition:
  - condition: state
    entity_id: cover.garage_door
    state: 'open'
action:
...
1 Like

Thanks. Tested it right now, works perfect!

Just out of curiosity for someone wanted to learn: would that be the only way to actually do it?
Does the trigger always need something to “change” to be able to work, like the time in your example while there were no changes in mine?

Yes, that’s sort of the definition of a trigger — an event that kicks off the automation. The state of your door not changing isn’t an event, whereas 23:00 is.

Understood, that makes sense.
Thanks for your help!

1 Like