When this automation works best
Presence lighting works best when the sensor exposes stable occupancy or presence entities, the room has clear lighting targets, and you test both the on and off behavior before relying on it.
Starter YAML
alias: Presence lighting
trigger:
- platform: state
entity_id: binary_sensor.room_presence
to: "on"
condition:
- condition: sun
after: sunset
action:
- service: light.turn_on
target:
entity_id: light.room
mode: single