Sync next iOS16+ alarm clock in HA (with Shortcuts and companion app)

Over time, I’ve seen many people claim to solve this problem but, so far, I haven’t found any that properly deal with all the necessary scenarios. Before I get my hopes up again, can you confirm that all the following scenarios are handled with your shortcut?

  • One-time alarm
  • Repeating alarm
  • Bedtime / sleep schedule alarm
  • Bedtime / sleep schedule override
  • Combinations of each of the above

Yes and no?

No: it depends on how you use your alarms and how you’d like to use them in HA itself. I only ever really use the Bedtime / sleep schedule and created the shortcuts-automation around this. So it happens to take ‘normal’ repeating alarms into account, but not one-time alarms. But again, I don’t use those, so I haven’t thoroughly tested the shortscuts-automation dealing with them.
Furthermore, the way Apple has implemented alarms in iOS and the way the shortcuts-app can access this data, has it’s limitations. Like I mentioned above, it can’t detect you’ve ‘skipped’ a planned alarm and will always send it to HA.

Yes?: you could use names for your ‘normal’ alarms and tweak the shortcuts-automation to filter accordingly to handle these too. It ought to work that way, but I can’t imagine all your ‘necessary scenarios’, so can’t tell you wether this would help or not.

1 Like

I certainly understand the complexity and limitations at play, as I’ve tried a few times to build a shortcut myself before parking the effort until such time that I had more opportunity to focus on it. At the same time, as I said, I’ve seen a number of people try to solve the problem and not get all the way there. That was the only reason I asked - to see which scenarios you’ve accounted for, which you haven’t, and how easily your solution can be extended for additional scenarios.

Thanks for your response. I’ll be sure to download it and give it a try. Cheers!

I’ve just updated the link to the real ‘last version’. Hope you find it useful and can make it work for your use-case!

I just stick to the bedtime/sleep schedule alarms, I have no use for the normal alarms. Makes it a lot easier :angel:
I need to wake up on time, even on off days, because of my medications. So I wake up anywhere between 6 and 8. For the rare occasion I don’t set my alarm (skipping a planned alarm), I created an override in HA to not trigger the wakeup-light. There is no way to do this within Shortcuts that I’m aware of. So the bedtime/sleep schedule fits my needs perfectly.

I’ve got troubles understanding what happens after the first if-clause, ie what does “Set datetime to Time on Dictionary”. Specifically, what does “datetime” do or mean?

Hey, thank u so so much for this. I think u may be the only one who figured out how to make this.

I have just one issue: I meed the helper to act as a sensor for Wake-up light alarm with sunrise effect

Is that possible?

Thx!

The shortcuts-automation sends the data to HA, but HA only accepts this data in the form of a dictionary.
So the dictionary needs a key (‘datetime’) with a value (‘2023-01-22 12:00’) and an entity where this information needs to be stored (‘input_datetime.example’).

It’s the same as setting a value with yaml in the developer tools:

It seems the blueprint only accepts sensors with a date-time (ISO8601) format. There is no service for the Shortcuts-automation to set the value of a sensor.

But, you could tweak the automation and use the ISO8601 date-time formatting (instead of my custom one) to be send to a input_datetime helper and create a custom sensor within HA that sets a sensor with the same timestamp to be used in the blueprint.

Tank u so much for the fast answer. Since my knowledge of homeassistant is quite little, would u mind explaining more detailed, what i have to do? That would be great! Thx <3

This is awesome! Thanks so much for sharing :sunny:

1 Like

Hi, i have imported the shortcut 2 days ago, i have every day set an alarm with bedtime. but not everyday at the same time. the shortcut has worked for 1 day the other days the datetime is not updated. in HA.

Have you worked with yaml code? Do you know how to edit the config.yaml file?

Just to make sure:
Have you set up an automation on your iPhone that runs the shortcut once a day/whenever you close the clock/health app?

No I didn’t do that… that will solve the problem.

The shortcut only sends the next alarm to HA. So you need to run the shortcut every time in between (different) alarms. Hope that fixed your problem :blush:

Thanks for the nice work! I added the 2.3 shortcut to my iphone but when i run it i get an error:


Do you know how to solve this?

Can you tell at which point the error occurs within the shortcut?


It stops after the Otherwise part.

1 Like

Could you run this shortcut?
It’ll list all your alarms, but without the formatting/sending to HA:

should give you something like this:

I’m wondering whether there is an alarm that’s missing a date (either 01-01-2001 or tomorrows date…).
What kind of alarm have you set up on your iPhone?

sorry for the late reply.
i use the alarm setting in the health app.
running the shortcut you provided gives me these 2: