Activate Script when Alarm Clock goes off.
See original GitHub issueIs your feature request related to a problem? Please describe. Right now, it is possible to use an overly complicated template to detect if now is the time the alarm was supposed to go off. But this is not a terribly user friendly solution, considering the on-going work the Home Assistant developers have been doing to reduce the amount of actual coding a new user needs to do to be able to make Home Assistant do things.
Describe the solution you’d like The ability to simply choose an existing script you would like Home Assistant to trigger when the alarm goes off. This would also mean, that each person in a household could simply choose the script applicable to them, rather than having to code multiple automations that are monitoring the time of the next alarm. The app might also offer the possibility of only triggering the script, if the device is detected as being in the “home” state.
Describe alternatives you’ve considered, if any
Googling for 2 days to find examples of the overly complex automation needed to detect if now is the time the alarm is going off. This for example - is the accepted solution:
{{now().strftime("%a %h %d %H:%M %Z %Y") == (((state_attr('sensor.joes_galaxy_s10_next_alarm', 'Time in Milliseconds') | int / 1000) + 0*60 ) | timestamp_custom('%a %h %d %H:%M %Z %Y'))}}
from the thread https://community.home-assistant.io/t/how-to-use-next-alarm-sensor/221686/5 my current method of avoiding this need to template the automation, is to expose the script to Google Assistant, and then tell the Alarm Clock to trigger the Assistant Routine when the alarm is dismissed - but this of course, relies on there being an internet connection, and the whole ethos of Home Assistant is to keep things as local as possible.
Additional context The phone, already knows what time it is now, and the time of the next alarm, it doesn’t make sense for the phone to sit there doing nothing, leaving the server to waste cpu cycles constantly evaluating the template, when the phone knows now == alarm time.
Issue Analytics
- State:
- Created 3 years ago
- Comments:6 (4 by maintainers)
Top GitHub Comments
Thank you! I am happy to accept this closes the request. I already use Sleep As Android.
Is it possible to have metadata associated to the alarm like its name? Maybe I am wrong but I don’t see a way to associate a specific alarm with a specific script.
Like you said earlier, it would be a mess if you have multiple alarms.
If I need to set an associated condition with the time (and/or date) in HA, I am just setting an “alarm” in HA itself. TBH with myself, I think what I really need there is more a native scheduler in HA. Thanks again for the hard work and the new features!