Home Assistant and iPhone Critical Alerts Are a Match Made in Heaven

Some iPhone apps may use Critical Alerts to bypass your iPhone settings and play sound notifications even when your iPhone is on silent or Do Not Disturb mode. With Home Assistant, it is possible to send tailored critical alerts for any reason you choose.
What are critical alerts on iPhone?
Critical Alerts are notification alerts that override your iPhone’s current notification settings. Even if your iPhone is on silent or you have Do Not Disturb enabled, a critical notification is immediately sent to your phone and sounds an alert.
The purpose of critical alerts is to ensure that vital notifications are not missed or ignored. For example, if you have set up a water leak sensor in your Apple Home app, the app can send you critical alerts if a leak is detected, so you don’t miss that crucial notification among all the other notifications you receive.
Triggering critical alerts from Home Assistant
Not all apps on your iPhone can send critical alerts. For an app to do this, the developer must request the right to use the feature from Apple and can only do so if Apple approves the request. This is to prevent apps from sending you critical alerts for reasons that aren’t critical, like asking for a review.
The good news is that Home Assistant smart home software is one of the apps that has the right to send critical alerts. This means that if you have set up a Home Assistant server and have the Home Assistant companion app installed on your iPhone, you can use Home Assistant to send critical alerts for any reason you choose.
Sending critical alerts to your iPhone using Home Assistant is easy to do with the Notify action. You configure your notification the same as any notification sent to your iPhone, but you add two extra values under the “sound” data, which ensures that you always receive a sound alert at full volume, even when your phone is on silent or Do Not Disturb mode.
How to send a critical alert from Home Assistant
There are several ways to trigger a notification in Home Assistant, but one of the most common is to use an automation. By adding a few lines to your notification data in your automation, you can turn your standard alert into a critical alert.
Open an automation that you want to use to send a critical alert. In the “So do” section, click the “Add action” button. In the search box, type “notify” and select the “Notifications: send notification via mobile_app_your_phone_name” option. Enter the notification message in the “Message” field. In the data field, enter the following:
push:
sound:
name: default
critical: 1
volume: 1
Now when your automation is triggered, a notification will be sent to your iPhone and play the default critical alert sound at full volume, even if your iPhone is muted. It is also possible to use the “interrupt level: critical” syntax to make a notification critical, but the reason for using the “sound” method will become clear later.
Triggering critical alerts via shortcuts
Another major benefit of being able to send critical alerts using Home Assistant is that it allows critical notifications to be sent directly from iOS shortcuts. Currently, it is not possible to send a critical alert using the Shortcuts app with any of the native actions. However, using Home Assistant Actions, you can use the Shortcuts app to trigger critical alerts at any time. For example, you can create your own panic button shortcut that would send a critical alert to someone else’s phone when you tap a widget or press the Action button.
To send a critical notification in a shortcut, tap “Search Actions”, type “Home Assistant” and select the “Call Service” action. Tap “Service” and select the “notify.mobile_app_persons_phone_name” action.
Press the arrow then “Choose” to select your Home Assistant server. Tap “Service Data” and enter the following:
{
"message": "[your message]",
"data": {
"push": {
"sound": {
"name": "default",
"critical": 1,
"volume": 1
}
}
}
}
Disable “Show at runtime”.
Now, every time your shortcut is triggered, it will send a critical notification to the mobile device you selected (including yours if you select it).
Use different notification sounds for different alerts
One of the downsides of critical alerts is that, by default, they all sound the same. You can’t tell just by the sound of the alert whether it’s a critical alert from one of your apps or a critical alert you sent from Home Assistant. Originally, my medication reminder app alerts sounded the same as all my Home Assistant alerts.
The good news is that it’s possible to choose from a wide variety of system sounds for your Home Assistant’s critical alerts, so you can immediately know what the alert is for without even looking at your phone. You can even upload your own custom audio files to use as sound for your critical alerts. System sounds are not included in the Home Assistant companion app by default; you will need to import them first if you want to use them.
Open the Home Assistant app on your iPhone and tap the menu icon in the upper left corner. Scroll down and select “Settings”. Select “Companion App”. Tap “Notifications” and select “Sounds.” Select the “System” tab and tap “Import System Sounds.”
To add custom audio (which should be saved as a 32-bit, 48,000 Hz floating WAV file), save it to the iCloud section of your Files app. Select the “Imported” tab and tap “Import Custom Sounds.” Select the sound in the Files app. Once you have imported system sounds or custom sounds, restart your iPhone.
To use one of the system sounds, replace “default” in the “name” section of your notification data with the name of the sound, including the file extension. For example, to use the “Noir” system sound, you must replace “name: default” with “name: Noir.caf”, making sure to respect the case of the file name. That’s why I used the “sound” option earlier, rather than the “interrupt level” method.
The “data” section of the Notify action would then look like the following image:
If you want to preview sounds before choosing one, install the free Play System Sounds app, which lets you quickly listen to any system sound with a single tap.
How I use critical alerts
I use critical alerts in several of my Home Assistant automations. For example, I have an automatic system that alerts me when the price of my electricity (which changes every half hour) exceeds a specific level. Once I get the alert, I know not to use energy-hungry appliances like the dryer until the price drops again. Without the critical alert sound, I would regularly miss these notifications until it was too late.
I also have an automation that sends me a critical notification when my smart smoke detector detects smoke or CO in my home. This means that even if I’m away from home, I receive a loud notification sound that alerts me that there is smoke or CO detected in my home. Fortunately, this alert has never been triggered yet.
However, my favorite use of critical alerts is a simple shortcut I created to resolve a constant source of frustration. Many times I would message my wife, or she would message me, requesting urgent information, and we would miss the notification completely. For example, I could message her from the grocery store to ask if we needed anything else, and she wouldn’t respond until I was halfway home.
We both now have a shortcut on our phones that we can run from a widget in Today view. It opens a text entry field where we can type a message and then sends that message to the other person’s phone as a critical alert. We no longer miss important messages from each other and a regular source of frustration no longer exists.
Critical alerts can be very useful, but many apps aren’t capable of using them, and even Apple’s Shortcuts app won’t let you use critical alerts. With Home Assistant, however, you can send critical alerts for any reason you want. By selecting different sounds, you can even know what the alert is about without having to look at your phone. This is a real game changer.


