Add some lighting blueprints to mess around with
This commit is contained in:
5934
blueprints/automation/Blackshome/sensor-light.yaml
Normal file
5934
blueprints/automation/Blackshome/sensor-light.yaml
Normal file
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,297 @@
|
||||
blueprint:
|
||||
name: "\U0001F6AA Contact Sensor Left Open Notification by Malte"
|
||||
description: "\U0001F4F2 Notifies you when a door or window is left open.\n\nAre
|
||||
you tired of worrying about open doors or windows? This blueprint has got you
|
||||
covered! It's designed to send you a prompt notification when a door or window
|
||||
remains open for a specified duration.\n\n\U0001F4D6 For Details see this [Blog
|
||||
post](https://community.home-assistant.io/t/contact-sensor-door-or-window-left-open-notification/652571)\n"
|
||||
domain: automation
|
||||
source_url: https://gist.github.com/Raukze/27fe0c6bf6d91b8ae2ab5e11880509ba
|
||||
input:
|
||||
trigger_entity:
|
||||
name: "\U0001F916 Entity"
|
||||
description: 'The entity that will trigger the automation. This must be a binary
|
||||
sensor or input_boolean. (e.g., binary_sensor.fridge)
|
||||
|
||||
'
|
||||
selector:
|
||||
entity:
|
||||
domain:
|
||||
- binary_sensor
|
||||
- input_boolean
|
||||
multiple: false
|
||||
friendly_name:
|
||||
name: "\U0001F3F7️ Device Friendly Name"
|
||||
description: What should we call the entity in the notification? (e.g. Fridge)
|
||||
default: ''
|
||||
selector:
|
||||
text: {}
|
||||
issue_state:
|
||||
name: ⚠️ Issue State
|
||||
description: 'The state that triggers the automation. Because this is a binary
|
||||
sensor, it can only be on or off. Use the developer tools to find the correct
|
||||
setting.
|
||||
|
||||
'
|
||||
default: 'on'
|
||||
selector:
|
||||
select:
|
||||
options:
|
||||
- 'on'
|
||||
- 'off'
|
||||
multiple: false
|
||||
sort: false
|
||||
custom_value: false
|
||||
duration_issue_state:
|
||||
name: ⏰ Time before alert
|
||||
description: The amount of time that the device can be in the issue state before
|
||||
an alert is triggered.
|
||||
default:
|
||||
minutes: 10
|
||||
selector:
|
||||
duration:
|
||||
enable_day: true
|
||||
condition_send_notification:
|
||||
name: "\U0001F50D Additional condition"
|
||||
description: Define a condition that is checked after the initial trigger before
|
||||
the notification is sent.
|
||||
default: []
|
||||
selector:
|
||||
condition: {}
|
||||
delete_notification:
|
||||
name: "\U0001F5D1️ Delete notification when not in issue state anymore."
|
||||
description: 'Do you want the notification to be deleted automatically when
|
||||
the device state is not in the issue state anymore.
|
||||
|
||||
'
|
||||
default: true
|
||||
selector:
|
||||
boolean: {}
|
||||
duration_from_issue_state:
|
||||
name: ⏰ Time from issue state before alert removal
|
||||
description: 'The amount of time that the device has not been in the issue state
|
||||
before the alert gets removed.
|
||||
|
||||
'
|
||||
default:
|
||||
seconds: 5
|
||||
selector:
|
||||
duration:
|
||||
enable_day: true
|
||||
notify_services_string:
|
||||
name: "\U0001F4F2 Notify Services"
|
||||
description: 'The service that will be called to deliver the notification. (e.g.,
|
||||
notify.mobile_app_my_phone).
|
||||
|
||||
It also supports multiple services, separated by a comma. (e.g., notify.mobile_app_my_phone,notify.mobile_app_my_spouse_phone).
|
||||
|
||||
'
|
||||
default: notify.mobile_app_<your_device_id_here>
|
||||
selector:
|
||||
text: {}
|
||||
notification_click_url:
|
||||
name: "\U0001F517 Click URL"
|
||||
description: 'Where the user will be taken if they tap the notification. (e.g.,
|
||||
/lovelace/kitchen)
|
||||
|
||||
'
|
||||
default: /lovelace/ROOM
|
||||
selector:
|
||||
text: {}
|
||||
notification_title:
|
||||
name: "\U0001F4E2 Notification Title"
|
||||
description: The title of the notification.
|
||||
default: The {{ friendly_name }} was left open
|
||||
selector:
|
||||
text: {}
|
||||
notification_message:
|
||||
name: "\U0001F4EC Notification Message"
|
||||
description: 'The message of the notification.
|
||||
|
||||
'
|
||||
default: The {{ friendly_name }} was left open at {{ as_timestamp(now()) | timestamp_custom('%T',
|
||||
True) }}.
|
||||
selector:
|
||||
text: {}
|
||||
repeat_notification:
|
||||
name: "\U0001F501 Repeat Notification"
|
||||
description: Whether or not a notification should be repeated after a certain
|
||||
time.
|
||||
default: false
|
||||
selector:
|
||||
boolean: {}
|
||||
time_between_repeat_notification:
|
||||
name: ⏳ Time Between Repeat
|
||||
description: Time period after which the repeat notification is triggered.
|
||||
default:
|
||||
minutes: 10
|
||||
selector:
|
||||
duration:
|
||||
enable_day: true
|
||||
notification_icon_warning:
|
||||
name: "\U0001F6A8 Notification Icon (Android Only)"
|
||||
description: 'The icon that is shown when the issue is reported. (e.g., mdi:fridge-alert)
|
||||
|
||||
'
|
||||
default: alert
|
||||
selector:
|
||||
select:
|
||||
options:
|
||||
- alert
|
||||
- alert-circle
|
||||
- door
|
||||
- door-open
|
||||
- motion-sensor
|
||||
- fridge
|
||||
- fridge-alert
|
||||
- home
|
||||
- home-alert
|
||||
- home-assistant
|
||||
- window-closed
|
||||
- window-open
|
||||
- window-open-variant
|
||||
multiple: false
|
||||
sort: false
|
||||
custom_value: false
|
||||
notification_color:
|
||||
name: "\U0001F308 Notification Color (Android Only)"
|
||||
description: The color of the notification.
|
||||
default: red
|
||||
selector:
|
||||
select:
|
||||
options:
|
||||
- red
|
||||
- orange
|
||||
- yellow
|
||||
- green
|
||||
- blue
|
||||
- purple
|
||||
multiple: false
|
||||
sort: false
|
||||
custom_value: false
|
||||
notification_persistent:
|
||||
name: "\U0001F4CC Persistent Notification (Android Only)"
|
||||
description: The notification cannot be closed manually.
|
||||
default: false
|
||||
selector:
|
||||
boolean: {}
|
||||
notification_interruption_level:
|
||||
name: "\U0001F514 Interruption Level (iOS Only)"
|
||||
description: 'The intrusiveness of the notification received. This also determines
|
||||
whether the notification will be delivered while the device is in a focus
|
||||
mode.
|
||||
|
||||
'
|
||||
default: active
|
||||
selector:
|
||||
select:
|
||||
options:
|
||||
- passive
|
||||
- active
|
||||
- time-sensitive
|
||||
- critical
|
||||
multiple: false
|
||||
sort: false
|
||||
custom_value: false
|
||||
custom_action_issue_state:
|
||||
name: ⚙️ Custom Action Issue State
|
||||
description: Custom actions that are executed when the device state enters the
|
||||
issue state.
|
||||
default: []
|
||||
selector:
|
||||
action: {}
|
||||
custom_action_from_issue_state:
|
||||
name: ⚙️ Custom Action From Issue State
|
||||
description: Custom actions that are executed when the device state exits the
|
||||
issue state.
|
||||
default: []
|
||||
selector:
|
||||
action: {}
|
||||
mode: restart
|
||||
max_exceeded: silent
|
||||
variables:
|
||||
friendly_name: !input friendly_name
|
||||
trigger_entity: !input trigger_entity
|
||||
issue_state: !input issue_state
|
||||
duration_issue_state: !input duration_issue_state
|
||||
condition_send_notification: !input condition_send_notification
|
||||
delete_notification: !input delete_notification
|
||||
duration_from_issue_state: !input duration_from_issue_state
|
||||
notify_services_string: !input notify_services_string
|
||||
notification_click_url: !input notification_click_url
|
||||
notification_title: !input notification_title
|
||||
notification_message: !input notification_message
|
||||
repeat_notification: !input repeat_notification
|
||||
time_between_repeat_notification: !input time_between_repeat_notification
|
||||
notification_icon_warning: !input notification_icon_warning
|
||||
notification_color: !input notification_color
|
||||
notification_interruption_level: !input notification_interruption_level
|
||||
custom_action_issue_state: !input custom_action_issue_state
|
||||
custom_action_from_issue_state: !input custom_action_from_issue_state
|
||||
trigger:
|
||||
- platform: state
|
||||
entity_id: !input trigger_entity
|
||||
to: !input issue_state
|
||||
for: !input duration_issue_state
|
||||
id: send_notification
|
||||
- platform: state
|
||||
entity_id: !input trigger_entity
|
||||
from: !input issue_state
|
||||
for: !input duration_from_issue_state
|
||||
id: delete_notification
|
||||
action:
|
||||
- variables:
|
||||
notify_services_list: '{{ notify_services_string.split('','') }}'
|
||||
number_of_notify_services: '{{ notify_services_list | count }}'
|
||||
notification_tag: '{{ trigger_entity[-20:] }}-{{ friendly_name[-20:] }}-{{ notify_services_string[-20:]
|
||||
}}'
|
||||
- choose:
|
||||
- conditions:
|
||||
- condition: trigger
|
||||
id: send_notification
|
||||
- condition: !input condition_send_notification
|
||||
sequence:
|
||||
- repeat:
|
||||
sequence:
|
||||
- parallel:
|
||||
- repeat:
|
||||
count: '{{ number_of_notify_services }}'
|
||||
sequence:
|
||||
- service: '{{ notify_services_list[repeat.index-1] }}'
|
||||
data:
|
||||
message: !input notification_message
|
||||
title: !input notification_title
|
||||
data:
|
||||
clickAction: !input notification_click_url
|
||||
url: !input notification_click_url
|
||||
tag: '{{ notification_tag }}'
|
||||
color: !input notification_color
|
||||
notification_icon: mdi:{{ notification_icon_warning }}
|
||||
push:
|
||||
interruption-level: !input notification_interruption_level
|
||||
persistent: !input notification_persistent
|
||||
sticky: !input notification_persistent
|
||||
- choose: []
|
||||
default: !input custom_action_issue_state
|
||||
- if:
|
||||
- '{{ repeat_notification }}'
|
||||
then:
|
||||
- delay: '{{ time_between_repeat_notification }}'
|
||||
until:
|
||||
- '{{ not repeat_notification }}'
|
||||
- conditions:
|
||||
- condition: trigger
|
||||
id: delete_notification
|
||||
- '{{ delete_notification }}'
|
||||
sequence:
|
||||
- parallel:
|
||||
- repeat:
|
||||
count: '{{ number_of_notify_services }}'
|
||||
sequence:
|
||||
- service: '{{ notify_services_list[repeat.index-1] }}'
|
||||
data:
|
||||
message: clear_notification
|
||||
data:
|
||||
tag: '{{ notification_tag }}'
|
||||
- choose: []
|
||||
default: !input custom_action_from_issue_state
|
413
blueprints/automation/Twanne/smart_lux_dimmer.yaml
Normal file
413
blueprints/automation/Twanne/smart_lux_dimmer.yaml
Normal file
@ -0,0 +1,413 @@
|
||||
blueprint:
|
||||
name: Smart Lux Dimmer
|
||||
author: AntonH
|
||||
description: 'Version 4.1
|
||||
|
||||
Switch or dim lights based on the value of a light sensor.
|
||||
|
||||
Light colors or temperature can be set to a fixed value when inside or outside
|
||||
the measuring range (different values are possible).
|
||||
|
||||
Settings for brightness, color or temperature outside min and max values of the
|
||||
sensor can be set.
|
||||
|
||||
To smoothen out transitions, a time can be set where the light will move from
|
||||
the current to the new brightness.
|
||||
|
||||
'
|
||||
source_url: https://gist.github.com/Twanne/02dfb154084a8b9bf927c29160df4af3
|
||||
domain: automation
|
||||
input:
|
||||
light_sensor_entity:
|
||||
name: Light Sensor
|
||||
description: Which light sensor do you want to use to measure the ambient light
|
||||
value?
|
||||
selector:
|
||||
entity:
|
||||
domain:
|
||||
- sensor
|
||||
device_class:
|
||||
- illuminance
|
||||
multiple: false
|
||||
target_light:
|
||||
name: Target lights
|
||||
description: Which lights do you want to control?
|
||||
selector:
|
||||
target:
|
||||
entity:
|
||||
- domain:
|
||||
- light
|
||||
run_conditions:
|
||||
name: Conditions
|
||||
description: 'Only run when these conditions are met.
|
||||
|
||||
(Remove Time Condition if not needed)
|
||||
|
||||
'
|
||||
default:
|
||||
- condition: time
|
||||
selector:
|
||||
condition: {}
|
||||
max_brightness_value:
|
||||
name: Maximum ambient light value
|
||||
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
|
||||
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
|
||||
description: Brightness of the light at maximum ambient light.
|
||||
default: 0
|
||||
selector:
|
||||
number:
|
||||
min: 0.0
|
||||
max: 100.0
|
||||
step: 1.0
|
||||
mode: slider
|
||||
unit_of_measurement: '%'
|
||||
light_value_2:
|
||||
name: Brightness at minimum light level
|
||||
description: Brightness of the light at minimum ambient light.
|
||||
default: 100
|
||||
selector:
|
||||
number:
|
||||
min: 0.0
|
||||
max: 100.0
|
||||
step: 1.0
|
||||
mode: slider
|
||||
unit_of_measurement: '%'
|
||||
transition_time:
|
||||
name: Transition time
|
||||
description: 'The time it takes for the light to transition from the set value
|
||||
to the next.
|
||||
|
||||
WARNING: this can smoothen the transition, but your light needs to support
|
||||
it.
|
||||
|
||||
'
|
||||
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
|
||||
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_temp
|
||||
multiple: false
|
||||
sort: false
|
||||
custom_value: false
|
||||
light_color:
|
||||
name: Light color
|
||||
description: Color of the light when between minimum and maximum ambient light
|
||||
values.
|
||||
selector:
|
||||
color_rgb: {}
|
||||
default:
|
||||
- 255
|
||||
- 255
|
||||
- 255
|
||||
light_temp:
|
||||
name: Light temperature
|
||||
description: Temperature of the light when between minimum and maximum ambient
|
||||
light values.
|
||||
default: 2000
|
||||
selector:
|
||||
color_temp: {}
|
||||
include_brightness_over_under:
|
||||
name: Include brightness values when outside range
|
||||
description: I want the automation to set a brightness when the ambient light
|
||||
goes outside of the set range. (Over maximum and under minimum ambient)
|
||||
default: false
|
||||
selector:
|
||||
boolean: {}
|
||||
light_brightness_over_max:
|
||||
name: Brightness when ambient light value over max.
|
||||
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
|
||||
unit_of_measurement: '%'
|
||||
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
|
||||
set minimum value.
|
||||
default: 100
|
||||
selector:
|
||||
number:
|
||||
min: 0.0
|
||||
max: 100.0
|
||||
step: 1.0
|
||||
mode: slider
|
||||
unit_of_measurement: '%'
|
||||
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
|
||||
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
|
||||
multiple: false
|
||||
sort: false
|
||||
custom_value: 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
|
||||
maximum value.
|
||||
selector:
|
||||
color_rgb: {}
|
||||
default:
|
||||
- 255
|
||||
- 255
|
||||
- 255
|
||||
light_color_under_min:
|
||||
name: Color when ambient light value under min.
|
||||
description: Color of the light when the ambient light is lower than the set
|
||||
minimum value.
|
||||
selector:
|
||||
color_rgb: {}
|
||||
default:
|
||||
- 255
|
||||
- 255
|
||||
- 255
|
||||
light_temp_over_max:
|
||||
name: Temperature when ambient light value over max.
|
||||
description: Temperature of the light when the ambient light is higher than
|
||||
the set maximum value.
|
||||
default: 2000
|
||||
selector:
|
||||
color_temp: {}
|
||||
light_temp_under_min:
|
||||
name: Temperature when ambient light value under min.
|
||||
description: Temperature of the light when the ambient light is lower than the
|
||||
set minimum value.
|
||||
default: 2000
|
||||
selector:
|
||||
color_temp: {}
|
||||
mode: single
|
||||
variables:
|
||||
include_color_or_temp: !input include_color_or_temp
|
||||
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
|
||||
slope: '{{ ( light1 - light2 ) / ( maxB - minB ) }}'
|
||||
constant: '{{ light1 - ( slope * maxB ) }}'
|
||||
trigger:
|
||||
platform: state
|
||||
entity_id: !input light_sensor_entity
|
||||
condition:
|
||||
- condition: !input run_conditions
|
||||
action:
|
||||
- choose:
|
||||
- conditions:
|
||||
- condition: template
|
||||
value_template: '{{ include_brightness_over_under is false }}'
|
||||
sequence:
|
||||
- choose:
|
||||
- conditions:
|
||||
- condition: template
|
||||
value_template: '{{ include_color_or_temp == "include_no_color_temp" }}'
|
||||
sequence:
|
||||
- service: light.turn_on
|
||||
data:
|
||||
transition: !input transition_time
|
||||
brightness_pct: '{{ (( 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
|
||||
data:
|
||||
transition: !input transition_time
|
||||
brightness_pct: '{{ (( slope * states(light_sensor)|int ) + constant)|round
|
||||
}}'
|
||||
rgb_color: !input light_color
|
||||
target: !input target_light
|
||||
- conditions:
|
||||
- condition: template
|
||||
value_template: '{{ include_color_or_temp == "include_temp" }}'
|
||||
sequence:
|
||||
- service: light.turn_on
|
||||
data:
|
||||
transition: !input transition_time
|
||||
brightness_pct: '{{ (( slope * states(light_sensor)|int ) + constant)|round
|
||||
}}'
|
||||
color_temp: !input light_temp
|
||||
target: !input target_light
|
||||
- conditions:
|
||||
- condition: template
|
||||
value_template: '{{ include_brightness_over_under is true }}'
|
||||
sequence:
|
||||
- choose:
|
||||
- conditions:
|
||||
- condition: template
|
||||
value_template: '{{ include_color_or_temp_over_under == "include_no_color_temp_outside_range"
|
||||
}}'
|
||||
sequence:
|
||||
- choose:
|
||||
- conditions:
|
||||
- condition: numeric_state
|
||||
entity_id: !input light_sensor_entity
|
||||
above: !input max_brightness_value
|
||||
sequence:
|
||||
- service: light.turn_on
|
||||
data:
|
||||
transition: !input transition_time
|
||||
brightness_pct: !input light_brightness_over_max
|
||||
target: !input target_light
|
||||
- conditions:
|
||||
- condition: numeric_state
|
||||
entity_id: !input light_sensor_entity
|
||||
below: !input min_brightness_value
|
||||
sequence:
|
||||
- service: light.turn_on
|
||||
data:
|
||||
transition: !input transition_time
|
||||
brightness_pct: !input light_brightness_under_min
|
||||
target: !input target_light
|
||||
- conditions:
|
||||
- condition: numeric_state
|
||||
entity_id: !input light_sensor_entity
|
||||
below: !input max_brightness_value
|
||||
above: !input min_brightness_value
|
||||
sequence:
|
||||
- service: light.turn_on
|
||||
data:
|
||||
transition: !input transition_time
|
||||
brightness_pct: '{{ (( slope * states(light_sensor)|int ) + constant)|round
|
||||
}}'
|
||||
target: !input target_light
|
||||
- conditions:
|
||||
- condition: template
|
||||
value_template: '{{ include_color_or_temp_over_under == "include_color_outside_range"
|
||||
}}'
|
||||
sequence:
|
||||
- choose:
|
||||
- conditions:
|
||||
- condition: numeric_state
|
||||
entity_id: !input light_sensor_entity
|
||||
above: !input max_brightness_value
|
||||
sequence:
|
||||
- service: light.turn_on
|
||||
data:
|
||||
transition: !input transition_time
|
||||
brightness_pct: !input light_brightness_over_max
|
||||
rgb_color: !input light_color_over_max
|
||||
target: !input target_light
|
||||
- conditions:
|
||||
- condition: numeric_state
|
||||
entity_id: !input light_sensor_entity
|
||||
below: !input min_brightness_value
|
||||
sequence:
|
||||
- service: light.turn_on
|
||||
data:
|
||||
transition: !input transition_time
|
||||
brightness_pct: !input light_brightness_under_min
|
||||
rgb_color: !input light_color_under_min
|
||||
target: !input target_light
|
||||
- conditions:
|
||||
- condition: numeric_state
|
||||
entity_id: !input light_sensor_entity
|
||||
below: !input max_brightness_value
|
||||
above: !input min_brightness_value
|
||||
sequence:
|
||||
- service: light.turn_on
|
||||
data:
|
||||
transition: !input transition_time
|
||||
brightness_pct: '{{ (( slope * states(light_sensor)|int ) + constant)|round
|
||||
}}'
|
||||
rgb_color: !input light_color
|
||||
target: !input target_light
|
||||
- conditions:
|
||||
- condition: template
|
||||
value_template: '{{ include_color_or_temp_over_under == "include_temp_outside_range"
|
||||
}}'
|
||||
sequence:
|
||||
- choose:
|
||||
- conditions:
|
||||
- condition: numeric_state
|
||||
entity_id: !input light_sensor_entity
|
||||
above: !input max_brightness_value
|
||||
sequence:
|
||||
- service: light.turn_on
|
||||
data:
|
||||
transition: !input transition_time
|
||||
brightness_pct: !input light_brightness_over_max
|
||||
color_temp: !input light_temp_over_max
|
||||
target: !input target_light
|
||||
- conditions:
|
||||
- condition: numeric_state
|
||||
entity_id: !input light_sensor_entity
|
||||
below: !input min_brightness_value
|
||||
sequence:
|
||||
- service: light.turn_on
|
||||
data:
|
||||
transition: !input transition_time
|
||||
brightness_pct: !input light_brightness_under_min
|
||||
color_temp: !input light_temp_under_min
|
||||
target: !input target_light
|
||||
- conditions:
|
||||
- condition: numeric_state
|
||||
entity_id: !input light_sensor_entity
|
||||
below: !input max_brightness_value
|
||||
above: !input min_brightness_value
|
||||
sequence:
|
||||
- service: light.turn_on
|
||||
data:
|
||||
transition: !input transition_time
|
||||
brightness_pct: '{{ (( slope * states(light_sensor)|int ) + constant)|round
|
||||
}}'
|
||||
color_temp: !input light_temp
|
||||
target: !input target_light
|
119
blueprints/automation/Twanne/smart_lux_dimmer_basic.yaml
Normal file
119
blueprints/automation/Twanne/smart_lux_dimmer_basic.yaml
Normal file
@ -0,0 +1,119 @@
|
||||
blueprint:
|
||||
name: Smart Lux Dimmer (BASIC)
|
||||
description: 'Version 2.0
|
||||
|
||||
Dim or turn off light based on the value of a light sensor
|
||||
|
||||
'
|
||||
source_url: https://gist.github.com/Twanne/b942a7885e5a062dc9b6acfe9d6fe3db
|
||||
domain: automation
|
||||
input:
|
||||
schedule_start:
|
||||
name: Schedule start time
|
||||
description: Automation only runs after this time.
|
||||
selector:
|
||||
time: {}
|
||||
schedule_stop:
|
||||
name: Schedule stop time
|
||||
description: Automation does not run after this time.
|
||||
selector:
|
||||
time: {}
|
||||
schedule_days:
|
||||
name: Run on these days
|
||||
description: 'Days on which the automation will run.
|
||||
|
||||
Write days in short form, seperated by punctuation marks and/or spaces.
|
||||
|
||||
(i.e.: mon, tue, wed,...)
|
||||
|
||||
'
|
||||
selector:
|
||||
text: {}
|
||||
light_sensor_entity:
|
||||
name: Light Sensor
|
||||
selector:
|
||||
entity:
|
||||
domain:
|
||||
- sensor
|
||||
device_class:
|
||||
- illuminance
|
||||
multiple: false
|
||||
max_brightness_value:
|
||||
name: Maximum ambient light value
|
||||
description: Light is turned off above 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
|
||||
description: The light does not change brightness further under 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: Dimming value 1
|
||||
description: Brightness of the light at maximum ambient light.
|
||||
default: 0
|
||||
selector:
|
||||
number:
|
||||
min: 0.0
|
||||
max: 100.0
|
||||
step: 1.0
|
||||
mode: slider
|
||||
unit_of_measurement: '%'
|
||||
light_value_2:
|
||||
name: Dimming value 2
|
||||
description: Brightness of the light at minimum ambient light.
|
||||
default: 100
|
||||
selector:
|
||||
number:
|
||||
min: 0.0
|
||||
max: 100.0
|
||||
step: 1.0
|
||||
mode: slider
|
||||
unit_of_measurement: '%'
|
||||
target_light:
|
||||
name: Target lights
|
||||
selector:
|
||||
target:
|
||||
entity:
|
||||
- domain:
|
||||
- light
|
||||
mode: single
|
||||
variables:
|
||||
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
|
||||
slope: '{{ ( light1 - light2 ) / ( maxB - minB ) }}'
|
||||
constant: '{{ light1 - ( slope * maxB ) }}'
|
||||
days: !input schedule_days
|
||||
trigger:
|
||||
platform: state
|
||||
entity_id: !input light_sensor_entity
|
||||
condition:
|
||||
- condition: numeric_state
|
||||
entity_id: !input light_sensor_entity
|
||||
above: !input min_brightness_value
|
||||
- condition: time
|
||||
after: !input schedule_start
|
||||
before: !input schedule_stop
|
||||
- condition: template
|
||||
value_template: '{{ now().strftime(''%a'') | lower in days }}'
|
||||
action:
|
||||
- service: light.turn_on
|
||||
data:
|
||||
brightness_pct: "{% if states(light_sensor)|int > maxB %}\n 0\n{% else %}\n {{
|
||||
(( slope * states(light_sensor)|int ) + constant)|round }}\n{% endif %}\n"
|
||||
target: !input target_light
|
430
blueprints/automation/Twanne/the_everything_light.yaml
Normal file
430
blueprints/automation/Twanne/the_everything_light.yaml
Normal file
@ -0,0 +1,430 @@
|
||||
blueprint:
|
||||
name: The Everything Light
|
||||
author: AntonH
|
||||
description: "**Version 2.5**\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
|
||||
value: toggle
|
||||
- label: FIXED MODE
|
||||
value: fixed
|
||||
- label: DYNAMIC MODE
|
||||
value: dynamic
|
||||
multiple: false
|
||||
sort: false
|
||||
custom_value: 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
|
||||
multiple: false
|
||||
sort: false
|
||||
custom_value: 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.
|
||||
default: 2000
|
||||
selector:
|
||||
color_temp: {}
|
||||
brightness:
|
||||
name: Brightness (FIXED BRIGHTNESS MODE)
|
||||
description: Set the brightness value the light needs to turn on at
|
||||
default: 0
|
||||
selector:
|
||||
number:
|
||||
min: 0.0
|
||||
max: 100.0
|
||||
step: 1.0
|
||||
mode: slider
|
||||
unit_of_measurement: '%'
|
||||
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
|
||||
unit_of_measurement: '%'
|
||||
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
|
||||
unit_of_measurement: '%'
|
||||
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
|
||||
unit_of_measurement: '%'
|
||||
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: 100
|
||||
selector:
|
||||
number:
|
||||
min: 0.0
|
||||
max: 100.0
|
||||
step: 1.0
|
||||
mode: slider
|
||||
unit_of_measurement: '%'
|
||||
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
|
||||
multiple: false
|
||||
sort: false
|
||||
custom_value: 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.
|
||||
default: 2000
|
||||
selector:
|
||||
color_temp: {}
|
||||
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.
|
||||
default: 2000
|
||||
selector:
|
||||
color_temp: {}
|
||||
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
|
||||
sort: false
|
||||
custom_value: 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
|
||||
light_brightness: !input brightness
|
||||
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
|
||||
slope: '{{ ( light1 - light2 ) / ( maxB - minB ) }}'
|
||||
constant: '{{ light1 - ( slope * maxB ) }}'
|
||||
dynamic_brightness_pct: "{% 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
|
||||
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
|
||||
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
|
||||
condition:
|
||||
- condition: !input run_conditions
|
||||
action:
|
||||
- choose:
|
||||
- conditions: '{{ mode == "toggle" }}'
|
||||
sequence:
|
||||
- service: homeassistant.toggle
|
||||
target: !input target_light
|
||||
- conditions: '{{ mode == "default" }}'
|
||||
sequence:
|
||||
- service: homeassistant.turn_on
|
||||
target: !input target_light
|
||||
- conditions: '{{ mode == "fixed" }}'
|
||||
sequence:
|
||||
- service: light.turn_on
|
||||
data: "{% if include_color_or_temp == \"include_color\" %}\n {{ { \"transition\":
|
||||
transition_time, \"brightness_pct\": light_brightness, \"rgb_color\": light_color
|
||||
} }}\n{% elif include_color_or_temp == \"include_temperature\" %}\n {{ {
|
||||
\"transition\": transition_time, \"brightness_pct\": light_brightness, \"color_temp\":
|
||||
light_temperature } }}\n{% else %}\n {{ { \"transition\": transition_time,
|
||||
\"brightness_pct\": light_brightness } }}\n{% endif %}\n"
|
||||
target: !input target_light
|
||||
- conditions: '{{ mode == "dynamic" }}'
|
||||
sequence:
|
||||
- service: 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_pct\": light_brightness_over_max, \"rgb_color\": light_color_over_max
|
||||
} }}\n {% elif include_color_or_temp_over_under == \"include_temp_outside_range\"
|
||||
%}\n {{ { \"transition\": transition_time, \"brightness_pct\": light_brightness_over_max,
|
||||
\"color_temp\": light_temp_over_max } }}\n {% else %}\n {{ { \"transition\":
|
||||
transition_time, \"brightness_pct\": light_brightness_over_max } }}\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_pct\": light_brightness_under_min, \"rgb_color\": light_color_under_min
|
||||
} }}\n {% elif include_color_or_temp_over_under == \"include_temp_outside_range\"
|
||||
%}\n {{ { \"transition\": transition_time, \"brightness_pct\": light_brightness_under_min,
|
||||
\"color_temp\": light_temp_under_min } }}\n {% else %}\n {{ { \"transition\":
|
||||
transition_time, \"brightness_pct\": light_brightness_under_min } }}\n {%
|
||||
endif %}\n{% else %}\n {% if include_color_or_temp == \"include_color\" %}\n
|
||||
\ {{ { \"transition\": transition_time, \"brightness_pct\": light_brightness,
|
||||
\"rgb_color\": light_color } }}\n {% elif include_color_or_temp == \"include_temperature\"
|
||||
%}\n {{ { \"transition\": transition_time, \"brightness_pct\": dynamic_brightness_pct,
|
||||
\"color_temp\": light_temperature } }}\n {% else %}\n {{ { \"transition\":
|
||||
transition_time, \"brightness_pct\": dynamic_brightness_pct } }}\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
|
||||
- service: 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
|
||||
- service: homeassistant.turn_off
|
||||
target: !input target_light
|
Reference in New Issue
Block a user