Update Twanne's lighting blueprints

This commit is contained in:
2025-05-15 00:02:28 -04:00
parent f1180cc34b
commit 3a2fc504f3
3 changed files with 146 additions and 113 deletions

View File

@ -1,7 +1,7 @@
blueprint:
name: Smart Lux Dimmer
author: AntonH
description: 'Version 4.1
description: 'Version 4.3
Switch or dim lights based on the value of a light sensor.
@ -24,10 +24,11 @@ blueprint:
value?
selector:
entity:
domain:
- sensor
device_class:
- illuminance
filter:
- domain:
- sensor
device_class:
- illuminance
multiple: false
target_light:
name: Target lights
@ -81,8 +82,8 @@ blueprint:
min: 0.0
max: 100.0
step: 1.0
mode: slider
unit_of_measurement: '%'
mode: slider
light_value_2:
name: Brightness at minimum light level
description: Brightness of the light at minimum ambient light.
@ -92,8 +93,8 @@ blueprint:
min: 0.0
max: 100.0
step: 1.0
mode: slider
unit_of_measurement: '%'
mode: slider
transition_time:
name: Transition time
description: 'The time it takes for the light to transition from the set value
@ -124,9 +125,9 @@ blueprint:
value: include_color
- label: Set temperature
value: include_temp
multiple: false
sort: false
custom_value: false
sort: false
multiple: false
light_color:
name: Light color
description: Color of the light when between minimum and maximum ambient light
@ -161,8 +162,8 @@ blueprint:
min: 0.0
max: 100.0
step: 1.0
mode: slider
unit_of_measurement: '%'
mode: slider
light_brightness_under_min:
name: Brightness when ambient light value under min.
description: Brightness of the light when the ambient light is lower than the
@ -173,8 +174,8 @@ blueprint:
min: 0.0
max: 100.0
step: 1.0
mode: slider
unit_of_measurement: '%'
mode: slider
include_color_or_temp_over_under:
name: Include color or temperature values when outside range
description: 'Set a color or temperature value for the light when over maximum
@ -193,9 +194,9 @@ blueprint:
value: include_color_outside_range
- label: Set temperature when outside range
value: include_temp_outside_range
multiple: false
sort: false
custom_value: false
sort: false
multiple: false
light_color_over_max:
name: Color when ambient light value over max.
description: Color of the light when the ambient light is higher than the set
@ -236,18 +237,25 @@ variables:
include_brightness_over_under: !input include_brightness_over_under
include_color_or_temp_over_under: !input include_color_or_temp_over_under
light_sensor: !input light_sensor_entity
maxB: !input max_brightness_value
minB: !input min_brightness_value
light1: !input light_value_1
light2: !input light_value_2
max_brightness_value: !input max_brightness_value
min_brightness_value: !input min_brightness_value
maxB: '{{ max_brightness_value * 2.55 }}'
minB: '{{ min_brightness_value * 2.55 }}'
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 ) }}'
trigger:
platform: state
light_brightness_over_max: !input light_brightness_over_max
light_brightness_under_min: !input light_brightness_under_min
brightness_over_max_pct: '{{ light_brightness_over_max * 2.55 }}'
brightness_under_min_pct: '{{ light_brightness_under_min * 2.55 }}'
triggers:
trigger: state
entity_id: !input light_sensor_entity
condition:
- condition: !input run_conditions
action:
conditions: !input run_conditions
actions:
- choose:
- conditions:
- condition: template
@ -258,20 +266,20 @@ action:
- condition: template
value_template: '{{ include_color_or_temp == "include_no_color_temp" }}'
sequence:
- service: light.turn_on
- action: light.turn_on
data:
transition: !input transition_time
brightness_pct: '{{ (( slope * states(light_sensor)|int ) + constant)|round
brightness: '{{ (( slope * states(light_sensor)|int ) + constant)|round
}}'
target: !input target_light
- conditions:
- condition: template
value_template: '{{ include_color_or_temp == "include_color" }}'
sequence:
- service: light.turn_on
- action: light.turn_on
data:
transition: !input transition_time
brightness_pct: '{{ (( slope * states(light_sensor)|int ) + constant)|round
brightness: '{{ (( slope * states(light_sensor)|int ) + constant)|round
}}'
rgb_color: !input light_color
target: !input target_light
@ -279,10 +287,10 @@ action:
- condition: template
value_template: '{{ include_color_or_temp == "include_temp" }}'
sequence:
- service: light.turn_on
- action: light.turn_on
data:
transition: !input transition_time
brightness_pct: '{{ (( slope * states(light_sensor)|int ) + constant)|round
brightness: '{{ (( slope * states(light_sensor)|int ) + constant)|round
}}'
color_temp: !input light_temp
target: !input target_light
@ -302,20 +310,20 @@ action:
entity_id: !input light_sensor_entity
above: !input max_brightness_value
sequence:
- service: light.turn_on
- action: light.turn_on
data:
transition: !input transition_time
brightness_pct: !input light_brightness_over_max
brightness: '{{ brightness_over_max_pct }}'
target: !input target_light
- conditions:
- condition: numeric_state
entity_id: !input light_sensor_entity
below: !input min_brightness_value
sequence:
- service: light.turn_on
- action: light.turn_on
data:
transition: !input transition_time
brightness_pct: !input light_brightness_under_min
brightness: '{{ brightness_under_min_pct }}'
target: !input target_light
- conditions:
- condition: numeric_state
@ -323,10 +331,10 @@ action:
below: !input max_brightness_value
above: !input min_brightness_value
sequence:
- service: light.turn_on
- action: light.turn_on
data:
transition: !input transition_time
brightness_pct: '{{ (( slope * states(light_sensor)|int ) + constant)|round
brightness: '{{ (( slope * states(light_sensor)|int ) + constant)|round
}}'
target: !input target_light
- conditions:
@ -340,10 +348,10 @@ action:
entity_id: !input light_sensor_entity
above: !input max_brightness_value
sequence:
- service: light.turn_on
- action: light.turn_on
data:
transition: !input transition_time
brightness_pct: !input light_brightness_over_max
brightness: '{{ brightness_over_max_pct }}'
rgb_color: !input light_color_over_max
target: !input target_light
- conditions:
@ -351,10 +359,10 @@ action:
entity_id: !input light_sensor_entity
below: !input min_brightness_value
sequence:
- service: light.turn_on
- action: light.turn_on
data:
transition: !input transition_time
brightness_pct: !input light_brightness_under_min
brightness: '{{ brightness_under_min_pct }}'
rgb_color: !input light_color_under_min
target: !input target_light
- conditions:
@ -363,10 +371,10 @@ action:
below: !input max_brightness_value
above: !input min_brightness_value
sequence:
- service: light.turn_on
- action: light.turn_on
data:
transition: !input transition_time
brightness_pct: '{{ (( slope * states(light_sensor)|int ) + constant)|round
brightness: '{{ (( slope * states(light_sensor)|int ) + constant)|round
}}'
rgb_color: !input light_color
target: !input target_light
@ -381,10 +389,10 @@ action:
entity_id: !input light_sensor_entity
above: !input max_brightness_value
sequence:
- service: light.turn_on
- action: light.turn_on
data:
transition: !input transition_time
brightness_pct: !input light_brightness_over_max
brightness: '{{ brightness_over_max_pct }}'
color_temp: !input light_temp_over_max
target: !input target_light
- conditions:
@ -392,10 +400,10 @@ action:
entity_id: !input light_sensor_entity
below: !input min_brightness_value
sequence:
- service: light.turn_on
- action: light.turn_on
data:
transition: !input transition_time
brightness_pct: !input light_brightness_under_min
brightness: '{{ brightness_under_min_pct }}'
color_temp: !input light_temp_under_min
target: !input target_light
- conditions:
@ -404,10 +412,10 @@ action:
below: !input max_brightness_value
above: !input min_brightness_value
sequence:
- service: light.turn_on
- action: light.turn_on
data:
transition: !input transition_time
brightness_pct: '{{ (( slope * states(light_sensor)|int ) + constant)|round
brightness: '{{ (( slope * states(light_sensor)|int ) + constant)|round
}}'
color_temp: !input light_temp
target: !input target_light