Wake-up light alarm with sunrise effect

Great blueprint, use it three times for myself and my kids!

I was wondering if it is possible to make an action where the ‘sunrise-program’ stops. For example: When i get up in the morning during the sunrise routine and I turn off the light after leaving the room, the sunrise routine continues, turning the light back on.

Any suggestions on how to fix this?
Thanks in advance!

Did you solve this yet?
I am thinking of something like “if alarm time minus now is smaller then X hours, then don’t trigger”
I don’t have the scripting skills to bring this into the BP :confused:

Hi, no I did not get this running yet, my scripting skills are not enough for this. So I dit try the following:

alias: turn off automation wake-up light
description: ""
trigger:
  - device_id: XXX
    domain: hue
    platform: device
    type: initial_press
    subtype: 1
    unique_id: XXX
condition:
  - condition: state
    entity_id: automation.wake_up_light_07_00_automatisering
    attribute: last_triggered
    for:
      hours: 0
      minutes: 0
      seconds: 0
    state: ""
action: []
mode: single
action:
  - service: automation.turn_off
    data:
      stop_actions: true
    target:
      entity_id: automation.wake_up_light_07_00_automatisering
mode: single

trigger: pressing a button which also turns off the lights.
Condition: The solution could be to test in the state of last_triggered if the automation was triggerd in the last 30 minutes. But it needs to be compared to this type of state: “2023-12-13T10:24:00.245985+00:00” and that is beyond my skill.
And an action would be to turn off the automation. wait for 60 minutes or so and turn the automation on again.

It’s a bit of a workaround, would be great if a ‘kill-automation’ method was included in the blueprint =D

This blueprint seems very cool! We use Google hubs as alarm clocks - we usually set the alarm by voice control. With the Google home integration, I can see that an alarm has been set and the time. Is it possible to have this automation use that alarm time as the baseline for the sunrise effect?

Actually I just asked Bard to write an automation to do this. Here’s what it came back with:

Home Assistant Automation for Gentle Wake-Up Light

Here’s an automation in Home Assistant that slowly turns on a light before a Google Hub alarm goes off, simulating a sunrise effect:

Trigger:

  • Platform: template
  • Value template: “{{ (as_timestamp(now()) > (as_timestamp(states(‘sensor.woonkamer_mini_alarms’)[0].attributes.alarm_time) - timedelta(minutes=15))) }}”

Conditions:

  • Platform: state
  • Entity: sensor.woonkamer_mini_alarms
  • Attribute: alarm_time
  • State: not None

Action:

  • Platform: light
  • Entity: light.bedroom_ceiling_light
  • Service: light.turn_on
  • Brightness: {{ 0.1 * (((as_timestamp(states('sensor.woonkamer_mini_alarms')[0].attributes.alarm_time) - timedelta(minutes=15)) - as_timestamp(now())) / timedelta(minutes=15)) }}
  • Transition: linear
  • Duration: timedelta(minutes=15)

Explanation:

  • The trigger uses a template that checks if the current time is 15 minutes before the alarm time set on the Google Hub alarm sensor (sensor.woonkamer_mini_alarms) (replace this with your sensor entity name).
  • The condition ensures the alarm time is available in the sensor.
  • The action turns on the light.bedroom_ceiling_light (replace this with your light entity name) with a brightness that ramps up from 0% to 100% over 15 minutes using a linear transition.
  • The brightness calculation uses the remaining time before the alarm goes off to proportionally increase the light intensity.

Customization:

  • Adjust the trigger time (15 minutes) to change the start time of the light fade-in.
  • Modify the brightness curve by changing the constant in the brightness calculation.
  • Replace the entity names with your actual sensor and light entity names.
  • You can add additional actions to the automation, such as playing specific sounds or changing the temperature.

Note: This automation requires integrating your Google Hub with Home Assistant using the Google Home integration.

I hope this helps you create a gentle wake-up experience using Home Assistant!

And in yaml:


automation:
  trigger:
    platform: template
    value_template: "{{ (as_timestamp(now()) > (as_timestamp(states('sensor.woonkamer_mini_alarms')[0].attributes.alarm_time) - timedelta(minutes=15))) }}"
  conditions:
    - platform: state
      entity: sensor.woonkamer_mini_alarms
      attribute: alarm_time
      state: not None
  action:
    - service: light.turn_on
      entity: light.bedroom_ceiling_light
      data:
        brightness: "{{ 0.1 * (((as_timestamp(states('sensor.woonkamer_mini_alarms')[0].attributes.alarm_time) - timedelta(minutes=15)) - as_timestamp(now())) / timedelta(minutes=15)) }}"
        transition: linear
        duration: timedelta(minutes=15)

Hello everyone, I’ve searched high and low, but I haven’t managed to do it yet… I want to use the Timestamp Sensor of this automation, the one I created earlier to synchronize the alarm time from iOS with this (Sync iOS 17 Sleep Alarm to HA). However, with that approach, I create a ‘datetime’ helper with date and time… Has anyone had the same issue and can help me?

