Next_alarm alexa

hi, I would like a trigger that allows me to start a specific action.
the trigger should be based on the next alarm of a device alexa sensor.echo_show_di_matteo_next_alarm.
this is the output format:
2019-11-26T07:10:00+01: 00.
how do I extrapolate exclusively the time and that is 07:10. thanks
this value will serve as a timetable for me to turn on a light.

@petro do you know the solution?

Your trigger template should be.

- platform: template
  value_template: >
    {{ as_timestamp(states('sensor.echo_show_di_matteo_next_alarm')) | timestamp_custom('%H:%M') == states('sensor.time') }}

Ok i check

it won’t work if you don’t have sensor.time integrated.

from that echo alarm that is composed of date and time, I should only extract the time and use the time to turn on a light. so I should do a data extraction from that string

Yes, but if you want to trigger off that time, you need to integrate sensor.time and compare the current time to the alarm time.


this extracts the time and converts it to 07:10:

as_timestamp(states('sensor.echo_show_di_matteo_next_alarm')) | timestamp_custom('%H:%M')

this gets the current time, i.e. 07:10

states('sensor.time')

The template as a whole compares the 2.

I have already integrated the sensor time. but what I would like to do is simply extrapolate that time value.
then if possible, use it via red node and compare it with the current time.
now I simply give myself as a False value

Alright, you should be able to use what i gave you already to get that information.

ok if the value is true do the hours and alarms coincide?

they will only coincide on the minute. If you want seconds, you’ll need to use another method to execute at the exact time.

what is the other method?

when you see a new timer, start automation with a delay the duration of the timer.

one example?

- platform: template
  value_template: >
    {{ as_timestamp(states('sensor.echo_show_di_matteo_next_alarm')) | timestamp_custom('%H:%M') }}

with this trigger I have the time at which alexa starts with the alarm.
if I want to start an action 20 minutes before this value, what can I do?
grazie

@petro do you know the solution?
thank you

 {{ (as_timestamp(states('sensor.echo_show_di_matteo_next_alarm'))-20*60) | timestamp_custom('%H:%M') }}

Check this out!