Hi,
Im trying to figure out an automation that will work for my motion sensor.
What I would like to do is:
- Bewteen sunrise to sunset: When no motion is detected after 5 minutes: Turn the lights off.
- Between sunset to 23.00 (11pm): When there is no motion detected after 30 minutes: Dim/set the lights to 30 % level
- Between 23.00 (11pm) to sunrise (the following day): When no motion is detected after 5 minutes: Turn the lights off.
(Maybe rule 3 above can have the time period extended to 23.00 to sunset (the following day))
Is this possible to implement within my code that I manage to come up with here:
I mean, would you use three different conditions and connect actions to them?
Or should I create three different automations for the sensor to turn off the lights at these three different conditions ? Does it matter ?
-alias: ‘Motion Sensor Lights Off - Downstairs’
trigger:
- platform: state
entity_id: binary_sensor.hallway_motion_sensor
to: ‘off’
for:
minutes: 5
condition:
- condition: state
entity_id: sun.sun
below: ‘below_horizon’
action:
- service: homeassistant.toggle
entity_id: group.lights_downstairs
data:
transition: 160
brightness_pct: 30