Introduction

The mobile_app notify platform accepts the standard title, message and 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:

automation:
- alias: 'Send Notification'
trigger:
...
action:
service: notify.mobile_app_<your_device_id_here>
data:
message: 'Notification text'

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. A push notification showing all of the basic options `title` and `message` as well as `subtitle` and actions.

Enhancing basic notifications

Notification Sounds

iOS 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 sound to none in the data payload:

automation:
- alias: Make some noise
trigger:
...
action:
service: notify.mobile_app_<your_device_id_here>
data:
message: "Ding-dong"
data:
push:
sound: none

Badge

iOS You can set the app icon badge in the payload. The below example will make the app icon badge say 5:

automation:
- alias: Notify Mobile app
trigger:
...
action:
service: notify.mobile_app_<your_device_id_here>
data:
title: "Smart Home Alerts"
message: "Something happened at home!"
data:
push:
badge: 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.

Subtitle

iOS A subtitle is supported in addition to the title:

automation:
- alias: Notify Mobile app
trigger:
...
action:
service: notify.mobile_app_<your_device_id_here>
data:
title: "Smart Home Alerts"
message: "Something happened at home!"
data:
subtitle: "Subtitle goes here"

Thread-id (grouping notifications)

iOS 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.

automation:
- alias: Notify Mobile app
trigger:
...
action:
service: notify.mobile_app_<your_device_id_here>
data:
title: "Smart Home Alerts"
message: "Something happened at home!"
data:
push:
thread-id: "example-notification-group"

Replacing notifications

iOS 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.

automation:
- alias: Notify of Motion
trigger:
...
action:
service: notify.mobile_app_<your_device_id_here>
data:
title: "Motion Detected in Backyard"
message: "Someone might be in the backyard."
data:
apns_headers:
'apns-collapse-id': 'backyard-motion-detected'

android For Android users you can easily replace the notification using the tag service data.

automation:
- alias: Notify of Motion
trigger:
...
action:
service: notify.mobile_app_<your_device_id_here>
data:
title: "Motion Detected in Backyard"
message: "Someone might be in the backyard."
data:
tag: tag

You can also remove a notification by sending clear_notification to the same tag

automation:
- alias: Notify of Motion
trigger:
...
action:
service: notify.mobile_app_<your_device_id_here>
data:
message: clear_notification
data:
tag: tag

Sending notifications to multiple devices

iOS android To send notifications to multiple devices, create a notification group:

notify:
- name: ALL_DEVICES
platform: group
services:
- service: mobile_app_iphone_one
- service: mobile_app_iphone_two
- service: mobile_app_ipad_one
- service: mobile_app_pixel_4_xl

Now, you can send notifications to everyone in the group using. If you plan to group Android and iOS devices only message and title will work:

automation:
- alias: Notify Mobile app
trigger:
...
action:
service: notify.ALL_DEVICES
data:
message: "Something happened at home!"

Controlling how a notification is displayed when in the foreground

iOS 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 alert, badge and sound.

automation:
- alias: Notify Mobile app
trigger:
...
action:
service: notify.ALL_DEVICES
data:
message: "Something happened at home!"
data:
presentation_options:
- alert
- badge

Notification color

android In Android you can set the color of the notification, you can use either the color name or the hex code.

automation:
- alias: Notify of Motion
trigger:
...
action:
service: notify.mobile_app_<your_device_id_here>
data:
title: "Motion Detected in Backyard"
message: "Someone might be in the backyard."
data:
color: '#2DF56D' # or 'red'

Sticky notification

android You can set whether to dismiss the notification upon selecting it or not. Setting sticky to '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.

automation:
- alias: Notify of Motion
trigger:
...
action:
service: notify.mobile_app_<your_device_id_here>
data:
title: "Motion Detected in Backyard"
message: "Someone might be in the backyard."
data:
sticky: 'true' # or 'false'

Notification click action

android 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 /lovelace/test where test is replaced by your defined path in the defined view. The default behavior is to just open the Home Assistant app.

automation:
- alias: Notify of Motion
trigger:
...
action:
service: notify.mobile_app_<your_device_id_here>
data:
title: "Motion Detected in Backyard"
message: "Someone might be in the backyard."
data:
clickAction: 'https://google.com' # action when clicking main notification

Notification Channels

android 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 Motion:

automation:
- alias: Notify of Motion
trigger:
...
action:
service: notify.mobile_app_<your_device_id_here>
data:
title: "Motion Detected in Backyard"
message: "Someone might be in the backyard."
data:
channel: Motion # name of the channel you wish to create or utilize

If you wish to remove a channel you will need to send remove_channel with the channel you wish to remove:

automation:
- alias: Notify of Motion
trigger:
...
action:
service: notify.mobile_app_<your_device_id_here>
data:
message: remove_channel
data:
channel: Motion # name of the channel you wish to remove