Add minimum brightness and pre-post actions (#9)

* Add  pre-post actions
  * post will only be executed if light is not turned off to disable the automation
* Add minimum starting brightness for light
* Make Workday sensor optional by using multiple
This commit is contained in:
Stephen Kuntz
2025-04-22 10:15:33 -04:00
committed by GitHub
parent 1ba56d49fc
commit 7bb03ddf05

View File

@ -3,6 +3,12 @@ blueprint:
description: Turn a light on based on a start time, whether it is a workday and whether a person is home. This is to match the sunrise and allow for a natural wake up. description: Turn a light on based on a start time, whether it is a workday and whether a person is home. This is to match the sunrise and allow for a natural wake up.
domain: automation domain: automation
input: input:
pre_action:
name: 🎮 Pre Script Action
description: An action you want to perform before the lights turn on.
default: []
selector:
action: {}
alarm_start_time: alarm_start_time:
name: 🕒 Start Time name: 🕒 Start Time
description: description:
@ -18,8 +24,7 @@ blueprint:
multiple: false multiple: false
offset_from_start_time: offset_from_start_time:
name: 🏁 Offset From Start Time name: 🏁 Offset From Start Time
description: description: Adjust the amount of time before or after the set Start Time value to start the transition. Enter seconds or HH:MM:SS format (e.g. "-00:05:00" to start 5 minutes before the Start Time. Useful if the start time comes from an alarm entity and you want to adjust where in the brightness cycle you are when the alarm goes off. See https://www.home-assistant.io/docs/automation/trigger/#sensors-of-datetime-device-class-with-offsets for caution about using positive offsets.
Adjust the amount of time before or after the set Start Time value to start the transition. Enter seconds or HH:MM:SS format (e.g. "-00:05:00" to start 5 minutes before the Start Time. Useful if the start time comes from an alarm entity and you want to adjust where in the brightness cycle you are when the alarm goes off. See https://www.home-assistant.io/docs/automation/trigger/#sensors-of-datetime-device-class-with-offsets for caution about using positive offsets.
default: "-00:00:00" default: "-00:00:00"
selector: selector:
text: text:
@ -33,7 +38,7 @@ blueprint:
filter: filter:
- domain: - domain:
- binary_sensor - binary_sensor
multiple: false multiple: true
person_sensor: person_sensor:
name: 👤 Person Sensor name: 👤 Person Sensor
description: Select the person sensor so that the alarm will only run when you are home. description: Select the person sensor so that the alarm will only run when you are home.
@ -83,6 +88,16 @@ blueprint:
max: 60.0 max: 60.0
step: 1.0 step: 1.0
mode: slider mode: slider
start_brightness:
name: ⭐️ Start Brightness
description: Starting value for brightness
selector:
number:
min: 1.0
max: 100.0
step: 1.0
mode: slider
default: 1.0
start_kelvin_temp: start_kelvin_temp:
description: Start Kelvin value (warm) for 1st run description: Start Kelvin value (warm) for 1st run
selector: selector:
@ -171,6 +186,12 @@ blueprint:
step: 1.0 step: 1.0
mode: slider mode: slider
default: 5 default: 5
post_action:
name: 🎮 Post Script Action
description: An action you want to run after the script has finished
default: []
selector:
action: {}
source_url: https://github.com/steku/ha_cercadian_alarm/blob/main/parabolic_alarm.yaml source_url: https://github.com/steku/ha_cercadian_alarm/blob/main/parabolic_alarm.yaml
trigger: trigger:
- trigger: time - trigger: time
@ -185,10 +206,13 @@ condition:
entity_id: !input person_sensor entity_id: !input person_sensor
state: "home" state: "home"
action: action:
- choose:
- conditions: []
sequence: !input pre_action
- action: light.turn_on - action: light.turn_on
data: data:
color_temp_kelvin: !input start_kelvin_temp color_temp_kelvin: !input start_kelvin_temp
brightness_pct: 1 brightness_pct: !input start_brightness
entity_id: !input target_light entity_id: !input target_light
- delay: - delay:
seconds: 5 seconds: 5
@ -229,4 +253,7 @@ action:
steps_per_minute: !input steps_per_minute steps_per_minute: !input steps_per_minute
light_timeout: !input light_timeout light_timeout: !input light_timeout
target_light: !input target_light target_light: !input target_light
- choose:
- conditions: []
sequence: !input post_action
mode: single mode: single