Create datetime helper for the time this is to be triggered.
This is when the lights will start turing on from the lowest setting. You can calculate the finish time by adding the Alarm Length steps and timeout if you desire, but I find that I’m awake before it finishes. I’d suggest you play with this until you find what is right for you.
Import the script blueprint
Create a script from the script blueprint (Only needs to be done once. Can be reused in many automations)
Import the automation blueprint
Create the automation from the automation blueprint and use the script and datetime helper created above in the automation.
You can use a single light or light group to operate many lights you wish to start at the same time.
This can be done many times for many automations if you want to start different lights at different times. You will just need to create a separate datetime helper for each.
Basically it contains 2 components. The first component is a script that is executed 3 times in series to change the rates of the 2 main settings, kelvin and brightness. By running it many times you get get a more parabolic effect. I added this feature because I could visually detect changes in brightness more at lower values when increasing using a linear increase in brightness or calculated parabolic curve.
Below is an example of it in action. You can see the points of which the values change.
The second component is an automation that executes the script 3 times in series with different values for each execution.
Explaination of Script
If the target light or light group is off, all values of the parameters will be used. If the target is already on, its current brightness and kelvin values will be used as the starting values. It has been designed this way so the script can create the more parabolic like curve you can see above.
The script allows for defining how long to take to get from start to finish values and how many steps per minute to take to get there. The script will also turn off the light after the ‘Light Timeout’ period. Setting this value to 0 will disable the timeout.
Explaination of Automation
Execute the script 3 times with the given parameters to get the desired parabolic curve.
In my automation I’m using the Workday Integration and its binary sensor to only execute on days I have configured in that integration. You can create your own templated binary_sensor to set your own conditions on when to execute the automation.
Thanks for this script!
I was using the other popular one but I’m willing to give this one a try since it is supposed to be more optimized.
Yet, I’m still relatively new to Home Assistant and I really don’t understand anything yaml based.
Basically, instead of a fixed hour, I would like to use alarms set in my Google Home device I integrated in HA. That device’s next alarm is shown in entity: sensor.lenovo_smart_clock_alarms
So, as the trigger, I would like it to be : sensor.lenovo_smart_clock_alarms - alarm_length variable
I searched forums and tried what is below but it does not work.
My lights aren’t reporting the color_temp - it’s null, so it hits an error. Does anyone have a brilliant idea for converting the value to HS in-line like this? I have RGB, HS, and xy color. No kelvin or mired.
Maybe I should just buy the hue hub… I’ve spent the whole weekend trying to get a solution that works; the complicated blueprint referenced only checks for one variable for conditions and spams the logs, I can’t stand it.
They also don’t support transition, which is the easy way to do all this.
I’ve create a blueprint for this automation. The script in the first post will still need to be copied to your instance manually first, then specified when you create the automation from the blueprint below.
The blueprint is basically the same as the automation in the first post but configured via automation GUI.
It assumes you’re using the Workday Integration to determine whether it will be triggered on a particular day. You could use any binary_sensor to replace the Workday binary_sensor if you do not wish to use the Workday Integration.
You’ll also need an input_datetime helper to use to trigger the start time. Create one with time only.
blueprint:
name: Parabolic Alarm Automation
description: Turn a light on based on detected motion
domain: automation
input:
alarm_start_time:
name: Start Time
description: Datetime helper for alarm to start. Use time only and Workday sensor to determine what days to run.
selector:
entity:
filter:
- domain: input_datetime
workday_sensor:
name: Workday Sensor
description: Binary Sensor for determining it it should run. Typically from Workday Integratoin
selector:
entity:
filter:
- domain: binary_sensor
alarm_script:
name: Script to trigger
description: Script to trigger
selector:
entity:
filter:
- domain: script
target_light:
name: Lights
description: The light(s) with Mireds
selector:
entity:
filter:
- domain: light
light_timeout:
name: Timeout
description: Light will turn off after this time on last run
default: 10
selector:
number:
min: 1
max: 60
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
max: 60
min_mireds_1:
description: Minimum mireds value (coldest) for 1st run
selector:
color_temp:
default: 375
name: Min Mireds 1
max_mireds_1:
description: >-
Maximum mireds value (warmest) for 1st run
selector:
color_temp:
default: 400
name: Max Mireds 1
max_brightness_1:
name: Maximum Brightness 1
selector:
number:
min: 1
max: 100
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
max: 60
default: 10
min_mireds_2:
description: Minimum mireds value (coldest) for 1st run
selector:
color_temp:
default: 300
name: Min Mireds 1
max_mireds_2:
description: >-
Maximum mireds value (warmest) for 1st run
selector:
color_temp:
default: 400
name: Max Mireds 1
max_brightness_2:
name: Maximum Brightness 1
selector:
number:
min: 1
max: 100
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
max: 60
default: 10
min_mireds_3:
description: Minimum mireds value (coldest) for 1st run
selector:
color_temp:
default: 160
name: Min Mireds 1
max_mireds_3:
description: >-
Maximum mireds value (warmest) for 1st run
selector:
color_temp:
default: 400
name: Max Mireds 1
max_brightness_3:
name: Maximum Brightness 1
selector:
number:
min: 1
max: 100
default: 100
alarm_length_3:
name: Alarm Lenght 3
description: >-
This is the start to finish time for the third run
selector:
number:
min: 1
max: 60
default: 5
trigger:
- platform: time
at: !input alarm_start_time
condition:
- condition: state
entity_id: !input workday_sensor
state: "on"
action:
- service: !input alarm_script
data:
min_mireds: !input min_mireds_1
max_mireds_selector: !input max_mireds_1
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:
- service: !input alarm_script
data:
min_mireds: !input min_mireds_2
max_mireds_selector: !input max_mireds_2
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:
- service: !input alarm_script
data:
min_mireds: !input min_mireds_3
max_mireds_selector: !input max_mireds_3
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: parallel
max: 10
First post here and I don’t really have the cred to post a video but I don’t think this is behaving as intended and whilst a video would be the best way to demonstrate this I’ll pate what I put into Claude to see if it could help but it couldn’t really.
The light flicks on and pretty quickly (i.e. within a second or 2) transitions / gets to a high brightness then resets to a low brightness and transitions / gets up to some other target brightness and then resets to dimmer yet then transitions / gets up to some other brightness that was different to before and then just loops like this continuously in this triad of low to max with different lows and different maxes.
Not sure what I did wrong but I was hoping for a gradual slope from 0% up to my target brightness over the course of several minutes not < 5 seconds. Would love to know what I’ve done wrong. For reference, I’m using an Ikea zigbee RGB light
Any change you can modify that to gather the “next alarm” info from a sensor?
I don’t always wake up at the same time so I just set my Alexa every night. I know it shares this information with HA so it’s possible to do so, I just don’t have the technical skill to do it.
What blueprint are you referring to? The original one that inspired your work or your own blueprint?
I’m in same position than @Dumonster, as I would like that the alarm time (and thus also day) is whatever is set in Google Assistant and that is read by Home Assistant with Google Home integration.
So for some reason this stopped working between when I disabled the automation created by the blueprint at the end of the school year and now. I’ve used the opportunity to refactor both the blueprint and the script so if upgrading you will need to update the script as well.
I’ve switch to using Kelvin as the color temperature and removed some redundant inputs.
Both the script and the blueprint can be found in the github repo.
Thanks for the perfect timing, I’ve been wanting to try this for a while and finally made time for it today. I’ve followed your instructions and will hopefully wake up to the ‘sunrise’ tomorrow with my first ever HA automation.
Thanks for giving us an alternative to the well known and highly used “Wake-up light alarm with sunrise effect”. I’ve had some issues with that blueprint and decided to use yours. So far so good ! This morning it worked like a charm.
This seems to be getting some attention so I updated it to make installation easier. Both the script and automation are now blueprints. See the original post for details.
I didn’t consider multiple lights as an input. However, you can probably create a light group and use that in the script/automation to control multiple lights.