Hi,
Recently I created an automation that needs to do the following switch the light on before Sunrise and after Sunset only if motion is detected.
So for testing I used the following script turn the light on after Sunrise and before Sunset if motion is detected leave the lights on for 20 seconds.
This seem to work just fine, but when I switch back to before Sunrise and after Sunset the lights won’t turn on!?
What am I overlooking?
alias: Licht Zolder
description: Spotjes Zolder Motion Sensor
trigger:
- type: motion
platform: device
device_id: 7f54b57bf0ba1fee8ed9a7363372af64
entity_id: binary_sensor.lidl_zolder
domain: binary_sensor
- platform: state
entity_id: binary_sensor.lidl_zolder
from: 'off'
to: 'on'
condition:
- condition: sun
before: sunset
after: sunrise
action:
- service: switch.turn_on
data: {}
target:
entity_id: switch.tasmota_6
- wait_for_trigger:
- platform: state
entity_id: binary_sensor.lidl_zolder
from: 'on'
to: 'off'
for: '00:00:20'
continue_on_timeout: false
- service: switch.turn_off
data: {}
target:
entity_id:
- switch.tasmota_6
mode: single
alias: Licht Zolder
description: Spotjes Zolder Motion Sensor
trigger:
- type: motion
platform: device
device_id: 7f54b57bf0ba1fee8ed9a7363372af64
entity_id: binary_sensor.lidl_zolder
domain: binary_sensor
- platform: state
entity_id: binary_sensor.lidl_zolder
from: 'off'
to: 'on'
condition:
- condition: sun
before: sunrise
after: sunset
action:
- service: switch.turn_on
data: {}
target:
entity_id: switch.tasmota_6
- wait_for_trigger:
- platform: state
entity_id: binary_sensor.lidl_zolder
from: 'on'
to: 'off'
for: '00:00:20'
continue_on_timeout: false
- service: switch.turn_off
data: {}
target:
entity_id:
- switch.tasmota_6
mode: single