Sync Home Assistant Alarm Clock to iPhone alarms using shortcuts, ios 18

Here is a guide to get HA alarm clock times pushed to your iPhone using a combination of HA and ios shortcuts.

I wanted to have one wake alarm that I could set that would trigger lights, music, my phone going off, etc. But because both my partner and wanted alarms going off on our phones, and we both travel a lot, and we wanted it to go off at home if either one of us our home, we didn’t want it to rely on either of our phones alarm times. The awesome post here that takes your phone’s alarm times and pushes them to HA is the reverse of what I wanted. I wanted to take HA alarm times and push them to our phones.

The shortcut will loop through all alarms on your phone containing “Home Assistant” and delete them, so if you change wake up times, then it cleans up after itself every time it runs. It then checks if you are home, and then checks if your HA morning alarm boolean is on.

We set one switch and time for the morning alarm wakeup automation, and then all alarm times are defined as offsets from that time. So no matter how many alarms we set to get us out of bed, we only have 1 switch to turn them all on or off.

The shortcut then gets from HA all entities phone_alarm label (it just assumes they are datetime objects) and iterates through them. Using the label allows you to add as many or as few alarms as you want. I’ve test it with 1-3 alarms and it works. Should work for more. Then for each alarm time, it creates an alarm at that time called “Home assistant {Repeat Index}”

Here is the link to the shortcut

I have created a number of helpers that you can see images of my current dashboard of below:


The only things that the shortcut actually uses are First Alarm and Second Alarm because they are labeled with phone_alarm, and those are calculated as offsets from weekday/weekend morning alarm time.

All are defined on UI, so I can’t just give you my configuration.yaml, but here are my entities:

  • input_datetime.morning_lights_weekday_time
    • input as time for convenience
  • input_datetime.morning_lights_weekend_time
    • input as time for convenience
  • input_boolean.morning_alarm
  • input_number.first_alarm_offset
    • I set upper and lower bounds to this so it is never greater than second alarm offset
  • input_number.second_alarm_offset
    • I set upper and lower so it is never less than first alarm offset. I think it should work if you don’t do that though
  • I also have the workday integration sensor turned on to detect weekdays and weekends

I am probably overcomplicating this, but here or all my template sensors:

sensor.morning_alarm_time

This one collapses multiple alarm times for different days into one alarm time that I can always look at no matter what sensor I am using.

{% if is_state('binary_sensor.workday_sensor', 'on') %}
  {{ as_timedelta(states("input_datetime.morning_lights_weekday_time")) }}
{% else %}
    {{ as_timedelta(states("input_datetime.morning_lights_weekend_time")) }}
{% endif %}

sensor.morning_alarm_next_datetime_helper

Because a lot of my alarm things need a datetime, not just a time. I need to convert my time input, into a datetime. Because I have multiple alarm times (weekday and weekend), I have to be careful and always grab the next alarm time, not today’s alarm time. Meaning if the alarm has passed, grab the one for tomorrow.

These first two could probably be combined with more complicated logic. I just don’t know if I like having 2 templates better or nesting the conditions.

{% if now() > today_at(states("sensor.morning_alarm_time")) %}
  {{ today_at(states("sensor.morning_alarm_time")) + timedelta(days=1) }}
{% else %}
  {{ today_at(states("sensor.morning_alarm_time")) }}
{% endif %}

sensor.alarm_1

This is one of the alarms that the shortcut grabs. It is labeled with phone_alarm so the shortcut knows to grab it, and its time is calculated from the morning alarm time + an offset, so I never have to touch it directly. It doesn’t need to be called alarm_1 either, just labeled with phone_alarm

{{ (as_datetime(states("sensor.morning_alarm_next_datetime_helper")) + timedelta(minutes=states("input_number.first_alarm_offset") | int)) | as_local }}

sensor.alarm_2

I have a second alarm like that, labeled with phone_alarm, but you could make as few or as many as you want.

{{ (as_datetime(states("sensor.morning_alarm_next_datetime_helper")) + timedelta(minutes=states("input_number.second_alarm_offset") | int)) | as_local }}

And when the companion app is closed (assuming that I set the alarm from the companion app most of the time)

I also run the shortcut both at 5am every morning on a schedule so it should be after I go to sleep but before any really early morning wakeups as an extra measure just in case it was set from my computer.


This setup allows us to trigger our wakeup script at sensor.morning_alarm_time regardless if only my partner or I am are home or if one of our phones are dead, which does music, lights, etc. without our phones, plus alarms with our phones and then doesn’t run if

A) you aren’t home
B) doesn’t run the wakeup script at all if you just disable the one switch in HA


Here are pictures of the shortcut in case I ever delete the shortcut and the link breaks:

Shortcut Images





edit 1: To allow ios shortcuts to delete alarms without being asked each time, as of ios 18, you need to go into your settings → Apps → Shortcuts (or just search for Shortcuts) → Advanced → Check Allow Deleting Without Confirmation

Settings Images


Interesting, I am trying to follow along, but what add-on are you using to create your alarms in HA?