mirror of
https://github.com/CeeWeasel/fresh-home.git
synced 2026-08-10 11:00:14 -04:00
264 lines
8.0 KiB
YAML
264 lines
8.0 KiB
YAML
blueprint:
|
|
name: Room Lights to On
|
|
description: "## Room Lights to On\n\nThis blueprint will turn on 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:
|
|
light_name:
|
|
name: Light Name
|
|
description: The name of the light that need to be turned on (without the light.##)
|
|
selector:
|
|
text:
|
|
|
|
auto_option:
|
|
name: Auto Option
|
|
description: The Input_Select option that implies the room is in Auto mode.
|
|
default: Auto
|
|
selector:
|
|
text:
|
|
|
|
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:
|
|
|
|
occupancy_sensor:
|
|
name: Occupancy Sensor
|
|
description: The Binary_Sensor that defines whether the room is occupied
|
|
selector:
|
|
entity:
|
|
domain: binary_sensor
|
|
|
|
motion_sensor:
|
|
name: Motion Sensor
|
|
description: The motion sensor (or group) that defines whether the room is occupied
|
|
selector:
|
|
entity:
|
|
|
|
automatic_profile:
|
|
name: Automatic Profile
|
|
description: The Input_Select that describes the mode to use when a room is set to Auto
|
|
default: input_select.automatic_light_profile
|
|
selector:
|
|
entity:
|
|
domain: input_select
|
|
|
|
room_occupied:
|
|
name: Room Occupied
|
|
description: The Input_Boolean that describes whether the room is occupied
|
|
selector:
|
|
entity:
|
|
domain: input_boolean
|
|
|
|
room_mode:
|
|
name: Room Mode
|
|
description: The Input_Select that describes what mode the room is in
|
|
selector:
|
|
entity:
|
|
domain: input_select
|
|
|
|
home_occupied:
|
|
name: Home Occupied
|
|
description: The Input_Boolean that describes whether the home is occupied
|
|
default: input_boolean.home_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
|
|
|
|
light_scene_transition:
|
|
name: Light Scene Transition
|
|
description: The Input_Number that specifies the transition length when needed
|
|
default: input_number.light_scene_transition
|
|
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:
|
|
|
|
lighting_automations:
|
|
name: Lighting Automations
|
|
description: The Input_Boolean that describes whether lighting automations are enabled
|
|
default: input_boolean.lighting_automations
|
|
selector:
|
|
entity:
|
|
domain: input_boolean
|
|
|
|
guest_mode:
|
|
name: Guest Mode (Optional)
|
|
description: The Input_Boolean that describes whether guest mode is enabled
|
|
default: input_boolean.guest_mode
|
|
selector:
|
|
entity:
|
|
domain: input_boolean
|
|
|
|
mode: single
|
|
max_exceeded: silent
|
|
|
|
variables:
|
|
switch_name: !input manual_switch
|
|
light_name: !input light_name
|
|
light_entity: "{{'light.' ~ light_name}}"
|
|
room_mode: "{{'input_select.' ~ light_name}}"
|
|
automatic_profile: !input automatic_profile
|
|
light_scene_transition: !input light_scene_transition
|
|
light_level_trigger: "{{'input_number.' ~ light_name ~ '_light_level_trigger'}}"
|
|
occupancy_sensor: "{{'binary_sensor.' ~ light_name ~ '_occupied'}}"
|
|
auto_option: !input auto_option
|
|
manual_option: !input manual_option
|
|
off_option: !input off_option
|
|
|
|
trigger:
|
|
- platform: state
|
|
id: mode_change
|
|
entity_id:
|
|
- !input room_mode
|
|
- !input automatic_profile
|
|
|
|
- platform: state
|
|
id: light_level
|
|
entity_id:
|
|
- !input light_level_sensor
|
|
- !input light_level_trigger
|
|
|
|
- platform: state
|
|
id: occupied
|
|
entity_id: !input occupancy_sensor
|
|
to: "on"
|
|
|
|
- platform: state
|
|
id: motion
|
|
entity_id: !input motion_sensor
|
|
to: "on"
|
|
|
|
- platform: state
|
|
entity_id: !input room_occupied
|
|
to: "on"
|
|
|
|
condition:
|
|
- alias: "Home is occupied"
|
|
condition: state
|
|
entity_id: !input home_occupied
|
|
state: "on"
|
|
|
|
- alias: "Check if light should turn on"
|
|
condition: or
|
|
conditions:
|
|
- alias: "Guest mode is on"
|
|
condition: state
|
|
entity_id: !input guest_mode
|
|
state: "on"
|
|
|
|
- alias: "Motion or occupancy were detected in a dim room"
|
|
condition: and
|
|
conditions:
|
|
- alias: "Light level below trigger amount"
|
|
condition: numeric_state
|
|
entity_id: !input light_level_sensor
|
|
below: !input light_level_trigger
|
|
|
|
- alias: "Motion or occupancy were detected"
|
|
condition: or
|
|
conditions:
|
|
- alias: "Motion was detected"
|
|
condition: trigger
|
|
id: "motion"
|
|
- alias: "Occupancy was detected"
|
|
condition: trigger
|
|
id: "occupied"
|
|
|
|
- alias: "A scene changed and the lights are already on"
|
|
condition: and
|
|
conditions:
|
|
- condition: trigger
|
|
id: "mode_change"
|
|
|
|
- condition: state
|
|
entity_id: !input room_occupied
|
|
state: "on"
|
|
|
|
action:
|
|
- alias: "Make sure the switch is turned on"
|
|
action: homeassistant.turn_on
|
|
target:
|
|
entity_id: !input manual_switch
|
|
- choose:
|
|
- alias: "If the room is set to manual, just turn the lights on"
|
|
conditions:
|
|
- "{{is_state(room_mode,manual_option)}}"
|
|
sequence:
|
|
- action: light.turn_on
|
|
target:
|
|
entity_id: "{{light_entity}}"
|
|
|
|
- alias: "If the room is set to auto and the lights are on, change to the Automatic Light Profile scene with a transition"
|
|
conditions:
|
|
- "{{is_state(room_mode,auto_option)}}"
|
|
- "{{is_state(light_entity,'on')}}"
|
|
sequence:
|
|
- action: scene.turn_on
|
|
data:
|
|
transition: "{{ states(light_scene_transition) }}"
|
|
target:
|
|
entity_id: "scene.{{light_name}}_{{states(automatic_profile).lower().replace(' ','_')}}"
|
|
|
|
- alias: "If the room is set to auto and the lights are off, change to the Automatic Light Profile scene without a transition"
|
|
conditions:
|
|
- "{{is_state(room_mode,auto_option)}}"
|
|
- "{{is_state(light_entity,'off')}}"
|
|
sequence:
|
|
- action: scene.turn_on
|
|
target:
|
|
entity_id: "scene.{{light_name}}_{{states(automatic_profile).lower().replace(' ','_')}}"
|
|
|
|
- alias: "If the room is not set to auto and the lights are on, change to the room mode scene with a transition"
|
|
conditions:
|
|
- "{{is_state(light_entity,'on')}}"
|
|
sequence:
|
|
- action: scene.turn_on
|
|
data:
|
|
transition: "{{ states(light_scene_transition) }}"
|
|
target:
|
|
entity_id: "scene.{{light_name}}_{{states(mode_name).lower().replace(' ','_')}}"
|
|
|
|
- alias: "If the room is not set to auto and the lights are on, change to the room scene without a transition"
|
|
conditions:
|
|
- "{{is_state(light_entity,'off')}}"
|
|
sequence:
|
|
- action: scene.turn_on
|
|
target:
|
|
entity_id: "scene.{{light_name}}_{{states(mode_name).lower().replace(' ','_')}}"
|
|
|
|
- delay: 1
|