Home security systems are expensive and often come with ongoing costs, but smart home technology has never been more affordable or accessible. Though pricey alarm systems still have their place, I figured I could use sensors and automations to throw something together on the cheap.
The level of flexibility you get with such a system gives you a huge degree of freedom to design something that works for you. Here’s what I did.
How It Works
The whole system is powered by Home Assistant, a free and open-source smart home platform. Home Assistant runs on dedicated hardware like an old laptop or a Raspberry Pi, works offline, and is compatible with a huge range of smart home gadgets, including the all-important sensors that make this system work.
In my case, there are only a few entry points to the house where an intruder is likely to enter. I’ve got doors at the front and the back of the house, each of which has separate screen doors between them and the outdoors. In addition, I have casement windows with relatively small individual panes of glass. The windows are made from hardwood, since the house itself is getting on for 100 years old.
The main method of forced entry would be to open these doors or windows. Smashing the glass would still require that the window be opened unless we’re being burgled by toddlers (and they’d probably never reach the sills anyway). Ergo, this gives me a simple solution to home security in the form of cheap door or window sensors. I’m also sticking one on the garage, which is separate from the main house.
The end goal is to trigger some sort of visual and audible alert when the sensors detect that a window or door has been opened at night or when nobody is in the house for a prolonged period. The benefit of this method is not having to rely on motion sensors, which can be easily triggered unintentionally by people getting up in the night or cats walking around the house.
What I’m Using for This
You can use virtually any door or window sensor that’s compatible with Home Assistant to accomplish this. I picked up a few IKEA Parasoll sensors ($15) out of curiosity, before quickly realizing they’d be perfect for such a project. Like similar products, they use a magnetic sensor to detect a change whenever the door or window is opened.
They take a single AAA battery, and the range of motion is fairly generous, so both elements don’t need to be lined up perfectly. There’s a red LED that fires whenever the sensor detects a change, which makes installation rather easy. They use Zigbee and work with Home Assistant’s Zigbee Home Automation (ZHA) integration via the Home Assistant Connect ZBT-1 Zigbee radio.
- Dimensions (exterior)
-
38.5 x 18 x 4,5mm
- Weight
-
4g
Add Zigbee or Thread compatibility to your Home Assistant server using the ZBT-1, previously known as the SkyConnect. While multi-protocol support has been tested, the dongle has proven to be most reliable when running one or the other (so you can always buy two to add both).
What I’m triggering when the sensors detect a door opening is still a work in progress. For starters, I’ve got a HomePod that’s hooked up to Home Assistant through which I can play an alarm alert. My iPhone is linked to Home Assistant via the mobile app, so I can get notifications. I’ve got lots of connected lights, so I can trigger those too.
This is only the beginning. In time, I’d like to add a proper siren to the setup and maybe some sort of flashing alert light. When the time comes, I’ll be able to tweak my existing setup to account for such additions.
Writing the Automation
One of the biggest benefits of Home Assistant is its powerful automation system. This allows you to take several inputs, apply conditions to those inputs, and then fire off whatever actions you’d like to trigger. Being able to flesh out an automation by using building blocks is what gives this system the edge over platforms like Apple Home.
The first thing to do is define “When” triggers. You can do this from your main Home Assistant interface under Settings > Automations & scenes using the “Create automation” button. I used the “Add trigger” button to add “Device” triggers for all the sensors I wanted to use in the “open” position.
You can define a specific duration that the doors should be open if you want, but I left the trigger as instant. You can also add an “And Ii” condition, which qualifies the trigger. So, for example, you could use the “And If” condition to only trigger the automation between certain hours of the day, or based on some other condition of your choosing.
I left this blank, since I wanted to be able to arm and disarm the system manually. Our household has some erratic hours, which include regular early starts and occasional late nights. I didn’t want to chance false triggers at antisocial hours, but I can always change my mind at a later date.
Finally, there are the “Then do” actions. This is where you decide what should happen in the event of your sensors being triggered (read: a break-in). I decided to trigger a scene that turns on the lights, set my HomePod’s volume to 70%, and play the obnoxious alarm tone from Half-Life 2. A proper siren would give me more control and probably be a better deterrent, but this is all proof of concept right now.
You can play with this formula to your heart’s content. Add more smart speakers (if you have them), set a repeat condition so that your alarm tone repeats forever, and add mobile notifications to devices of your choosing.
Arming, Disarming, and Muting the System
To arm the system, all you need to do is turn on your automation under the Settings > Automations and scenes menu via the “Automations” tab. To disable it, just turn it off. To stop the alarm once it’s been triggered, turn off the automation (yes, this will kill whatever sound you’ve told it to play on your smart speakers).
How you interact with Home Assistant really depends on how you decide you want to arm and disarm your alarm, as does your daily routine. Arguably, the easiest way to do it is to tie it to a scene. For example, you probably have a “Goodnight” scene that turns off all the lights at night. You can add your alarm automation under “Entities” and set its state to “On” so that it comes on when you go to bed.
You also need to deactivate it in the morning. The easiest way to do this is to create a new automation that runs at a certain time of day. If you have a smart home control panel, you can add a handy toggle to that. If you use a voice assistant, you can use that. You could use an NFC tag on your way out, or anything else you can think of.
Personally, I’ve gone a slightly different route. I primarily use Apple Home to interact with Home Assistant, so I’ve exposed my Automation using the HomeKit Bridge integration as a switch within Apple Home. I can toggle the automation (and thus the alarm “system”) on and off by toggling this switch. I can include this in my Apple Home routines too, which means saying “Siri, Goodnight,” turns on the alarm and turns out the lights.
Doing this means that I can use Apple’s Shortcuts app to also disable the alarm automatically. I’ve got a failsafe set in Home Assistant so that the alarm turns itself off at 7 am to account for lie-ins, but I’ve also created a personal automation that runs a Shortcut to turn off the system when my iPhone alarm is turned off. You can add this to every family member’s iPhone, so that whenever they get up for an early start, the alarm will be deactivated before they’re even out of bed.
Having my security automation exposed in Apple Home also gives me one more super helpful control: being able to turn it off. Since Home Assistant kills the actions you’ve triggered when you turn the alarm off, I can hit a button to restore peace and quiet. I can also switch it on or off when I’m away from home.
Not a One-Size-Fits-All Solution
Not only is this setup a work in progress (Half-Life 2 alarm noises, seriously), it’s also tailored to my own house. The windows in my place aren’t ideal for climbing through, even if you smash them first. Many homeowners cannot say the same. A vibration sensor stuck to larger panes of glass might be a good workaround, and some smart speakers can even recognize the sound and potentially give you a trigger.
Another thing to consider is electricity. Not everyone’s fuse box is locked up, and if would-be thieves cut power to the house first, then your system won’t work as intended (the same is true for power outages). This is also the case for many professional alarm systems, though suppliers often have pricey failsafes for such occasions. An uninterruptible power supply hooked up to your server and network equipment might be a good idea, since you’ll at least get mobile notifications (but no lights or sound).
This also isn’t a high-end system that automatically calls emergency services or a security company on your behalf. It’s a “better than nothing” hobby project that you can use to better understand what’s possible in Home Assistant.
There are so many other possibilities for building an alarm system with Home Assistant. I don’t have any cameras rigged up yet, but you could absolutely use object recognition as a trigger for a similar purpose. Then there’s motion and presence detectors, vibration detectors, pressure pads, and much more.