Files
ha_cercadian_alarm/parabolic_alarm.yaml
2025-04-16 14:10:42 -05:00

238 lines
6.9 KiB
YAML

blueprint:
name: Parabolic Alarm Automation
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
input:
alarm_start_time:
name: 🕒 Start Time
description:
Datetime helper or sensor for the alarm to start. Use time only and Workday sensor
to determine what days to run.
selector:
entity:
filter:
- domain:
- input_datetime
- domain: sensor
device_class: timestamp
multiple: false
complete_at_start_time:
name: 🏁 Finish at Start Time
description:
Complete the transitions by the time given in the Start Time as opposed to starting at the Start Time.
selector:
boolean:
workday_sensor:
name: 📆 Workday Sensor
description:
Binary Sensor that is used to determine whether it should run. Typically
from Workday Integration. More information here - https://www.home-assistant.io/integrations/workday/
selector:
entity:
filter:
- domain:
- binary_sensor
multiple: false
person_sensor:
name: 👤 Person Sensor
description: Select the person sensor so that the alarm will only run when you are home.
selector:
entity:
filter:
- domain:
- person
multiple: true
alarm_script:
name: 📄 Script to trigger
description: Light Alarm Script
selector:
entity:
filter:
- domain:
- script
multiple: false
target_light:
name: 💡 Lights
description: The light(s) with kelvin
selector:
entity:
filter:
- domain:
- light
multiple: false
light_timeout:
name: ⏱️ Timeout
description: Light will turn off after this time on last run. Setting this to 0 will leave the light on.
default: 10
selector:
number:
min: 0.0
max: 60.0
step: 1.0
mode: slider
steps_per_minute:
name: 🏃‍♂️ Steps per minute for all runs
description:
Used for configuring percentage of each step for brightness and
color temperature
default: 12
selector:
number:
min: 1.0
max: 60.0
step: 1.0
mode: slider
start_kelvin_temp:
description: Start Kelvin value (warm) for 1st run
selector:
color_temp:
unit: kelvin
default: 2500
name: ☀️ Starting Kelvin
target_kelvin_1:
description: Target Kelvin value (cold) for the end of the first run
selector:
color_temp:
unit: kelvin
default: 3000
name: ☀️ Target Kelvin 1
max_brightness_1:
name: ⭐️ Maximum Brightness 1
description: Finish value for first run
selector:
number:
min: 1.0
max: 100.0
step: 1.0
mode: slider
default: 10
alarm_length_1:
name: ⏰ Alarm Length 1
description: This is the start to finish time for the first run
selector:
number:
min: 1.0
max: 60.0
step: 1.0
mode: slider
default: 10
target_kelvin_2:
description: Target Kelvin value (cold) for second run
selector:
color_temp:
unit: kelvin
default: 4000
name: 🌗 Target Kelvin 2
max_brightness_2:
name: ⭐️ Maximum Brightness 2
description: Finish value for second run
selector:
number:
min: 1.0
max: 100.0
step: 1.0
mode: slider
default: 50
alarm_length_2:
name: ⏰ Alarm length 2
description: This is the start to finish time for the second run
selector:
number:
min: 1.0
max: 60.0
step: 1.0
mode: slider
default: 10
target_kelvin_3:
description: Target Kelvin value (cold) for third run
selector:
color_temp:
unit: kelvin
default: 6500
name: 🌑 Target Kelvin 3
max_brightness_3:
name: ⭐️ Maximum Brightness 3
description: Finish value for third and final run
selector:
number:
min: 1.0
max: 100.0
step: 1.0
mode: slider
default: 100
alarm_length_3:
name: ⏰ Alarm Length 3
description: This is the start to finish time for the third run
selector:
number:
min: 1.0
max: 60.0
step: 1.0
mode: slider
default: 5
source_url: https://github.com/steku/ha_cercadian_alarm/blob/main/parabolic_alarm.yaml
trigger_variables:
input_alarm_entity: !input alarm_start_time
input_alarm_length_1: !input alarm_length_1
input_alarm_length_2: !input alarm_length_2
input_alarm_length_3: !input alarm_length_3
input_complete_at_start_time: !input complete_at_start_time
calculated_runtime: "{{ -(input_alarm_length_1 + input_alarm_length_2 + input_alarm_length_3)*60 if input_complete_at_start_time else 0 }}"
trigger:
- trigger: time
at: >-
{{ { "entity_id": input_alarm_entity, "offset": calculated_runtime } }}
condition:
- condition: state
entity_id: !input workday_sensor
state: "on"
- condition: state
entity_id: !input person_sensor
state: "home"
action:
- action: light.turn_on
data:
color_temp_kelvin: !input start_kelvin_temp
brightness_pct: 1
entity_id: !input target_light
- delay:
seconds: 5
- action: !input alarm_script
data:
target_kelvin: !input target_kelvin_1
start_kelvin: !input start_kelvin_temp
max_brightness_pct: !input max_brightness_1
alarm_length: !input alarm_length_1
steps_per_minute: !input steps_per_minute
light_timeout: 0
target_light: !input target_light
- if:
- condition: state
state: "on"
entity_id: !input target_light
then:
- action: !input alarm_script
data:
target_kelvin: !input target_kelvin_2
start_kelvin: !input target_kelvin_1
max_brightness_pct: !input max_brightness_2
alarm_length: !input alarm_length_2
steps_per_minute: !input steps_per_minute
light_timeout: 0
target_light: !input target_light
- if:
- condition: state
state: "on"
entity_id: !input target_light
then:
- action: !input alarm_script
data:
target_kelvin: !input target_kelvin_3
start_kelvin: !input target_kelvin_2
max_brightness_pct: !input max_brightness_3
alarm_length: !input alarm_length_3
steps_per_minute: !input steps_per_minute
light_timeout: !input light_timeout
target_light: !input target_light
mode: single