DIY home alert system with Raspberry Pi. via raspberrypi
Last year Andre Pawlowski started work on a home security project. A friend of his had been burgled, and he thought an open-source client/server DIY home alarm system would be a good idea.
“The only solutions I found were limited to just one device. For example one solution for the Raspberry Pi only works locally with components that are directly connected to the Raspberry Pi itself. I wanted a client/server based structure which can be easily extended by just adding a new client to it. I did not found anything like it, so I had to write it myself.”
Andre ended up with a system called alertR that he calls a “unified alerting system” which works with the client/server model he wanted. But why stop there? AlertR has gone a long way since its beginnings as a home alarm system; he’s integrated it with other systems in the house to the point where it’s become a complete home automation and notification system. So it can act as a watchdog to check your online services are running, tell you the doorbell is ringing when you’re playing music that’s so loud you can’t hear it, turn your devices on and off to order, alert you when a water leak sensor is triggered, monitor your smoke alarm, tell you if your server is pingable, watch to see whether the door and windows are open – there’s no limit to what you can add to the system. Andre says:
“I looked into some commercial home alarm systems. All of them (at least the ones I looked into) had the same problem: they are limited to a count of x sensors to handle. alertR is logically not limited to a maximum count of sensors it can handle. Of course, it will be eventually reach a limit of resources at some point or the maximum value the database can store as an ID. At the moment my instance handles 6 clients with 16 sensors and is not even close at being at its full capacity.”
Best of all, the system also incorporates an events-driven rules engine. The engine means you can chain rules together so you can have a sequence of rules which have to be fulfilled in a specific order and in a specific time frame. One rule can consist of different rule elements that are bound together by a boolean operator.
Doesn’t make sense? Let’s imagine that every morning, you like to listen to a particular radio station throughout the house while you’re getting ready for work; but your start time varies, and on some days you might not be at home at all. This means that triggering your media centre to start playing at the same time every morning won’t work (although it can do that too, if you want it to). Instead, the system can watch for things that you do every time you get ready – opening a specific drawer in your bedroom within a certain number of seconds of turning the kettle on in the kitchen, say – and turn on the media centre, tuned to the right channel, when those rules are satisfied. Speakers in every room? The system can use a PIR sensor to tell which one you’re in, and move the music around the house to follow you.
The system comes with a nice notification client, so you can see what’s going on in your house using your mobile device.
It’s also configured so you can have alerts pop up on other devices you might be using. There’s integration with Kodi (which was still XBMC when this was being developed) for notifications; here’s a video to demonstrate. (Please turn the captions on again.)
Each Friday is PiDay here at Adafruit! Be sure to check out our posts, tutorials and new Raspberry Pi related products. Adafruit has the largest and best selection of Raspberry Pi accessories and all the code & tutorials to get you up and running in no time!