Using the Shortcuts app (included on every iPhone running iOS 13 or higher) you can trigger an action at sunrise or sunset. This can come in handy for setting alarms, playing music, and other tasks. Here’s how to set it up.

First, open the Shortcuts app. If you can’t find the icon, swipe downward with one finger from the middle of the screen. Type “Shortcuts” in the search bar, and then tap “Shortcuts” when it appears.

Tap “Automation” at the bottom.

If you’ve previously set up automations on your iPhone, tap the plus sign (+), and then tap “Create Personal Automation.” If this is the first automation you’ve ever created, tap “Create Personal Automation.”

On the “New Automation” menu, tap “Time of Day.”

Here, you can select whether the automation will be triggered at “Sunrise” or “Sunset.”

On the next menu, you can select a time offset, such as “30 Minutes Before Sunset” or “At Sunset.” The same applies to the sunrise options. Select your preferred option, and then tap “Done.”

After you’ve selected either “Sunrise” or “Sunset,” if you want the action to repeat “Daily,” “Weekly,” or “Monthly,” tap your preference. If you want an action to occur every day at sunrise or sunset, tap “Daily.”

Tap “Next” to go to the “Actions” menu. This is where you define what you want to happen at sunrise or sunset. You can select any action available in shortcuts, including displaying an alert, setting a timer, starting an app, and more. You can also chain multiple actions together.

In our example, we’ll set our action to start playing a song from our Apple Music Library.

After you define your action(s), tap “Next.” You’ll see an overview of the entire automation. Tap any section here to go back and make changes.

Before you move forward, toggle-Off the “Ask Before Running” option. In the confirmation pop-up that appears, tap “Don’t Ask.” If this is enabled, your automation won’t run unless you check your screen and confirm it first.

Tap “Done,” and you’ll see the automation you just created in your “Automation” list.

If you ever want to disable an automation, just tap it in the “Automation” list. In the next menu, toggle-Off the “Enable This Automation” option.

You can return to the “Automation” section in the Shortcuts app at any time to enable an automation once again. If you ever want to completely delete an automation, just swipe left on it in the list, and then tap “Delete.”

Happy automating!