#Trigger Door Open

1 messages · Page 1 of 1 (latest)

terse hamlet
#

I have a question about triggers.
I have a door and window contact.

I would like to use this as a trigger. In other words, when it is open, something should happen.

My question is: Would the trigger only activate once when the door contact is open, for example, or would the trigger continue to activate as long as it is open?

An example: The contact opens at 9 a.m. Now I want to turn on the light, but only after sunset. Here, I would add a condition to only trigger after 6 p.m.
Would the trigger also trigger after sunset, or would it only trigger once at 9 a.m.?

drowsy crown
#

The trigger will only fire when the sensor changes from "off" to "on" (or "closed" to "open" for cover entities). It does not continuously fire.

The basic way to handle this kind of thing is to mirror your triggers and conditions.

triggers:
  - trigger: state
    entity_id: binary_sensor.door
    to: 'on'
  - trigger: sun
    event: sunset
conditions:
  - condition: state
    entity_id: binary_sensor.door
    state: 'on'
  - condition: sun
    after: sunset
actions:
....
terse hamlet
#

Does additional automation need to be created for switching off, or is there a more elegant solution?

twilit jolt
#

Using the same automation is much cleaner