question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Activate Script when Alarm Clock goes off.

See original GitHub issue

Is 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:closed
  • Created 3 years ago
  • Comments:6 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
asjmcguirecommented, Nov 4, 2020

Thank you! I am happy to accept this closes the request. I already use Sleep As Android.

0reactions
Minckacommented, Nov 5, 2020

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.

Try to plan for this state change instead of doing the evaluation but keep in mind that if you set an earlier alarm then it will trigger the next alarm event so you may want to make a condition based on time.

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!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Scripting My Morning Wake-Up Alarm and Lights with Android ...
Using TP-Link Kasa, Google Apps Script, Android, and Automagic to automate my morning wake up alarm and turn on the lights.
Read more >
Turn on light when alarm goes off? : r/HomeKit - Reddit
Go to events sections and select "Alarm" and then choose the HomeKit scene or device you would like to use. I use this...
Read more >
want alarm script to run in background but accept user input to ...
When alarm goes off I have a read command prompting user to hit the 'Enter' key to stop the alarm. I want to...
Read more >
python - Script to activate an alarm at a time in the future
time() if time is None: # need to let the caller know that the time wasn't in a recognised format raise ValueError time...
Read more >
Alarm clock Set Timeout For A Shell Command - nixCraft
How can I run a command called foo, and have it timeout/abort after 10 seconds under GNU/Linux running bash shell or script?
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found