I would like to automate something x minutes before an amazon echo next alarm. So for example start my bedside light fade up script 30 minutes before the alarm. When set the entity of the next_alarm looks like this : 2022-11-05T15:00:00+00:00
However, when I try the below template, it ends up with a result like 44868 days, 14:30:00 - I can’t see a way to use this as an automation trigger.
You’ll get an error message like that if sensor.office_dot_next_alarm doesn’t exist or the as_datetime filter cannot convert the sensor’s value into a datetime.
What are the values reported by the following templates?
Taras, thanks for the assist, but it still doesn’t work. I have noticed that Dev Tools states: This template updates at the start of each minute. So I’m working toward changing timedelta to 30 seconds. Still I can be watching Dev Tools and see it change from false to true, but the action still doesn’t fire. I have been reading from other threads and I can see you’re heavily involved in this topic. I just have so much to learn, I will keep pushin’ on.
It definitely will not work with two instances of value_template. What I posted is, at bare minimum, a valid configuration and template.
Your automation is triggered when it detects a change in the sensor’s state value. It then tests if the current date and time is greater than the sensor’s value less one minute.
If you want to examine the result of that test, check the automation’s trace.