Could be some change in a recent HA update?
Possibly. After a new update it is working again
Thanks for this blueprint. My son would like to get such alarm, so I’ve debugged this for today…
I tried this without any timestamp sensor or check entity. I never get past that check. I think there is a bug. The following test doesn’t take into account check_entity would be undefined, does it?
condition: template
value_template: >-
{{0 < as_timestamp(states(sensor) if sensor != 'none' else
states('sensor.date') ~ ' ' ~ manual_time) - as_timestamp(now()) <=
float(seconds) and states(check_entity) in ['unknown', 'on', 'home']}}
I think the logic should and a check if check_entity is undefined in addition to unknown, on and home.
I don’t see any other reason for always being spun out from there. How to fix this, I’m not familar with the format. I tried this, which doesn’t work:
- condition: template
value_template: '{{0 < as_timestamp(states(sensor) if sensor != ''none'' else states(''sensor.date'')
~ '' '' ~ manual_time) - as_timestamp(now()) <= float(seconds) and states(check_entity)
in [''unknown'', ''on'', ''home''] if check_entity != ''none'' else states(''sensor.date'')
~ '' '' ~ manual_time) - as_timestamp(now()) <= float(seconds)}}'
Here is little bit more info I gathered yesterday:
the input (never mind the plugin path, I copied under different name if i need to modify it for testing):
alias: Test stuff
description: ""
use_blueprint:
path: ikke-t/testi.yaml
input:
light_entity: light.topin_kaikki_ledit
manual_time: "21:25:00"
sunrise_duration: 10
min_mired: 60
start_brightness: 32
check_entity: device_tracker.iken_kanny
I tried it first without any value to check_entity, but hten tried it with couple of phones. The other one had status “Home” and the other one had “Unknown”, I checked them from entity info.
Also I see from event list that the date, internet times and such keep increasing, so the datetime module should be ok.
So all values to that time checking should be in place. It still thows me out from the value_template no matter what. I never get past that. Ideas?
Edit: … Continuing. I set debug on, and I think it’s like I said. There is a bug not to handle if the check_entity is not set:
2022-12-26 17:40:00.393 ERROR (MainThread) [homeassistant.components.automation.test_stuff] Error while executing automation automation.test_stuff: In 'template' condition: AttributeError: 'NoneType' object has no attribute 'lower'
This is full debug of single hit of the automation, this time with check_entity set to my mobile which is located at home by HA:
grep -i "Test stuff" home-assistant.log -B1 -A1|less
....
2022-12-26 17:50:00.154 DEBUG (MainThread) [homeassistant.components.automation.test_stuff] Automation trigger 'None' triggered by time pattern
2022-12-26 17:50:00.156 DEBUG (MainThread) [homeassistant.core] Bus:Handling <Event automation_triggered[L]: name=Test stuff, entity_id=automation.test_stuff, source=time pattern>
2022-12-26 17:50:00.156 DEBUG (MainThread) [homeassistant.core] Bus:Handling <Event state_changed[L]: entity_id=automation.test_stuff, old_state=<state automation.test_stuff=on; last_triggered=2022-12-26T19:49:00.157119+02:00, mode=single, current=0, id=1672003878277, friendly_name=Test stuff @ 2022-12-26T19:43:09.860556+02:00>, new_state=<state automation.test_stuff=on; last_triggered=2022-12-26T19:50:00.156493+02:00, mode=single, current=1, id=1672003878277, friendly_name=Test stuff @ 2022-12-26T19:43:09.860556+02:00>>
2022-12-26 17:50:00.158 DEBUG (Recorder) [homeassistant.components.recorder.core] Processing task: EventTask(event=<Event automation_triggered[L]: name=Test stuff, entity_id=automation.test_stuff, source=time pattern>)
2022-12-26 17:50:00.158 DEBUG (Recorder) [homeassistant.components.recorder.core] Processing task: EventTask(event=<Event state_changed[L]: entity_id=automation.test_stuff, old_state=<state automation.test_stuff=on; last_triggered=2022-12-26T19:49:00.157119+02:00, mode=single, current=0, id=1672003878277, friendly_name=Test stuff @ 2022-12-26T19:43:09.860556+02:00>, new_state=<state automation.test_stuff=on; last_triggered=2022-12-26T19:50:00.156493+02:00, mode=single, current=1, id=1672003878277, friendly_name=Test stuff @ 2022-12-26T19:43:09.860556+02:00>>)
2022-12-26 17:50:00.163 DEBUG (MainThread) [homeassistant.components.websocket_api.http.connection] [139731226636304] Sending {"id":2,"type":"event","event":{"c":{"automation.test_stuff":{"+":{"lu":1672077000.156656,"c":"01GN7RWFETED6F9PG058MSZ8YY","a":{"last_triggered":"2022-12-26T17:50:00.156493+00:00","current":1}}}}}}
2022-12-26 17:50:00.165 INFO (MainThread) [homeassistant.components.automation.test_stuff] Test stuff: Running automation actions
2022-12-26 17:50:00.165 INFO (MainThread) [homeassistant.components.automation.test_stuff] Test stuff: Executing step wait template
2022-12-26 17:50:00.166 INFO (MainThread) [homeassistant.components.automation.test_stuff] Test stuff: Executing step wait template
2022-12-26 17:50:00.167 INFO (MainThread) [homeassistant.components.automation.test_stuff] Test stuff: Choose at step 3: default: Running automation actions
2022-12-26 17:50:00.174 INFO (MainThread) [homeassistant.components.automation.test_stuff] Test stuff: Test condition template: True
2022-12-26 17:50:00.175 INFO (MainThread) [homeassistant.components.automation.test_stuff] Test stuff: Test condition template: False
2022-12-26 17:50:00.176 DEBUG (MainThread) [homeassistant.core] Bus:Handling <Event state_changed[L]: entity_id=automation.test_stuff, old_state=<state automation.test_stuff=on; last_triggered=2022-12-26T19:50:00.156493+02:00, mode=single, current=1, id=1672003878277, friendly_name=Test stuff @ 2022-12-26T19:43:09.860556+02:00>, new_state=<state automation.test_stuff=on; last_triggered=2022-12-26T19:50:00.156493+02:00, mode=single, current=0, id=1672003878277, friendly_name=Test stuff @ 2022-12-26T19:43:09.860556+02:00>>
2022-12-26 17:50:00.178 DEBUG (Recorder) [homeassistant.components.recorder.core] Processing task: EventTask(event=<Event state_changed[L]: entity_id=automation.test_stuff, old_state=<state automation.test_stuff=on; last_triggered=2022-12-26T19:50:00.156493+02:00, mode=single, current=1, id=1672003878277, friendly_name=Test stuff @ 2022-12-26T19:43:09.860556+02:00>, new_state=<state automation.test_stuff=on; last_triggered=2022-12-26T19:50:00.156493+02:00, mode=single, current=0, id=1672003878277, friendly_name=Test stuff @ 2022-12-26T19:43:09.860556+02:00>>)
2022-12-26 17:50:00.179 DEBUG (MainThread) [homeassistant.components.websocket_api.http.connection] [139731226636304] Sending {"id":2,"type":"event","event":{"c":{"automation.test_stuff":{"+":{"lu":1672077000.176169,"a":{"current":0}}}}
Hey,
since a couple of weeks the Blueprint stopped working for me. I live in Germany with UTC+1
I discovered that
as_timestamp(now())
gave me the wrong timezone (UTC instead of UTC+1)
I changed it to
as_timestamp(states(''sensor.date_time_iso''))
and now its working again.
Thanks a bunch! This fixed it. My time was probably somehow wrongly set. Container thought it’s in UTC timezone, and was showing the same time as locally here in EET. I changed the podman container to have:
--tz='Europe/Helsinki'
and changed the now → to your suggesting, and now it triggers just fine. Pheeew.
I just switched from OpenHAB and found this Blueprint which does the same as my own Automation used to do. This is my first post, so I’m happy about any advices on improving my posts.
Unfortunately I get the same Error no matter what I do. Here is the “input:” section from my YAML.
light_entity: light.sz_schreibtisch_farbe
check_entity: input_boolean.arbeitstag
timestamp_sensor: sensor.xperia_next_alarm
sunrise_duration: 5
end_brightness: 100
min_mired: 153
manual_time: "11:00:00"
-
The light is a Hue color Bulb so I set the values according to the states of the entity
-
The Check Entity is a Helper-Entity derived from workday and my Calendar (confirmed to be on)
-
The Timestamp Sensor: Comes from my Android-Phone, confirmed to be the correct time
Each Minute the Automation shows up in my log. But no matter of any conditions are met or not the Output leads to:
Stopped because an error was encountered at 6. Januar 2023 um 10:38:00 (runtime: 0.03 seconds)
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
I have no idea what’s really going wrong because all of those inputs and states should be fine. The same problem occurs with any other Light or a different timestamp as well with the original “workday” sensor and without setting the Manual Time.
Edit: The Fork from it-guy92 lead to the same result
Have you added the datetime iso entry to your config?
That solved it. I wasn’t aware that there was a manual configurationen needed to get this sensor.
Thank you very much!
It is definitely me, but it seems that when I use my Alexa next alarm entity, the wake up light (which is set to my philip hue LED strip) doesn’t turn on. The blueprint starts at the right time (25 mins before, but nothing happens.
i’m new to HA, what can I do to troubleshoot?
It is possible to get the next alarm from phone and use it as time for the sunrise?
Would love to use it, but unfortunately I get the following error in the Trace Timeline:
Triggered by the time pattern at 18. Januar 2023 um 22:09:00
Wait for a template to render true
Stopped because an error was encountered at 18. Januar 2023 um 22:09:00 (runtime: 0.01 seconds)
In ‘template’ condition: AttributeError: ‘NoneType’ object has no attribute 'lower
Does anyone know what’s going on?
Have you added the datetime iso entry to your config?
- platform: time_date
display_options:
- 'date'
- 'date_time_iso'
It’s a shame, I can’t get this blueprint te work.
when I use the original it doesn’t work.
When I ty the one it guy posted earlier I get the following error:
¡TemplateSyntaxError: expected token ‘,’, got 'max_mireds
i have no clue where to start, really wanted this automation working with some sort of fade in audio as an alarm clock
Yes I did.
for those who want to try this. Use the android HA app which is able to give the alarm to HA, so you can use it with this blueprint.
I haven’t had success with this blueprint either. I have the time_date display options in my system and I’ve tried various configurations with a hue light bulb as the entity to fade in.
I also had issues getting it to work. Turns out some instructions I read previously were incomplete. The time_date intry in config.yaml is supposed to be under a sensor: entry instead of config:
so try this if you haven’t already
sensor:
- platform: time_date
display_options:
- 'date'
- 'date_time_iso'
I have this wakeuplight bleuprint also and want to use a custom sensor (for time when to set the alarm)
I have an alarm for my wakeup radio with 2 sliders…
One input slider for the hour and one input slider for the minutes which is very easy for controlling.
The problem i have is how to convert these 2 input values to a time sensor that works with this blueprint / automation.
Wake time 1: is from the Radio wakeuptime… that works I and cannot mess with that.
Wake time light: is what i created and am trying to achieve… so the wake time 1 is converted to a sensor time date value that i can use for this automation.
I am kinda newby with this so maybe one can help me figure this out…
sensor:
- platform: template
sensors:
wake_time_1:
friendly_name: 'Wake Time 1'
value_template: "{{'{:02d}:{:02d}'.format(states('input_number.wakehour_1') | int, states('input_number.wakeminutes_1') | int) }}"
wake_time_light:
friendly_name: 'Wake Time light'
value_template: "{{states('sensor.date') ~ ' ' ~ states('sensor.wake_time_1') ~ ':00'}}"
device_class: timestamp
I bump into the same problem here.
HA newbie here and I would love to use this blueprint, but whatever I try, the condition keeps on ending up ‘false’ so nothing happens.
I tried ‘none’ the workday sensor that values “on”, I tried my person that values “home”…
Besides adding “true” as a valid option I did not make any changes to the blueprint.
Any ideas?