I have an automation that turns on a light after sunset and off at 1am. Works great. Now I want to add brightness change on motion and change again when motion ends but I’m having trouble getting my triggers and conditions to work correctly.
The light comes on just before sunset and off at 1am. I want the brightness to change on motion detection within those times.
alias: Front Light on/off
trigger:
- event: sunset
offset: '-00:15:00'
platform: sun
id: sunset
- platform: time
at: '01:00'
id: 1am
- platform: state
entity_id: binary_sensor.front_door_person_motion
to: 'on'
id: motion
- platform: state
entity_id: binary_sensor.front_door_person_motion
id: no motion
to: 'off'
condition: []
action:
- choose:
- conditions:
- condition: trigger
id: sunset
sequence:
- service: light.turn_on
data:
brightness_pct: 30
target:
entity_id: light.yeelight_mono1_f0b429a93ec5
- conditions:
- condition: trigger
id: 1am
sequence:
- service: light.turn_off
data: {}
target:
entity_id: light.yeelight_mono1_f0b429a93ec5
- conditions:
- condition: sun
after: sunset
after_offset: '-00:15:00'
- condition: time
before: '01:00'
weekday:
- mon
- tue
- wed
- thu
- fri
- sat
- sun
- condition: trigger
id: motion
sequence:
- service: light.turn_on
data:
brightness_pct: 100
target:
entity_id: light.yeelight_mono1_f0b429a93ec5
- conditions:
- condition: sun
after: sunset
after_offset: '-00:15:00'
- condition: time
before: '01:00'
weekday:
- sun
- sat
- fri
- thu
- wed
- tue
- mon
- condition: trigger
id: no motion
sequence:
- service: light.turn_on
data:
brightness_pct: 30
target:
entity_id: light.yeelight_mono1_f0b429a93ec5
default: []
All the functions I want are contained in this single automation using trigger ID’s but clearly I have made mistake. Can anyone spot it? Cause I definitely can not…