I did not. I would like to suggest one change to the logic: “if alarm time minus ‘time when alarm is recorded’ is smaller then X hours, then don’t trigger”.

Other options:

  • do not run the automation more than once a day;
  • run it only when alarm is within a determined time range.

Other ideas or considerations?

I cannot get this to work with a helper thats only time. Only date and time will trigger it correctly but i’d like to have it trigger everyday at the same time. Change the helper to date and time it triggers flawlessly, only time and it does nothing. Nothing in logfiles.

Configuration.yaml:

Loads default set of integrations. Do not remove.

default_config:

Load frontend themes from the themes folder

frontend:
themes: !include_dir_merge_named themes

homeassistant:
time_zone: “Europe/Amsterdam”

automation: !include automations.yaml
script: !include scripts.yaml
scene: !include scenes.yaml
helper: !include helpers.yaml

virtual:
fan:

  • platform: virtual
    name: Office Fan
    speed: True
    speed_count: 5
    direction: True
    oscillate:

sensor:

  • platform: time_date
    display_options:
    • ‘time’
    • ‘date’
    • ‘date_time’
    • ‘date_time_utc’
    • ‘date_time_iso’
    • ‘time_date’
    • ‘time_utc’
    • ‘beat’

Same here. Doesn’t work for me. I enabled the required sensors, but the manual time or manual execution does not work.

@Sbyx can you check if you can fix the blueprint to work again? You would make me and many others really happy :slight_smile:

Hi,

Would be nice to add RGB colors for more natural “morning” light - starts from some red colors, then smoothly changes to ~“4000K” color. This is how wake up light works in most of separate devices like Philips Wake-Up light.
I have IKEA bulb, using only temperature color makes light quite unnatural, finishes with too white…

2 Likes

I got frustrated with this not working for me and how difficult it was to troubleshoot so I created my own, simpler, not as full featured, and not as easy to set up version that has worked pretty well for me for the past month or so.

1 Like

I have this set up with a WLED controled system and everytime it just goes to the last preset I used not the sunrise or slowly light up action. I have made sure that the load at boot is not set and the preset is not set to the default.

thanks, exactly what I was looking for!

Weirdly enough I have Ikea GU10 white range bulbs and they stay on the very warm side.
I have set them to start at 2200 kelvin but at the end when alarm rings the bulbs are only at around 2700 kelvin. I want them to reach their coldest temperature of 4000 kelvin but there is no setting for max temperature and I don’t understand why they stop at 2700 kelvin.

Update: I use Adaptive Lighting. I had previously set to run the service Adaptive Lighting manual control in pre-run, yet as mentioned it was not working correctly.
Now, in the settings of running that service, not only I have set in ‘entity_id’ field the Adaptive Lighting switch that controls my Zigbee light group, but now I also listed every single light of that group in the second optional ‘lights’ field of the service and now it seems to work.

Did you get it working? It works for me very well.

Yesterday i updated home assistent and it tolld me to delete some valeu from the time sensor and now this is not working annymore.

How to solve this?

Hi there,
I am new to home assistant. Found your blueprint and tried it. It looks very promising but I am experiencing the following reproducable glitch: Everything works as expected when I set sunrise duration to 5min (Minimum Brightness=10). But when I set sunrise duration to 10min or above then the light will initially turn on dimmed and warm as expected but after a few seconds it will increase brightness to maximum and cold white. I tested it both with a phillips hue color ambiance and Ikea tradfri color LED, same behaviour. Maybe it’s because they are both RGB bulbs? I am unable to help with the code but glad to test everything.

Hi
Noticed errors in automation:
2024-03-05 10:17:00.105 ERROR (MainThread) [homeassistant.components.automation.aufwachen_szene] Error while executing automation automation.aufwachen_szene: In ‘template’ condition: ValueError: Template error: as_timestamp got invalid input ‘unknown 06:30:00’ when rendering template ‘{{0 < as_timestamp(states(sensor) if sensor != ‘none’ else states(‘sensor.date’) ~ ’ ’ ~ manual_time) - as_timestamp(states(‘sensor.date_time_iso’)) <= float(seconds) and states(check_entity) in [‘unknown’, ‘on’, ‘home’]}}’ but no default was specified

Looks like as_timestamp needs a default.

Added some defaults an works now.

120c120
<     ~ '' '' ~ manual_time, default=0) - as_timestamp(states(''sensor.date_time_iso''), default=0) <= float(seconds)
---
>     ~ '' '' ~ manual_time) - as_timestamp(states(''sensor.date_time_iso'')) <= float(seconds)
148c148
<       ~ '' '' ~ manual_time, default=0) - as_timestamp(now()) <= float(seconds)}}'
---
>       ~ '' '' ~ manual_time) - as_timestamp(now()) <= float(seconds)}}'
157c157
<           ~ '' '' ~ manual_time, default=0) - as_timestamp(now()) <= float(seconds)}}'
---
>           ~ '' '' ~ manual_time) - as_timestamp(now()) <= float(seconds)}}'
1 Like

how can this blueprint be triggered with an webhook.

I have a webhook activated by my phone when the alarm “name” is fired