Home Security System Notifications to the Apple Watch
If you're one of those people who are tired of getting up and roaming the house with a baseball bat during the wee hours of the night to check on "noises" that your wife "thinks she hears", this may be a good solution to keep you in bed.
Our home came with a security system that can be set to ding the alarm whenever a door is opened. But what if it could do more than just ding? What it if could send a push notification to your iPhone, or Apple Watch? I set out to make this happen.
Basic Ingredients
There are only two basic Ingredients to this project to make it work, although I extend it later with more:
- An AlarmDecoder AD2PI — This is a raspberry pi with a secondary board to interpret signals from the alarm unit itself
- Pushover — An API for push notifications to iOS devices, Android devices, the Apple Watch, and even desktops
The AlarmDecoder basically pretends to be another key panel and can be used to set the alarm via a computer or phone, and it can be configured to take action on various door or motion sensor "faults" as well. It was easy to install (only four wires), and setup was more or less listing out what each zone means (front door, back door, etc). You can then assign an action for a fault on any of the zones. The stock AlarmDecoder software allows for a few default actions, including a POST or GET, or even direct hit to Pushover.
We could leave it at this and have a perfectly functional mobile alarm. But where’s the fun in that?
Extending the setup
Having the Apple Watch notify me of open doors is great, but it can get annoying when I’m the one opening the doors. So there needs to be a bit of extra logic driving the decision of when to send these push notifications.
Step one was to extend this setup by placing a web service after the AlarmDecoder, which let me add extra notification systems and logic to drive them. The AlarmDecoder works by creating a POST to this web service for every zone fault, and the service determines the appropriate action. Currently, it’s configured to send a pushover alert for open doors and window breakage, and Growl and Slack alerts for everything, including motion sensor activity. Every alert is logged as well.
A temporary pause to the push notifications happens via a specially crafted call to the web service which sets a timer at a specified number of minutes in the future. For example, a 5 minute delay would simply set the timer to “now” + 5 minutes. Before sending pushover alerts, it checks to see if “now” is after whenever that timer was set to be. Passing in a negative number resets it to “now”, basically ending the delay early. This delay can quickly be set via a Workflow action from the phone.
But what about preventing alarms while I’m home? That's where the iOS app Locative (IFTTT could have been used as well) comes in. By creating a tight geofence around the house, I can automatically trigger a web service call when I (or rather, my phone…but, really, what’s the difference?) come home or leave. When I arrive, it starts a few-minute delay, so I’m not bombarded with alerts when I open the doors to get in, let the dogs out, carry groceries in, etc. When I leave, the delay is ended, activating the alerting system immediately.
The code for this web service can be found on GitHub.
How well does it work?
It works great! It’s good to know that my watch and phone will alert me for any alarm activity while I’m away, and even when I’m home. At night, I can glance at the phone and feel confident no doors have been opened.