116 lines
3.7 KiB
YAML
116 lines
3.7 KiB
YAML
blueprint:
|
|
name: Occupancy Controlled Lights with Adaptive Lighting
|
|
description: Automatically turn lights on/off based on multiple occupancy sensors with adaptive lighting support. Lights turn on when any sensor detects motion and turn off only when all sensors are clear for the configured delay.
|
|
domain: automation
|
|
input:
|
|
occupancy_sensors:
|
|
name: Occupancy Sensors
|
|
description: Binary sensors that detect occupancy/presence in the area
|
|
selector:
|
|
entity:
|
|
domain: binary_sensor
|
|
device_class: occupancy
|
|
multiple: true
|
|
lights:
|
|
name: Lights
|
|
description: Light entities to control
|
|
selector:
|
|
target:
|
|
entity:
|
|
domain: light
|
|
adaptive_lighting_switch:
|
|
name: Adaptive Lighting Switch
|
|
description: Adaptive lighting switch entity for this room
|
|
default: {}
|
|
selector:
|
|
entity:
|
|
domain: switch
|
|
integration: adaptive_lighting
|
|
turn_on_transition:
|
|
name: Turn On Transition
|
|
description: Transition time in seconds when turning lights on
|
|
default: 5
|
|
selector:
|
|
number:
|
|
min: 0
|
|
max: 300
|
|
step: 1
|
|
unit_of_measurement: seconds
|
|
turn_off_transition:
|
|
name: Turn Off Transition
|
|
description: Transition time in seconds when turning lights off
|
|
default: 15
|
|
selector:
|
|
number:
|
|
min: 0
|
|
max: 300
|
|
step: 1
|
|
unit_of_measurement: seconds
|
|
adapt_brightness:
|
|
name: Adapt Brightness
|
|
description: Whether to adapt brightness when turning on lights
|
|
default: true
|
|
selector:
|
|
boolean:
|
|
adapt_color:
|
|
name: Adapt Color
|
|
description: Whether to adapt color when turning on lights
|
|
default: true
|
|
selector:
|
|
boolean:
|
|
off_delay:
|
|
name: Off Delay
|
|
description: Time to wait after no motion before turning lights off
|
|
default: 0
|
|
selector:
|
|
number:
|
|
min: 0
|
|
max: 3600
|
|
step: 1
|
|
unit_of_measurement: seconds
|
|
|
|
trigger:
|
|
- platform: state
|
|
entity_id: !input occupancy_sensors
|
|
|
|
condition: []
|
|
|
|
action:
|
|
- variables:
|
|
occupancy_sensors: !input occupancy_sensors
|
|
adaptive_lighting_switch: !input adaptive_lighting_switch
|
|
- choose:
|
|
- conditions:
|
|
- condition: template
|
|
value_template: "{{ expand(occupancy_sensors) | selectattr('state', 'eq', 'on') | list | count > 0 }}"
|
|
sequence:
|
|
- if:
|
|
- condition: template
|
|
value_template: "{{ adaptive_lighting_switch != none and adaptive_lighting_switch != {} }}"
|
|
then:
|
|
- action: adaptive_lighting.apply
|
|
data:
|
|
entity_id: !input adaptive_lighting_switch
|
|
turn_on_lights: true
|
|
transition: !input turn_on_transition
|
|
adapt_brightness: !input adapt_brightness
|
|
adapt_color: !input adapt_color
|
|
else:
|
|
- action: light.turn_on
|
|
target: !input lights
|
|
data:
|
|
transition: !input turn_on_transition
|
|
- conditions:
|
|
- condition: template
|
|
value_template: "{{ expand(occupancy_sensors) | selectattr('state', 'eq', 'on') | list | count == 0 }}"
|
|
sequence:
|
|
- delay:
|
|
seconds: !input off_delay
|
|
- condition: template
|
|
value_template: "{{ expand(occupancy_sensors) | selectattr('state', 'eq', 'on') | list | count == 0 }}"
|
|
- action: light.turn_off
|
|
target: !input lights
|
|
data:
|
|
transition: !input turn_off_transition
|
|
|
|
mode: restart |