Hi all,
I am new to home home assistant. I have motion sensors for all my lights and I first set up different automations for on during the day, during the evening and off. So, three automations for one room. Now I discovered the “Choose” function and I can bring all three into one automation. This got me thinking, is there a better, more efficient way of doing this? Herewith a typical automation:
alias: Upstairs Office Lights
description: ''
trigger:
- type: motion
platform: device
device_id: c980d9d34016384294823a1d0bd20a31
entity_id: binary_sensor.upstairs_office_sensor_motion
domain: binary_sensor
id: Motion
- type: no_motion
platform: device
device_id: c980d9d34016384294823a1d0bd20a31
entity_id: binary_sensor.upstairs_office_sensor_motion
domain: binary_sensor
id: No Motion
for:
hours: 0
minutes: 20
seconds: 0
milliseconds: 0
condition: []
action:
- choose:
- conditions:
- condition: trigger
id: Motion
- condition: time
after: '07:00'
before: '18:00'
- type: is_illuminance
condition: device
device_id: c980d9d34016384294823a1d0bd20a31
entity_id: sensor.upstairs_office_sensor_light_level
domain: sensor
below: 10
sequence:
- service: light.turn_on
target:
entity_id: light.upstairs_office_lights
data:
color_temp: 231
brightness_pct: 100
- conditions:
- condition: trigger
id: Motion
- condition: time
after: '18:00'
before: '07:00'
- type: is_illuminance
condition: device
device_id: c980d9d34016384294823a1d0bd20a31
entity_id: sensor.upstairs_office_sensor_light_level
domain: sensor
below: 10
sequence:
- service: light.turn_on
target:
entity_id: light.upstairs_office_lights
data:
color_temp: 425
brightness_pct: 100
- conditions:
- condition: trigger
id: No Motion
sequence:
- service: light.turn_off
target:
entity_id: light.upstairs_office_lights
default: []
mode: single