Wake-up light alarm with sunrise effect

Thanks for the feedback @Ilja_Leiko You can already select by weekday via the pre-sunrise actions. Just add a wait-action at the top with the following contents:

    pre_sunrise_actions:
      - wait_template: '{{ 1 <= now().isoweekday() <= 5 }}'

Alternatively you can use other conditions like a workday sensor and / or combine with presence etc.
I put some examples and how to set them up via the UI in the original post at the top.

On the Google Home thing it is a bit complicated since you need an external script that feeds authentication tokens into HA so it probably won’t work with just Home Assistant OS. I found a Github Repo describing it here: https://github.com/chvancooten/homeassistant-googletokenretriever

@sidequestboy for some reason it seems your manual time cannot be parsed correctly. Could you please send me the YAML block of your automation based on the blueprint (in UI use the 3 dots menui and choose ‘edit as YAML’ and copy the contents)?

1 Like

Sorry, it’s possible that error was with an older version of your blueprint. Right now I get a different error when setting a manual time. My lights do successfully get set to 1% it seems, but then do not fade. The log shows:

2020-12-18 07:19:07 ERROR (MainThread) [homeassistant.components.automation.new_automation] Wake up lights: Repeat at step 5: Choose at step 2: choice 1: Choose at step 1: choice 1: Error executing script. Invalid data for call_service at pos 1: value must be at most 100 for dictionary value @ data['brightness_pct']
2020-12-18 07:19:07 ERROR (MainThread) [homeassistant.components.automation.new_automation] Wake up lights: Repeat at step 5: Choose at step 2: choice 1: Error executing script. Invalid data for choose at pos 1: value must be at most 100 for dictionary value @ data['brightness_pct']
2020-12-18 07:19:07 ERROR (MainThread) [homeassistant.components.automation.new_automation] Wake up lights: Repeat at step 5: Error executing script. Invalid data for choose at pos 2: value must be at most 100 for dictionary value @ data['brightness_pct']
2020-12-18 07:19:07 ERROR (MainThread) [homeassistant.components.automation.new_automation] Wake up lights: Error executing script. Invalid data for repeat at pos 5: value must be at most 100 for dictionary value @ data['brightness_pct']
2020-12-18 07:19:07 ERROR (MainThread) [homeassistant.components.automation.new_automation] While executing automation automation.new_automation
Traceback (most recent call last):
  File "/srv/homeassistant/lib/python3.8/site-packages/homeassistant/components/automation/__init__.py", line 404, in async_trigger
    await self.action_script.async_run(
  File "/srv/homeassistant/lib/python3.8/site-packages/homeassistant/helpers/script.py", line 1026, in async_run
    await asyncio.shield(run.async_run())
  File "/srv/homeassistant/lib/python3.8/site-packages/homeassistant/helpers/script.py", line 242, in async_run
    await self._async_step(log_exceptions=False)
  File "/srv/homeassistant/lib/python3.8/site-packages/homeassistant/helpers/script.py", line 250, in _async_step
    await getattr(
  File "/srv/homeassistant/lib/python3.8/site-packages/homeassistant/helpers/script.py", line 570, in _async_repeat_step
    await async_run_sequence(iteration)
  File "/srv/homeassistant/lib/python3.8/site-packages/homeassistant/helpers/script.py", line 538, in async_run_sequence
    await self._async_run_script(script)
  File "/srv/homeassistant/lib/python3.8/site-packages/homeassistant/helpers/script.py", line 670, in _async_run_script
    await self._async_run_long_action(
  File "/srv/homeassistant/lib/python3.8/site-packages/homeassistant/helpers/script.py", line 419, in _async_run_long_action
    long_task.result()
  File "/srv/homeassistant/lib/python3.8/site-packages/homeassistant/helpers/script.py", line 1026, in async_run
    await asyncio.shield(run.async_run())
  File "/srv/homeassistant/lib/python3.8/site-packages/homeassistant/helpers/script.py", line 242, in async_run
    await self._async_step(log_exceptions=False)
  File "/srv/homeassistant/lib/python3.8/site-packages/homeassistant/helpers/script.py", line 250, in _async_step
    await getattr(
  File "/srv/homeassistant/lib/python3.8/site-packages/homeassistant/helpers/script.py", line 596, in _async_choose_step
    await self._async_run_script(script)
  File "/srv/homeassistant/lib/python3.8/site-packages/homeassistant/helpers/script.py", line 670, in _async_run_script
    await self._async_run_long_action(
  File "/srv/homeassistant/lib/python3.8/site-packages/homeassistant/helpers/script.py", line 419, in _async_run_long_action
    long_task.result()
  File "/srv/homeassistant/lib/python3.8/site-packages/homeassistant/helpers/script.py", line 1026, in async_run
    await asyncio.shield(run.async_run())
  File "/srv/homeassistant/lib/python3.8/site-packages/homeassistant/helpers/script.py", line 242, in async_run
    await self._async_step(log_exceptions=False)
  File "/srv/homeassistant/lib/python3.8/site-packages/homeassistant/helpers/script.py", line 250, in _async_step
    await getattr(
  File "/srv/homeassistant/lib/python3.8/site-packages/homeassistant/helpers/script.py", line 596, in _async_choose_step
    await self._async_run_script(script)
  File "/srv/homeassistant/lib/python3.8/site-packages/homeassistant/helpers/script.py", line 670, in _async_run_script
    await self._async_run_long_action(
  File "/srv/homeassistant/lib/python3.8/site-packages/homeassistant/helpers/script.py", line 419, in _async_run_long_action
    long_task.result()
  File "/srv/homeassistant/lib/python3.8/site-packages/homeassistant/helpers/script.py", line 1026, in async_run
    await asyncio.shield(run.async_run())
  File "/srv/homeassistant/lib/python3.8/site-packages/homeassistant/helpers/script.py", line 242, in async_run
    await self._async_step(log_exceptions=False)
  File "/srv/homeassistant/lib/python3.8/site-packages/homeassistant/helpers/script.py", line 250, in _async_step
    await getattr(
  File "/srv/homeassistant/lib/python3.8/site-packages/homeassistant/helpers/script.py", line 457, in _async_call_service_step
    await service_task
  File "/srv/homeassistant/lib/python3.8/site-packages/homeassistant/core.py", line 1399, in async_call
    processed_data = handler.schema(service_data)
  File "/srv/homeassistant/lib/python3.8/site-packages/voluptuous/validators.py", line 218, in __call__
    return self._exec((Schema(val) for val in self.validators), v)
  File "/srv/homeassistant/lib/python3.8/site-packages/voluptuous/validators.py", line 340, in _exec
    raise e if self.msg is None else AllInvalid(self.msg, path=path)
  File "/srv/homeassistant/lib/python3.8/site-packages/voluptuous/validators.py", line 336, in _exec
    v = func(v)
  File "/srv/homeassistant/lib/python3.8/site-packages/voluptuous/schema_builder.py", line 272, in __call__
    return self._compiled([], data)
  File "/srv/homeassistant/lib/python3.8/site-packages/voluptuous/validators.py", line 215, in _run
    return self._exec(self._compiled, value, path)
  File "/srv/homeassistant/lib/python3.8/site-packages/voluptuous/validators.py", line 340, in _exec
    raise e if self.msg is None else AllInvalid(self.msg, path=path)
  File "/srv/homeassistant/lib/python3.8/site-packages/voluptuous/validators.py", line 338, in _exec
    v = func(path, v)
  File "/srv/homeassistant/lib/python3.8/site-packages/voluptuous/schema_builder.py", line 817, in validate_callable
    return schema(data)
  File "/srv/homeassistant/lib/python3.8/site-packages/voluptuous/schema_builder.py", line 272, in __call__
    return self._compiled([], data)
  File "/srv/homeassistant/lib/python3.8/site-packages/voluptuous/schema_builder.py", line 594, in validate_dict
    return base_validate(path, iteritems(data), out)
  File "/srv/homeassistant/lib/python3.8/site-packages/voluptuous/schema_builder.py", line 432, in validate_mapping
    raise er.MultipleInvalid(errors)
voluptuous.error.MultipleInvalid: value must be at most 100 for dictionary value @ data['brightness_pct']

and the automation yaml is:

alias: Wake up lights
description: ''
use_blueprint:
  path: sbyx/wake-up-light-alarm-with-sunrise-effect.yaml
  input:
    max_brightness: '100'
    light_entity: light.yeelight_color_0x0000000007e72c35
    manual_time: '23:28:00'
    sunrise_duration: '10'
    pre_sunrise_actions: []

Hi

I really love this idea!
However, for some reason stopped to work completelly…

Previous version was just turning light on.

I have latest version and it worked a just a bit, but after cycle was over, it turned off (with magic light controller and fluxled component which doesn’t like “transition” effect at all). I manually removed those lines with transition and… stopped working at all.
I remove again completelly this blueprint and automation and… still doesn’t work with fluxled, mqtt nor WLED… Atuomation is activated, but light does not turn on.

I removed the transitions now as it was more trouble then what it was worth. Instead latest version now goes through the 255 absolute brightness steps instead of the 100 percentage steps. This should make transitions obsolete here anyway.

2 Likes

Hey great blueprint. I wake up years now with a Philips wake up light. Now I have 2 color Philips hue lights in my bedroom. So it would be wonderful to wake up with this blueprint.

I only have a issue I don’t know how to solve.
I have filled in the next_alarm sensor from the android companion app.
But something strange is happening on my Samsung S20. When i boot the phone, it is telling home assistant the correct next alarm time (7:30 morning) from the app com.google.android.deskclock (Google Android Clock) but after some minutes when the phone has been fully booted I guess, it is showing an unidentefied wrong time (6:00 morning) from the app com.android.providers.calendar (Google Calendar) but I have no appointments or anything else in that agenda at 6:00.

Does anybody know how to fix this?

Use Allow List. Only apps on that list reports to the next_alarm sensor.
With {{ state_attr('sensor.<YOUR_PHONE_NAME>_next_alarm', 'Package') }} pasted in the template-editor you will find the app name of your alarm-app.

1 Like

Thanks a lot, that fixed the issue.

1 Like

Hi

Thank you for update!
However, still no light turns on… Even if I execute manually or with alarm.
Just, nothing happens.
Any ideas why?
I was removing those transitions and this crashed entire blueprint and since then it stopped to work.
How to analyse this?
time_date sensor is added and visible.
pre-sunrise actions also doesn’t work (even simple light turn on)…

Is this blueprint good only for LEDs which have color temp? I have RGBWW (warm white)…

EDIT:
It turned once on too bright (but this can come from flux_led behaviour), then increased for a while and again goes off and don’t want to start…

EDIT2:
What kind of light are you using that it works nicely?

Are you seeing any errors in the logs now, e.g. related to templates? I’m using this on workdays with a Hue Go but I am also testing this on a simple dimmable light (without colors or color temperature capability). Both ZigBee with deCONZ.

Also if you are seeing this not triggering, could you please check the sensor.date_time_iso state (e.g. under Developer Tools - States) matches your local date and time (according to your Timezone) to within a minute.

Also please check your Timezone is set correctly in the general settings of HA.

Hi

Ok, I have it. It’s not fault of your blueprint, but simply flux_led integration is disaster…
I reinstalled blueprint and with MQTT seems to work very well!
So far it didn’t work only once, no idea why (alarm was not triggered)
Thank you very much for awesome blueprint :slight_smile:

1 Like

Hey there… i use an analog RGB Strip with a pca9685 12-bit PWM driver.
I already was able to get this strip working on a light-card on the dashboard via this yaml:

yaml
esphome:
  name: rgb_led_bed
  platform: ESP8266
  board: d1_mini

wifi:
  ssid: "xxx"
  password: "xxx"

  # Enable fallback hotspot (captive portal) in case wifi connection fails
  ap:
    ssid: "Rgb Led Bed Fallback Hotspot"
    password: "xxx"

captive_portal:

# Enable logging
logger:

# Enable Home Assistant API
api:
  password: "xxx"

ota:
  password: "xxx"
  
# Enable Web-Server
web_server:
  port: 80
  
time:
  - platform: homeassistant
    id: homeassistant_time
    timezone: Europe/Berlin

# Example configuration entry
i2c:
  sda: D2
  scl: D1
  scan: True
  id: bus_a

# Example configuration entry
pca9685:
  frequency: 500

#Outputs
output:
  - platform: pca9685
    id: 'pca9685_output0'
    channel: 0
    max_power: 0.80
  - platform: pca9685
    id: 'pca9685_output1'
    channel: 1
    max_power: 0.72
  - platform: pca9685
    id: 'pca9685_output2'
    channel: 2

# Example configuration entry
light:
  - platform: rgb
    name: "strip1"
    id: strip1
    restore_mode: ALWAYS_OFF
    default_transition_length: 2s
    red: pca9685_output1
    green: pca9685_output2
    blue: pca9685_output0

How to adapt the blueprint of this thread to my RGB LED Strip?
There don’t seem to be “mired” anywhere

sorry if this is a lame question… i’m new to hassio

nevermind… this was a timezone-conflict between device and hassio… fixed it and it works now =)

Is it possible to adjust color-effect in this blueprint? i would like to have a more warm color-fade… currently it is only brightness-fade.


p.s. ever thought about automaticaly fade in some audio-file parallel to the brightness?


p.p.s. is it possible to use complete bandwidth of 12bit pwm? 4096 steps are much better than 255, when it comes to low-light.

Color effect is usually auto-detected based on color temperature ability of the light as exposed by HA. I did not add explicit RGB support since I don’t have any lights that only expose RGB but not color temperature and translation between color temperature and RGB does not seem to be straight forward at first glance. Does your LED support setting color via color temperature as well, e.g. light.turn_on call with color_temp attribute?

You can trigger playing an audio manually using the pre-sunrise actions but there is currently no possibility to do volume adjustment during sunrise and no plans from my side to implement this currently.

Not sure whether those 4096 steps are actually exposed to HA. Afaik light brightness values in HA are normalized from 0 to 255 (i.e. brightness value in light.turn_on call).

1 Like

Ok, so I can’t work out how to add a manual time for the alarm. Any hints?

I have read the meagre paragraph about updating the config.yaml file, but I am none the wiser as to where I actually put the alarm time into the config?

Is it a helper? in the config.yaml file? blueprint? automation (there’s no field there)?

If you have a recent version of the blueprint, manual alarm time is simply the third Parameter you can input (like the light entity). No need for helpers anymore.

I have the latest version (and to check I have just re-imported it from the gist).
In the automation screen I see the section for the manual alarm time, but there is no input controls or place to enter the time, it’s blank to the right

Sorry my bad. Small typo must have found its way in the latest version. I have fixed the gist and forum post here. Should work after again after reimport.

Perfect, works now.

Hi there
Can I have a minimum brightness slider with this blueprint script? I have these gledopto led bulbs and they don’t turn on when brightness is set below 15%. Don’t know why they do that…

The most recent version of this blueprint doesn’t seem to work with my Floalt panel.

I’m using a set time, and when the time comes for the event to start, I do see a trigger appear in the history of the automation, but the panel doesn’t turn on.
I tried it with a few different (tradfri) lights in my house as well, and none of them turn on with this blueprint.

(I also don’t see the action of turning on the panel in its history)

Do I need to add something in the pre-sunrise section for the light to work?

edit
I’m not using the Tradfri hub, I’m using the ZHA integration to communicate with the Floalt panel. Turning it on and off and such does work from within Home Assistent. Just not through this blueprint for me. But perhaps I’m missing something.