Hi,
Is it at all possible to add the ‘next alarm datetime’ as an entity in Home Assistant, similar to the Android companion app? This would be really convenient to start morning routines before the alarm goes off.
Thanks
Marvin
Hi,
Is it at all possible to add the ‘next alarm datetime’ as an entity in Home Assistant, similar to the Android companion app? This would be really convenient to start morning routines before the alarm goes off.
Thanks
Marvin
As far as I know, this information is not possible to retrieve on iOS.
If it’s not super important to do things before your alarm goes off, you can do this with the Shortcuts app that is included with iOS by default.
automation.trigger
and then for the service data put in {"entity_id":"automation.morning_routine"}
– or whatever yours is called. Make sure that “Show When Run” is toggled off.Now when your morning alarm goes off and you hit the snooze or stop button on your phone, it will trigger your Home Assistant morning routine.
Thanks for your extensive reply. This is exactly what I am currently doing. However, I would like to perform some actions before the alarm goes off, for example:
Is there any way to achieve this with iOS, without manually syncing alarms to Home Assistant?
After switching from android to iOS, that’s the feature I miss the most!
With my current solution I have to delete the earlier (and therefore inactive) alarms, as shortcuts doesn’t differ between active and inactive alarms.
My shortcut looks as follows:
Trigger is closing the clock app.
Screenshots, but in German:
You’re a legend. I am gonna give this a try, thanks!
Thanks @M1ke for the direction! Personally I had to make some adjustments to get it to work; so posting here for the ones having comparable troubles:
Note that when you make an error somewhere and get a wrongly formatted time, the home assistant service call does not succeed. Apprantly it checks whether the field ‘time’ is correctly formatted. To test it out, I called the service with a manual time and added my variable under an extra dictionary entry (‘test’). That case, I could test and call the service until I had the right configuration.
Attached my setup in Dutch:
Hi,
I’m getting errors with the format type and i’m not sure why.
I can see the results before it’s being sent to HA, and it says:
“20:30:00” (medium method)
I’ve also tried the short method i.e. “20:30”.
Both shows up correctly on the shortucts, however when i try to send it to HA i get “wrong api - due to format issues”.
My input variable on home assistant is time format.
So i’m scratching my head and can’t figure out what’s the problem.
Can you maybe show your script in english?
The input_datetime needs to be hours, minutes, seconds eg. 06:00:00. Let me know if you’re still having the api issue and I’ll elaborate on the ios shortcut setup.
has_date: false
has_time: true
editable: true
The issue I’m running into is that when automation runs, the call service requires an approval. Did you have a workaround for that?
I switched from android to iOS, but I wanted to have the “next_alarm” for my light timer back. I used @WiiiLDFARMER example. But I added a choice function to use one of the created alarms and an option to disable all alarms.
It is in German too. Einschalten = Enable, Ausschalten = Disable.
In shortcuts:
In Automation (disable the alarm in HA):
In Home Assistant:
input_datetime:
next_alarm:
name: Nächster Alarm
has_date: false
has_time: true
- platform: template
sensors:
alarm_time:
friendly_name: "Weckzeit"
value_template: "{{'Aus' if ( states('input_datetime.next_alarm') == '00:00:00' or states('person.admin') != 'home' ) else (state_attr('input_datetime.next_alarm','timestamp')-(60*60))| timestamp_custom('%H:%M Uhr')}}"
icon_template: "{{'mdi:alarm-off' if ( states('input_datetime.next_alarm') == '00:00:00' or states('person.admin') != 'home' ) else 'mdi:alarm'}}"
Greeting!