Wake-up light alarm with sunrise effect

Super, it’s working just fine. Many thanks!!

Great to hear!
I’d be interested to hear if the alarm is now matching your input_datetime entity and not the manual alarm setting in the Automation.

Reason being when I check the state of the sensor.wake_up_alarm in Dev Tools Template, I get “unknown”.

I think there’s an issue with the Device Class “timestamp” expecting a different format than the datetime string provided by the input_datetime entity, I’m working through that now…

Ok, I’ve now fixed my sensor so it’s outputting correctly with the timestamp device class. I needed to change the template state as follows:

{{ (states('input_datetime.wake_up_alarm') | as_datetime | as_local).isoformat() }}

My sensor now outputs as expected:

I also worked out how to add it as a helper entity through the UI in the meantime :wink:

Solution found thanks to this post!

Hi, could it be set up like this:

  • I say a command to Siri like Hey, Siri wakeup light at 8 am
  • Siri sets up the automation + standard alarm (I would like to avoid situation that I trigger it for example when I’m on Holidays and my parents are in our home)

Is there a way to do it or maybe there are other better solutions?

Hi,

I’ve been trying to set an alarm timestamp sensor, in order to be able to change from the dashboard the time I want the automation to run.

I created a time helper input_datetime.wake_up_alarm, and added a sensor in templates.yaml :

sensor:
  - name: "Wake Up Alarm"
    unique_id: template_se_alarm_01
    state: "{{ (states('input_datetime.wake_up_alarm') | as_datetime | as_local).isoformat() }}"
    device_class: timestamp

When I set the alarm timestamp sensor to sensor.wake_up_alarm, it doesn’t work as expected.

Am I missing something there ? Could anyone help me ? Thanks

Same here, I am also confused. The help says it needs a “Sensor with timestamp of next alarm with device_class: timestamp”. I tried a template sensor that returns datetime as well as isoformat.

{% set alarm_time = state_attr('sensor.pixel_5_next_alarm', 'Time in Milliseconds') / 1000 %}
{% set alarm_time_dt = as_datetime(alarm_time)| as_local %} 
{{alarm_time_dt is datetime}}
{{alarm_time_dt}} # also alarm_time_dt.isoformat()

Both options raising the error

Error: In ‘template’ condition: ValueError: Template error: as_timestamp got invalid input ‘unknown’ 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

The helper in all cases show a valid value, unsure why it’s unknown to the blueprint.

Any help is welcome!

Just realizing the problem is states('sensor.date_time_iso'). I don’t have such a sensor. What should it yield?