mirror of
https://github.com/CeeWeasel/fresh-home.git
synced 2026-08-10 11:00:14 -04:00
151 lines
4.5 KiB
YAML
151 lines
4.5 KiB
YAML
blueprint:
|
|
name: Room Lights to Off
|
|
description: "## Room Lights to Off\n\nThis blueprint will turn off lights\
|
|
\ in a room based off of the criteria specified. The room will need an input_boolean\
|
|
\ to use for determining if it is occupied. It will also need an input_select to determine\
|
|
\ whether the room is in Auto mode, Manual mode, or forcefully off.\n\nIf specified\
|
|
\ a switch will also be turned off when the room is in Guest mode"
|
|
|
|
domain: automation
|
|
input:
|
|
target_light:
|
|
name: Lights
|
|
description: The lights in the room that need to be turned off
|
|
selector:
|
|
entity:
|
|
domain: light
|
|
|
|
room_mode:
|
|
name: Room Mode
|
|
description: The Input_Select that describes what mode the room is in.
|
|
selector:
|
|
entity:
|
|
domain: input_select
|
|
|
|
manual_option:
|
|
name: Manual Option
|
|
description: The Input_Select option that implies the room is in Manual mode.
|
|
default: Manual
|
|
selector:
|
|
text:
|
|
|
|
off_option:
|
|
name: Off Option
|
|
description: The Input_Select option that implies the room is forcefully Off.
|
|
default: 'Off'
|
|
selector:
|
|
text:
|
|
|
|
room_occupied:
|
|
name: Room Occupied
|
|
description: The Input_Boolean that describes whether the room is occupied
|
|
selector:
|
|
entity:
|
|
domain: input_boolean
|
|
|
|
light_level_sensor:
|
|
name: Light Level Sensor
|
|
description: To keep from turning the light on when the room is already naturally lit, this sensor is checked
|
|
selector:
|
|
entity:
|
|
domain: sensor
|
|
device_class: illuminance
|
|
|
|
light_level_trigger:
|
|
name: Light Level Trigger
|
|
description: The Input_Number that is compared against the specified light level sensor
|
|
selector:
|
|
entity:
|
|
domain: input_number
|
|
|
|
manual_switch:
|
|
name: Manual Switch (Optional)
|
|
description: The Switch that should be turned off if the room is in Manual mode
|
|
selector:
|
|
entity:
|
|
domain: switch
|
|
|
|
lighting_automations:
|
|
name: Lighting Automations
|
|
description: The Input_Boolean that describes whether lighting automations are enabled
|
|
selector:
|
|
entity:
|
|
domain: input_boolean
|
|
|
|
guest_mode:
|
|
name: Guest Mode (Optional)
|
|
description: The Input_Boolean that describes whether guest mode is enabled
|
|
selector:
|
|
entity:
|
|
domain: input_boolean
|
|
|
|
mode: restart
|
|
|
|
variables:
|
|
light_level_sensor: !input light_level_sensor
|
|
light_level_trigger: !input light_level_trigger
|
|
|
|
trigger:
|
|
- platform: state
|
|
entity_id: !input room_mode
|
|
|
|
- platform: state
|
|
entity_id: !input room_occupied
|
|
to: 'off'
|
|
|
|
- platform: state
|
|
entity_id: !input light_level_sensor
|
|
|
|
- platform: state
|
|
entity_id: !input light_level_trigger
|
|
|
|
condition:
|
|
- condition: or
|
|
conditions:
|
|
- condition: state
|
|
entity_id: !input room_mode
|
|
state: !input off_option
|
|
- condition: state
|
|
entity_id: !input room_occupied
|
|
state: 'off'
|
|
- "{{ states(light_level_sensor) | float(default=0) >= states(light_level_trigger) | float(default=0) }}"
|
|
|
|
action:
|
|
- choose:
|
|
- conditions:
|
|
- condition: or
|
|
conditions:
|
|
- condition: and
|
|
conditions:
|
|
- condition: state
|
|
entity_id: !input lighting_automations
|
|
state: 'on'
|
|
- condition: state
|
|
entity_id: !input room_occupied
|
|
state: 'off'
|
|
- condition: not
|
|
conditions:
|
|
- condition: state
|
|
entity_id: !input room_mode
|
|
state: !input manual_option
|
|
- "{{ states(light_level_sensor) | float(default=0) >= states(light_level_trigger) | float(default=0) }}"
|
|
sequence:
|
|
- alias: Turn off lights
|
|
service: light.turn_off
|
|
target:
|
|
entity_id: !input target_light
|
|
- choose:
|
|
- conditions:
|
|
- "{{ manual_switch is defined }}"
|
|
- "{{ guest_mode is defined }}"
|
|
sequence:
|
|
- choose:
|
|
- conditions:
|
|
- condition: state
|
|
entity_id: !input guest_mode
|
|
state: 'on'
|
|
sequence:
|
|
- alias: "Turn off the switch since all lights are off"
|
|
service: homeassistant.turn_off
|
|
target:
|
|
entity_id: !input manual_switch |