here is my exisitng yaml
alias: Rear Driveway Light
description: ""
triggers:
- entity_id: sensor.sonoff_10023cecd4_action
to: single
trigger: state
- entity_id:
- binary_sensor.0x00158d008b118175_occupancy
trigger: state
to: "on"
- trigger: state
entity_id:
- binary_sensor.0x00158d008b118175_occupancy
to: "off"
for:
hours: 0
minutes: 2
seconds: 0
- at: "00:00:00"
trigger: time
- trigger: sun
event: sunrise
offset: 0
conditions: []
actions:
- choose:
- conditions:
- condition: state
state: "on"
entity_id: binary_sensor.0x00158d008b118175_occupancy
- condition: sun
before: sunrise
after: sunset
sequence:
- target:
entity_id: switch.sonoff_10023cecd4_1
action: switch.turn_on
data: {}
- conditions:
- condition: state
entity_id: binary_sensor.0x00158d008b118175_occupancy
state: "off"
sequence:
- target:
entity_id: switch.sonoff_10023cecd4_1
action: switch.turn_off
data: {}
- conditions:
- condition: state
entity_id: sensor.sonoff_10023cecd4_action
state: single
sequence:
- target:
entity_id: switch.sonoff_10023cecd4_1
action: switch.toggle
data: {}
- conditions:
- condition: time
after: "23:58:00"
before: "07:00:00"
sequence:
- target:
entity_id: switch.sonoff_10023cecd4_1
action: switch.turn_off
data: {}
mode: single
```