Desired automation => Turn on a light after sunset (when it's of) if someone came through the gate and next opens the backdoor. This is what I came up with, but this automation doesn't work (have absolutely no clue why it doesn't work???)
alias: Zet licht aan na poort en deur
description: >-
Zet het licht aan nadat de poort sensor is geactiveerd en daarna de deur
sensor binnen 3 minuten.
triggers:
- type: opened
device_id: 5301ba3796c4fac171ad67d609cb8636
entity_id: d961279e26574f58304e784970b4a639
domain: binary_sensor
trigger: device
conditions: - condition: template
value_template: >
{{ (as_timestamp(now()) -
as_timestamp(states.binary_sensor.deursensor_poort_tuin.last_changed)) <=
180 }} - condition: sun
after: sunset - condition: device
type: is_off
device_id: 9cdc936b9b20e89b14caaae84b51d52b
entity_id: 6ed79fa0f29671eae911231cd9ce59e1
domain: switch
actions: - type: turn_on
device_id: 9cdc936b9b20e89b14caaae84b51d52b
entity_id: 6ed79fa0f29671eae911231cd9ce59e1
domain: switch
mode: single
Can someone tell my why this doesn't work?