Files
fresh-home/automations/rooms/dining_room/dining_room_lights_to_off.yaml
T
2024-04-14 14:08:56 -04:00

81 lines
2.3 KiB
YAML

alias: Dining Room Lights to Off
id: automation_dining_room_lights_to_off
mode: restart
trigger:
- platform: state
entity_id: input_select.dining_room_mode
- platform: state
entity_id: input_boolean.dining_room_occupied
to: 'off'
- platform: state
id: light_level
entity_id: binary_sensor.dining_room_naturally_lit
from: 'off'
to: 'on'
#- platform: time_pattern
# minutes: "/5"
condition:
- condition: or
conditions:
- condition: state
entity_id: input_select.dining_room_mode
state: 'Off'
- condition: state
entity_id: input_boolean.dining_room_occupied
state: 'off'
- condition: state
entity_id: binary_sensor.dining_room_naturally_lit
state: 'on'
action:
- choose:
- conditions:
- condition: or
conditions:
- condition: and
conditions:
- condition: state
entity_id: input_boolean.lighting_automations
state: 'on'
- condition: or
conditions:
- condition: state
entity_id: input_select.dining_room_mode
state: 'Off'
- condition: state
entity_id: input_boolean.dining_room_occupied
state: 'off'
- condition: not
conditions:
- condition: state
entity_id: input_select.dining_room_mode
state: 'Manual'
- condition: state
entity_id: binary_sensor.dining_room_naturally_lit
state: 'on'
sequence:
- alias: "Turn off z-wave switch since all lights are off"
service: homeassistant.turn_off
target:
entity_id: switch.dining_room_switch
# - service: scene.turn_on
# data:
# transition: 5
# target:
# entity_id: scene.dining_room_hue_off
# - choose:
# - conditions:
# - condition: state
# entity_id: input_boolean.guest_mode
# state: 'on'
# sequence:
# - alias: "Turn off z-wave switch since all lights are off"
# service: homeassistant.turn_off
# target:
# entity_id: switch.dining_room_switch