mobile_app notify platform accepts the standard
target parameters used by the notify platform. The mobile_app notify platform supports targets as services. As long as you granted notifications permissions during setup, you will find all your devices listed as targets for the notify service with names prefixed
notify.mobile_app_ followed by the Device ID of you device. This can be checked in the App Configuration menu of the sidebar and defaults to the name specified in the General>About within the iOS settings app or under About>Phone in Android settings (with spaces and non alphanumeric characters replaced by underscores). A requirement of the notify platform is that you must specify at least
message: in your payload. A minimum working example of a notification is:
The mobile_app platform provides many enhancements to the simple notification generated above. The image below, for example, shows an iOS actionable notification allowing you to trigger different automations from each button.
Enhancing basic notifications
By default the default iOS notification sound (Tri-tone) will be played upon receiving a notification. See the Sounds documentation for details of the available sounds and how to add custom sounds. The default notification sounds (Tri-tone) can be disabled by setting
none in the data payload:
You can set the app icon badge in the payload. The below example will make the app icon badge say 5:
By setting the message to
delete_alert you can silently update the app badge icon in the background without sending a notification to your phone.
A subtitle is supported in addition to the title:
Thread-id (grouping notifications)
Grouping of notifications is supported on iOS 12 and above. All notifications with the same thread-id will be grouped together in the notification center. Without a thread-id, all notifications from the app will be placed in a single group.
Existing notifications can be replaced using
apns-collapse-id. This will continue to send you notifications but replace an existing one with that same
apns-collapse-id. When sending consecutive messages with the same
apns-collapse-id to the same device, only the most recent will be shown. This is especially useful for motion and door sensor notifications.
For Android users you can easily replace the notification using the
tag service data.
You can also remove a notification by sending
clear_notification to the same
Sending notifications to multiple devices
To send notifications to multiple devices, create a notification group:
Now, you can send notifications to everyone in the group using. If you plan to group Android and iOS devices only
title will work:
Controlling how a notification is displayed when in the foreground
By default, if the app is open (in the foreground) when a notification arrives, it will display the same as when the app is not active (in the background), with a visual alert showing notification contents, a badge update (if one was sent in the notification) and the sound of your choice. You can control how a notification is displayed when the app is in the foreground by setting the
presentation_options string array. Allowed values are
In Android you can set the
color of the notification, you can use either the color name or the hex code.
You can set whether to dismiss the notification upon selecting it or not. Setting
'true' will keep the notification from being dismissed when the user selects it. Setting it to
'false' (default) will dismiss the notification upon selecting it.
Notification click action
When a notification is selected the user can either be navigated to a specific lovelace view or you can have a webpage open to any URL. If you plan to use a lovelace view the format would be
test is replaced by your defined
path in the defined view. The default behavior is to just open the Home Assistant app.
Notification channels allows users to separate their notifications easily (i.e. alarm vs laundry) so they can customize aspects like what type of sound is made and a lot of other device specific features. Devices running Android 8.0+ are able to create and manage notification channels on the fly using automations. Once a channel is created you can navigate to your notification settings and you will find the newly created channel, from there you can customize the behavior based on what your device allows.
In order to create a notification you will need to specify the
channel you wish to use. By default all notifications use
Default Channel if
channel is not defined.
In the example below a new channel will be created with the name
If you wish to remove a channel you will need to send
remove_channel with the
channel you wish to remove: