Push Notifications - addycakes/Domotics GitHub Wiki

To setup Apple Push Notifications Service (APNS) between the raspberry pi and an iOS device you need to first configure an Xcode project for push notifications and install a service on the pi to send notifications.

I followed Ray Wenderlich's excellent guide on configuring an app for APNS and used this python library by djacobs to send notifications.

One tip for once the app is all setup for remote notifications; place this line

    [[UIApplication sharedApplication] registerForRemoteNotifications];

in the didFinishLaunchingWithOptions method of AppDelegate.m to call didRegisterForRemoteNotificationsWithDeviceToken and get your device token, which is needed by PyAPNS to send the notification to your phone.

For PyAPNS, you need the separate cert and key .pem files, so skip those steps of Ray's guide. Once you have the .pem files created and the app setup, all that is left is to put the .pem files on the raspberry pi and write a script to test it out.

The trick I found to making it work without any user interaction is to not use a password during the creation of the .pem key file, or remove it after the fact if you already entered one.

Here is a program I use to send a notification when a door is opened when nobody is home.

⚠️ **GitHub.com Fallback** ⚠️