|
| 1 | +--- |
| 2 | +layout: page |
| 3 | +title: "APNS" |
| 4 | +description: "Instructions how to add APNS notifications to Home Assistant." |
| 5 | +date: 2015-06-22 10:00 |
| 6 | +sidebar: true |
| 7 | +comments: false |
| 8 | +sharing: true |
| 9 | +footer: true |
| 10 | +ha_category: Notifications |
| 11 | +ha_release: pre 0.7 |
| 12 | +--- |
| 13 | + |
| 14 | + |
| 15 | +The `APNS` platform uses the Apple Push Notification service (APNS) to deliver notifications from Home Assistant. |
| 16 | + |
| 17 | +To use the APNS service you will need an apple developer account |
| 18 | +and you will need to create an App to receive push notifications. |
| 19 | +For more information see the apple developer documentation. |
| 20 | + |
| 21 | +```yaml |
| 22 | +# Example configuration.yaml entry |
| 23 | +notify: |
| 24 | + name: NOTIFIER_NAME |
| 25 | + platform: apns |
| 26 | + sandbox: true or false |
| 27 | + cert_file: cert_file.pem |
| 28 | +``` |
| 29 | +
|
| 30 | +Configuration variables: |
| 31 | +
|
| 32 | +- **name** (*Required*): The name of the notifier. The notifier will bind to the service `notify.NOTIFIER_NAME`. |
| 33 | +- **sandbox** (*Optional*): If true notifications will be sent to the sandbox (test) notification service. |
| 34 | +- **cert_file** (*Required*): The certificate to use to authenticate with the APNS service. |
| 35 | + |
| 36 | + The APNS platform will register two services, `notify.NOTIFIER_NAME` and `apns.NOTIFIER_NAME`. |
| 37 | + |
| 38 | +### apns.NOTIFIER_NAME |
| 39 | + |
| 40 | +This service will register device id's 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 the [NOTIFIER_NAME]_apns.yaml. |
| 41 | + |
| 42 | +See didRegisterForRemoteNotificationsWithDeviceToken in the apple developer documentation for more information about how to obtain a device id. |
| 43 | + |
| 44 | +### notify.NOTIFIER_NAME |
| 45 | + |
| 46 | +This service will send messages to a registered device. The following parameters can be used: |
| 47 | + |
| 48 | +- **message**: The message to send |
| 49 | + |
| 50 | +- **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 in known_devices.yaml the device state will be tracked. |
| 51 | + |
| 52 | +- **data**: |
| 53 | + * **badge**: The number to display as the badge of the app ic |
| 54 | + * **sound**: The name of a sound file in the app bundle or in the Library/Sounds folder. |
| 55 | + * **category**: Provide this key with a string value that represents the identifier property of the UIMutableUserNotificationCategory |
| 56 | + * **content_available**: Provide this key with a value of 1 to indicate that new content is available. |
0 commit comments