
* Sets front matter defaults * Removes default front matter from section templates/pages * Removes default front matter from addon pages * Removes default front matter from integration pages * Removes default front matter from posts * Removes default front matter from docs pages * Removes default front matter from other pages * Fixes blog category pages
2.9 KiB
title | description | logo | ha_category | ha_release | redirect_from | ||
---|---|---|---|---|---|---|---|
APNS | Instructions on how to add APNS notifications to Home Assistant. | apple.png |
|
0.31 |
|
The apns
platform uses the Apple Push Notification service (APNS) to deliver notifications from Home Assistant.
Setup
To use the APNS service you will need an Apple developer account and you will need to create an app to receive push notifications. For more information, see the Apple developer documentation.
Configuration
To enable APNS notifications, add the following lines to your configuration.yaml
:
# Example configuration.yaml entry
notify:
name: NOTIFIER_NAME
platform: apns
cert_file: cert_file.pem
topic: topic
{% configuration %}
name:
description: he name of the notifier. The notifier will bind to the service notify.NOTIFIER_NAME
.
required: true
type: string
cert_file:
description: The certificate to use to authenticate with the APNS service.
required: true
type: string
topic:
description: The app bundle ID specified in the certificate.
required: true
type: string
sandbox:
description: If true notifications will be sent to the sandbox (test) notification service.
required: false
default: false
type: boolean
{% endconfiguration %}
The APNS platform will register two services, notify.NOTIFIER_NAME
and notify.apns_NOTIFIER_NAME
.
notify.apns_NOTIFIER_NAME
This service will register device IDs with Home Assistant. In order to receive a notification a device must be registered. The app on the device can use this service to send an ID to Home Assistant during startup, the ID will be stored in [NOTIFIER_NAME]_apns.yaml
.
See didRegisterForRemoteNotificationsWithDeviceToken
in the Apple developer documentation for more information about how to obtain a device ID.
notify.NOTIFIER_NAME
This service will send messages to a registered device. The following parameters can be used:
-
message: The message to send.
-
target: The desired state of the device, only devices that match the state will receive messages. To enable state tracking a registered device must have a
tracking_device_id
attribute added to the[NOTIFIER_NAME]_apns.yaml
file. If this ID matches a device inknown_devices.yaml
the device state will be tracked. -
data:
- badge: The number to display as the badge of the app icon.
- sound: The name of a sound file in the app bundle or in the Library/Sounds folder.
- category: Provide this key with a string value that represents the identifier property of the
UIMutableUserNotificationCategory
. - content_available: Provide this key with a value of 1 to indicate that new content is available.