mirror of
https://github.com/CeeWeasel/fresh-home.git
synced 2026-08-10 11:00:14 -04:00
57 lines
1.8 KiB
YAML
57 lines
1.8 KiB
YAML
alias: Utility Room Lights to On
|
|
id: automation_utility_room_lights_to_on
|
|
mode: single
|
|
# Hide warnings when triggered while in delay.
|
|
max_exceeded: silent
|
|
|
|
trigger:
|
|
- platform: state
|
|
entity_id:
|
|
- input_select.utility_room_mode
|
|
- input_select.automatic_light_profile
|
|
- platform: state
|
|
entity_id: input_boolean.utility_room_occupied
|
|
to: "on"
|
|
|
|
# Only turn on the lights when necessary
|
|
condition:
|
|
- condition: or
|
|
conditions:
|
|
# Either when motion is detected
|
|
- condition: template
|
|
value_template: "{{ trigger.entity_id == 'input_boolean.utility_room_occupied' }}"
|
|
# Or when the scene changes while the lights are already on
|
|
- condition: and
|
|
conditions:
|
|
- condition: or
|
|
conditions:
|
|
- condition: template
|
|
value_template: "{{ trigger.entity_id == 'input_select.utility_room_mode' }}"
|
|
- condition: template
|
|
value_template: "{{ trigger.entity_id == 'input_select.automatic_light_profile' }}"
|
|
- condition: state
|
|
entity_id: light.utility_room_vanity
|
|
state: "on"
|
|
|
|
action:
|
|
- alias: "Make sure Z-Wave switch is turned on"
|
|
action: homeassistant.turn_on
|
|
target:
|
|
entity_id: switch.utility_room_motion_switch
|
|
|
|
- choose:
|
|
- conditions:
|
|
- condition: state
|
|
entity_id: input_select.utility_room_mode
|
|
state: Auto
|
|
sequence:
|
|
- action: scene.turn_on
|
|
target:
|
|
entity_id: "scene.utility_room_hue_{{states('input_select.automatic_light_profile').lower().replace(' ','_')}}"
|
|
default:
|
|
- action: scene.turn_on
|
|
target:
|
|
entity_id: "scene.utility_room_hue_{{states('input_select.utility_room_mode').lower().replace(' ','_')}}"
|
|
|
|
- delay: 1
|