451 lines
16 KiB
YAML
451 lines
16 KiB
YAML
blueprint:
|
|
name: The Everything Light
|
|
author: AntonH
|
|
description: "**Version 2.10**\nThe Everything Light: select any trigger and turn
|
|
on your light in multiple ways:\n - just turn the light on in it's default state\n
|
|
\ - turn it on with a set brightness, color and/or temperature value\n - turn
|
|
it on dynamically with a brightness value that changes according to an ambient
|
|
light sensor\n\nThe blueprint also allows you to turn the light off again in 3
|
|
ways:\n - at a set time\n - with 1 or more triggers\n - with a staircase function
|
|
(turn off the light after a set time has passed)\n\n Conditions can be set to
|
|
prevent both turn on and turn off functions.\n\n**The dynamic lighting logic is
|
|
based of the Smart Lux Dimmer Blueprint:**\n - [Find it on the Home Assistant
|
|
Community forums:](https://community.home-assistant.io/t/smart-lux-dimmer-adjust-light-brightness-depending-on-light-sensor-value/403646)\n
|
|
\ - [See the source on Github:](https://gist.github.com/Twanne/02dfb154084a8b9bf927c29160df4af3)\n"
|
|
source_url: https://gist.github.com/Twanne/8003f5d00da69ae3260e9a69864e5ff5
|
|
domain: automation
|
|
input:
|
|
triggers:
|
|
name: Triggers
|
|
description: Choose what turns your light on
|
|
default: []
|
|
selector:
|
|
trigger: {}
|
|
run_conditions:
|
|
name: Conditions
|
|
description: Only turn the light on when these conditions are met.
|
|
default:
|
|
- condition: time
|
|
alias: Run only at these times ( - Remove me if not needed - )
|
|
selector:
|
|
condition: {}
|
|
target_light:
|
|
name: Target lights
|
|
description: "Which lights do you want to control?\n\nSupported entity types
|
|
are:\n - light\n - switch (Only **DEFAULT** & **TOGGLE** modes are supported)\n"
|
|
default: []
|
|
selector:
|
|
target:
|
|
entity:
|
|
- domain:
|
|
- light
|
|
- switch
|
|
mode:
|
|
name: Mode
|
|
description: 'How do you want the light to turn on?
|
|
|
|
|
|
- **DEFAULT MODE:**
|
|
|
|
The light will turn on at it''s default setting.
|
|
|
|
|
|
- **TOGGLE MODE:**
|
|
|
|
Toggle the light.
|
|
|
|
|
|
- **FIXED MODE:**
|
|
|
|
The light will turn on at a set brightness percentage, optionally color or
|
|
temperature can be set.
|
|
|
|
|
|
- **DYNAMIC MODE:**
|
|
|
|
The light will be assigned a brightness value based on the value of a ambient
|
|
light sensor, optionally color or temperature can be set.
|
|
|
|
'
|
|
default: default
|
|
selector:
|
|
select:
|
|
mode: dropdown
|
|
options:
|
|
- label: DEFAULT MODE
|
|
value: default
|
|
- label: TOGGLE MODE
|
|
value: toggle
|
|
- label: FIXED MODE
|
|
value: fixed
|
|
- label: DYNAMIC MODE
|
|
value: dynamic
|
|
custom_value: false
|
|
sort: false
|
|
multiple: false
|
|
transition_time:
|
|
name: Transition time (FIXED & DYNAMIC MODE)
|
|
description: "The time it takes for the light to transition to the assigned
|
|
value when it's triggered.\n\nWARNING!: \n This can smoothen the transition,
|
|
but your light needs to support it.\n Leave at 0 if you don't need it or
|
|
if your light doesn't support it.\n"
|
|
default: 0
|
|
selector:
|
|
number:
|
|
min: 0.0
|
|
max: 300.0
|
|
step: 1.0
|
|
unit_of_measurement: s
|
|
mode: slider
|
|
include_color_or_temp:
|
|
name: Include color or temperature (FIXED & DYNAMIC MODE)
|
|
description: Do you want to set a color or temperature value for the light?
|
|
default: include_no_color_temp
|
|
selector:
|
|
select:
|
|
options:
|
|
- label: I don't want to set color or temperature
|
|
value: include_no_color_temp
|
|
- label: Set color
|
|
value: include_color
|
|
- label: Set temperature
|
|
value: include_temperature
|
|
custom_value: false
|
|
sort: false
|
|
multiple: false
|
|
light_color:
|
|
name: Light color (FIXED & DYNAMIC MODE)
|
|
description: Color of the light when between minimum and maximum ambient light
|
|
values.
|
|
default:
|
|
- 255
|
|
- 255
|
|
- 255
|
|
selector:
|
|
color_rgb: {}
|
|
light_temperature:
|
|
name: Light temperature (FIXED & DYNAMIC MODE)
|
|
description: 'Temperature of the light when between minimum and maximum ambient
|
|
light values.
|
|
|
|
(not all lights will support all values, please consult your lights spec sheet.)
|
|
|
|
'
|
|
default: 2000
|
|
selector:
|
|
color_temp:
|
|
unit: kelvin
|
|
min: 1500
|
|
max: 6500
|
|
brightness:
|
|
name: Brightness (FIXED BRIGHTNESS MODE)
|
|
description: Set the brightness value the light needs to turn on at
|
|
default: 100
|
|
selector:
|
|
number:
|
|
min: 0.0
|
|
max: 100.0
|
|
step: 1.0
|
|
mode: slider
|
|
light_sensor_entity:
|
|
name: Light Sensor (DYNAMIC MODE)
|
|
description: Which light sensor do you want to use to measure the ambient light
|
|
value?
|
|
default:
|
|
selector:
|
|
entity:
|
|
filter:
|
|
- domain:
|
|
- sensor
|
|
device_class:
|
|
- illuminance
|
|
multiple: false
|
|
max_brightness_value:
|
|
name: Maximum ambient light value (DYNAMIC MODE)
|
|
description: Dynamically change the light so long as the ambient light stays
|
|
under this value.
|
|
default: 500
|
|
selector:
|
|
number:
|
|
min: 0.0
|
|
max: 1000.0
|
|
step: 10.0
|
|
unit_of_measurement: lx
|
|
mode: slider
|
|
min_brightness_value:
|
|
name: Minimum ambient light value (DYNAMIC MODE)
|
|
description: Dynamically change the light so long as the ambient light stays
|
|
above this value.
|
|
default: 0
|
|
selector:
|
|
number:
|
|
min: 0.0
|
|
max: 1000.0
|
|
step: 10.0
|
|
unit_of_measurement: lx
|
|
mode: slider
|
|
light_value_1:
|
|
name: Brightness at maximum light level (DYNAMIC MODE)
|
|
description: Brightness of the light at maximum ambient light.
|
|
default: 0
|
|
selector:
|
|
number:
|
|
min: 0.0
|
|
max: 100.0
|
|
step: 1.0
|
|
mode: slider
|
|
light_value_2:
|
|
name: Brightness at minimum light level (DYNAMIC MODE)
|
|
description: Brightness of the light at minimum ambient light.
|
|
default: 100
|
|
selector:
|
|
number:
|
|
min: 0.0
|
|
max: 100.0
|
|
step: 1.0
|
|
mode: slider
|
|
light_brightness_over_max:
|
|
name: Brightness when ambient light value over max (DYNAMIC MODE)
|
|
description: Brightness of the light when the ambient light is higher than the
|
|
set maximum value.
|
|
default: 0
|
|
selector:
|
|
number:
|
|
min: 0.0
|
|
max: 100.0
|
|
step: 1.0
|
|
mode: slider
|
|
light_brightness_under_min:
|
|
name: Brightness when ambient light value under min (DYNAMIC MODE)
|
|
description: Brightness of the light when the ambient light is lower than the
|
|
set minimum value.
|
|
default: 255
|
|
selector:
|
|
number:
|
|
min: 0.0
|
|
max: 100.0
|
|
step: 1.0
|
|
mode: slider
|
|
include_color_or_temp_over_under:
|
|
name: Include color or temperature values when outside range (DYNAMIC MODE)
|
|
description: 'Set a color or temperature value for the light when over maximum
|
|
or under minimum ambient light value?
|
|
|
|
*''Include values for under min and over max''* **MUST BE TRUE**
|
|
|
|
'
|
|
default: include_no_color_temp_outside_range
|
|
selector:
|
|
select:
|
|
options:
|
|
- label: I don't want to set color or temperature when outside range
|
|
value: include_no_color_temp_outside_range
|
|
- label: Set color when outside range
|
|
value: include_color_outside_range
|
|
- label: Set temperature when outside range
|
|
value: include_temp_outside_range
|
|
custom_value: false
|
|
sort: false
|
|
multiple: false
|
|
light_color_over_max:
|
|
name: Color when ambient light value over max (DYNAMIC MODE)
|
|
description: Color of the light when the ambient light is higher than the set
|
|
maximum value.
|
|
default:
|
|
- 255
|
|
- 255
|
|
- 255
|
|
selector:
|
|
color_rgb: {}
|
|
light_color_under_min:
|
|
name: Color when ambient light value under min (DYNAMIC MODE)
|
|
description: Color of the light when the ambient light is lower than the set
|
|
minimum value.
|
|
default:
|
|
- 255
|
|
- 255
|
|
- 255
|
|
selector:
|
|
color_rgb: {}
|
|
light_temp_over_max:
|
|
name: Temperature when ambient light value over max (DYNAMIC MODE)
|
|
description: 'Temperature of the light when the ambient light is higher than
|
|
the set maximum value.
|
|
|
|
(not all lights will support all values, please consult your lights spec sheet.)
|
|
|
|
'
|
|
default: 2000
|
|
selector:
|
|
color_temp:
|
|
unit: kelvin
|
|
min: 1500
|
|
max: 6500
|
|
light_temp_under_min:
|
|
name: Temperature when ambient light value under min (DYNAMIC MODE)
|
|
description: 'Temperature of the light when the ambient light is lower than
|
|
the set minimum value.
|
|
|
|
(not all lights will support all values, please consult your lights spec sheet.)
|
|
|
|
'
|
|
default: 2000
|
|
selector:
|
|
color_temp:
|
|
unit: kelvin
|
|
min: 1500
|
|
max: 6500
|
|
include_turn_off:
|
|
name: Include light turn off function
|
|
description: 'Select if the light needs to turn back off again and how you want
|
|
to do it.
|
|
|
|
(Multiple options are possible)
|
|
|
|
|
|
- **TURN OFF WITH TRIGGER:**
|
|
|
|
Select triggers that turn off the light.
|
|
|
|
|
|
- **STAIRCASE FUNCTION:**
|
|
|
|
Waits after the light has been turned on and then turns it back off after
|
|
the set duration.
|
|
|
|
'
|
|
default: []
|
|
selector:
|
|
select:
|
|
multiple: true
|
|
options:
|
|
- label: Turn off with trigger
|
|
value: trigger
|
|
- label: Staircase function
|
|
value: staircase
|
|
custom_value: false
|
|
sort: false
|
|
turn_off_triggers:
|
|
name: Turn off triggers
|
|
description: Triggers that turn the light off
|
|
default:
|
|
selector:
|
|
trigger: {}
|
|
staircase_duration:
|
|
name: Staircase light
|
|
description: Turns the light off again after a set time (staircase function).
|
|
default:
|
|
hours: 0
|
|
minutes: 0
|
|
seconds: 0
|
|
days: 0
|
|
selector:
|
|
duration:
|
|
enable_day: true
|
|
turn_off_conditions:
|
|
name: Turn off Conditions
|
|
description: 'Only turn the light off when these conditions are met.
|
|
|
|
(Only works with the turn off functions, DYNAMIC MODE is not impacted by this)
|
|
|
|
'
|
|
default: []
|
|
selector:
|
|
condition: {}
|
|
mode: restart
|
|
variables:
|
|
mode: !input mode
|
|
transition_time: !input transition_time
|
|
include_color_or_temp: !input include_color_or_temp
|
|
light_color: !input light_color
|
|
light_temperature: !input light_temperature
|
|
brightness: !input brightness
|
|
light_brightness: '{{ brightness * 2.55 }}'
|
|
light_sensor: !input light_sensor_entity
|
|
maxB: !input max_brightness_value
|
|
minB: !input min_brightness_value
|
|
light_value_1: !input light_value_1
|
|
light_value_2: !input light_value_2
|
|
light1: '{{ light_value_1 * 2.55 }}'
|
|
light2: '{{ light_value_2 * 2.55 }}'
|
|
slope: '{{ ( light1 - light2 ) / ( maxB - minB ) }}'
|
|
constant: '{{ light1 - ( slope * maxB ) }}'
|
|
dynamic_brightness: "{% if mode == \"dynamic\" %}\n {{ (( slope * states(light_sensor)|int
|
|
) + constant)|round }}\n{% else %}\n 0\n{% endif %}\n"
|
|
include_color_or_temp_over_under: !input include_color_or_temp_over_under
|
|
light_brightness_over_max: !input light_brightness_over_max
|
|
brightness_over_max_pct: '{{ light_brightness_over_max * 2.55 }}'
|
|
light_color_over_max: !input light_color_over_max
|
|
light_temp_over_max: !input light_temp_over_max
|
|
light_brightness_under_min: !input light_brightness_under_min
|
|
brightness_under_min_pct: '{{ light_brightness_under_min * 2.55 }}'
|
|
light_color_under_min: !input light_color_under_min
|
|
light_temp_under_min: !input light_temp_under_min
|
|
include_turn_off: !input include_turn_off
|
|
trigger: !input triggers
|
|
conditions: !input run_conditions
|
|
actions:
|
|
- choose:
|
|
- conditions: '{{ mode == "toggle" }}'
|
|
sequence:
|
|
- action: homeassistant.toggle
|
|
target: !input target_light
|
|
- conditions: '{{ mode == "default" }}'
|
|
sequence:
|
|
- action: homeassistant.turn_on
|
|
target: !input target_light
|
|
- conditions: '{{ mode == "fixed" }}'
|
|
sequence:
|
|
- action: light.turn_on
|
|
data: "{% if include_color_or_temp == \"include_color\" %}\n {{ { \"transition\":
|
|
transition_time, \"brightness\": light_brightness, \"rgb_color\": light_color
|
|
} }}\n{% elif include_color_or_temp == \"include_temperature\" %}\n {{ {
|
|
\"transition\": transition_time, \"brightness\": light_brightness, \"color_temp\":
|
|
light_temperature } }}\n{% else %}\n {{ { \"transition\": transition_time,
|
|
\"brightness\": light_brightness } }}\n{% endif %}\n"
|
|
target: !input target_light
|
|
- conditions: '{{ mode == "dynamic" }}'
|
|
sequence:
|
|
- action: light.turn_on
|
|
data: "{% if states(light_sensor)|int > maxB %}\n {% if include_color_or_temp_over_under
|
|
== \"include_color_outside_range\" %}\n {{ { \"transition\": transition_time,
|
|
\"brightness\": brightness_over_max_pct, \"rgb_color\": light_color_over_max
|
|
} }}\n {% elif include_color_or_temp_over_under == \"include_temp_outside_range\"
|
|
%}\n {{ { \"transition\": transition_time, \"brightness\": brightness_over_max_pct,
|
|
\"color_temp\": light_temp_over_max } }}\n {% else %}\n {{ { \"transition\":
|
|
transition_time, \"brightness\": brightness_over_max_pct } }}\n {% endif
|
|
%}\n{% elif states(light_sensor)|int < minB %}\n {% if include_color_or_temp_over_under
|
|
== \"include_color_outside_range\" %}\n {{ { \"transition\": transition_time,
|
|
\"brightness\": brightness_under_min_pct, \"rgb_color\": light_color_under_min
|
|
} }}\n {% elif include_color_or_temp_over_under == \"include_temp_outside_range\"
|
|
%}\n {{ { \"transition\": transition_time, \"brightness\": brightness_under_min_pct,
|
|
\"color_temp\": light_temp_under_min } }}\n {% else %}\n {{ { \"transition\":
|
|
transition_time, \"brightness\": brightness_under_min_pct } }}\n {% endif
|
|
%}\n{% else %}\n {% if include_color_or_temp == \"include_color\" %}\n {{
|
|
{ \"transition\": transition_time, \"brightness\": light_brightness, \"rgb_color\":
|
|
light_color } }}\n {% elif include_color_or_temp == \"include_temperature\"
|
|
%}\n {{ { \"transition\": transition_time, \"brightness\": dynamic_brightness,
|
|
\"color_temp\": light_temperature } }}\n {% else %}\n {{ { \"transition\":
|
|
transition_time, \"brightness\": dynamic_brightness } }}\n {% endif %}\n{%
|
|
endif %}\n"
|
|
target: !input target_light
|
|
- if: !input turn_off_conditions
|
|
then:
|
|
- choose:
|
|
- conditions: '{{ "staircase" in include_turn_off }}'
|
|
sequence:
|
|
- if: '{{ "trigger" in include_turn_off }}'
|
|
then:
|
|
- wait_for_trigger: !input turn_off_triggers
|
|
timeout: !input staircase_duration
|
|
else:
|
|
- delay: !input staircase_duration
|
|
- action: homeassistant.turn_off
|
|
target: !input target_light
|
|
- conditions: '{{ "trigger" in include_turn_off and not "staircase" in include_turn_off
|
|
}}'
|
|
sequence:
|
|
- wait_for_trigger: !input turn_off_triggers
|
|
- action: homeassistant.turn_off
|
|
target: !input target_light
|