1
0
ansible-home-assistant/configuration/automations/hallway-motion.yaml

70 lines
2.1 KiB
YAML

- id: hallway-lightstrip-on
alias: '[Hallway] Motion On'
mode: restart
trigger:
- platform: state
entity_id: binary_sensor.hallway_motion_sensor
from: 'off'
to: 'on'
action:
- choose:
- conditions:
- condition: state
entity_id: input_select.home_mode
state: Day
sequence:
- choose:
- conditions:
- condition: state
entity_id: input_boolean.sleep_mode
state: 'on'
sequence:
- service: light.turn_on
entity_id: light.hallway_light
- service: light.turn_on
entity_id: light.hallway_light
data:
brightness_pct: 50
- conditions:
- condition: state
entity_id: input_boolean.sleep_mode
state: 'off'
- condition: numeric_state
entity_id: sensor.kitchen_motion_luminance
below: '21'
sequence:
- service: light.turn_on
entity_id: light.hallway_light
- service: light.turn_on
entity_id: light.hallway_light
data:
brightness_pct: 90
- conditions:
- condition: state
entity_id: input_select.home_mode
state: Night
sequence:
- service: light.turn_on
entity_id: light.hallway_lightstrip
data:
brightness_pct: 5
rgb_color:
- 255
- 0
- 0
- id: hallway-motion-off
alias: '[Hallway] Motion Off'
mode: restart
trigger:
- platform: state
entity_id: binary_sensor.hallway_motion_sensor
for: '0:02:00'
from: 'on'
to: 'off'
action:
- service: light.turn_off
entity_id: light.hallway_lightstrip
- service: light.turn_off
entity_id: light.hallway_light