How I Secured My Home Using Home Assistant - Part One

How I Secured My Home Using Home Assistant - Part One
Photo by Pixabay on Pexels.com

I’m going to say something that might be unpopular…Residential Monitored Security Systems are a waste of money. Don’t @ me.

Just kidding. If you think I am wrong I would love to hear why. Because I might actually be wrong. But before you do let me bring you up to speed on my thought process.

There is a lot to talk about so I have broken this down in to two parts. Part One covers my approach to designing this system, and how I secure the house. Part Two covers security breaches and how the system is disarmed.

So let’s jump in to Part One and why I walked away from Monitored Security Systems.

How Monitored Security Systems Work

Monitored security systems are sold as protection for your home. And I guess you can make that argument because you are paying a call center to “watch” your house 24/7. But I don’t think the call center has super power that can actually influence the outcome of whatever is going down.

What follows is not meant to be an exact representation of the process just a high level of what is happening.

The call center you pay to watch your house gets alerted when your system gets tripped. Then in order to cut down on legitimate “intrusions” there is typically a countdown before it actually sends an intrusion signal. Security systems vary on how they implement this, but at its most basic everyone gets a set amount of time, 60 to 180 seconds or so, to enter the disarm code.

If the disarm code is not entered in time the monitoring center then gets a signal and has another set of procedures to figure out if its a false alarm. They typically do this by calling the numbers they have and talking to the home owner. If after a period of time they haven’t reached you they call the local police to report a possible break-in and a police car is dispatched.

Then it takes some time for the police to get to your house. According to various sources on the internet I found the national US average for police response was 11 to 18 minutes. And because this is a “possible” burglary that car might have more pressing matters to attend to. So from the time someone enters my home plus the 3-4 it takes for the call center to get and verify your signal plus the 11 to 18 mins it takes the police to arrive anywhere from a total of 14 to 21 minutes has passed in the best case.

Another Google search revealed that the FBI says the average time it takes a home burglary to happen is 8 to 10 minutes. In that amount of time someone can take a lot of stuff and be gone by the time someone responds. And if I happen to be home at the time. Well, I just cut 3-4 minutes off the call to the police, and I can personally respond. And if I am not home, chances are pretty high that if I call the police to report a break-in I may take a police car away from saving lives on the chance someone might have taken some stuff I can replace tomorrow.

You might have other reasons that I haven’t considered so if I missed something let me know. But all of this makes me not see the value in paying for a service that has a low chance of actually changing the outcome in a degree that matters.

Human Security is the Priority

With the flaws I see in monitored security I decided to save my money and prioritize for protecting my family and not my stuff. So I built my security system with the following guiding principles:

  1. If we are home, notify us as soon as possible, so we can get out of harms way. Wake everyone up if its night, and in every case let the house know the security system got tripped.
  2. If we are not home, collect as much evidence as to what happened and archive it.

And if you didn’t know already Home Assistant is perfect for the job. My system relies heavily on presence detection, and of course you will need sensors on your doors. 

Activating Barn Door Protocol

I have a whole package dedicated to security, and you can find it in the packages folder aptly named security.yaml.

In this single file you will find all the switches, or input booleans in this case, sensors that include doors and motion, automations, and scripts. There is a lot in this file, and there is a lot that most people may not need. And to be honest this used to be a way crazier. I’m not going to cover everything in this file, but I will hit the important bits for those that want to use Home Assistant to secure their Home.

There are three ways the security system is armed.

  1. Armed (Home)
  2. Voice Command
  3. Armed (Away)

Armed – Home (Automatically)

Arming the system we are home uses the input boolean called sentry_mode and you will find it at the top of the file.

input_boolean:
  sentry_mode:
    name: Sentry Mode
    icon: mdi:security

It gets flipped on every night via an automation that goes off at a set time. This is meant to be a “last chance” catch to ensure that if we haven’t armed the house then it needs to be armed.

- id: nightly_lockdown
    alias: Nightly Lockdown
    initial_state: true
    trigger:
    - platform: time
      at: '23:00:00'
    condition:
    - condition: state
      entity_id: person.jeffrey
      state: home
    - condition: state
      entity_id: person.katherine
      state: home
    - condition: state
      entity_id: input_boolean.guest_mode
      state: 'off'
    - condition: state
      entity_id: input_boolean.sentry_mode
      state: 'off'
    action:
    - service: script.lockdown
    - delay:
        seconds: 2
    - service: script.security_check_failed

This automation checks to make sure everyone is home, and guest mode is off. This is what you would called “Armed – Home.” If all of that is true it initiates the lockdown script.

lockdown:
    sequence:
    - condition: state
      entity_id: group.external_doors
      state: "off"
    - service: input_boolean.turn_on
      entity_id: input_boolean.sentry_mode

This script simply checks to make sure all the doors are closed then “arms” the security.

Then after a delay of 2 seconds it fires another security_check_failed. This second script simply allows me to check to see if doors are open and if they are it notifies us that the system was unable to arm.

security_check_failed:
    sequence:
    - condition: state
      entity_id: group.external_doors
      state: "on"
    - service: script.ah_report
      data:
        call_issue: 1
        speech_message: >
            {{ [
            "I was unable to activate barn door protocol due to an open door.",
            "You may want to check the external doors. I was unable to secure them all.",
            "My systems check has failed. Please check the external doors.",
            "Someone has left the pod bay doors open."
            ] | random }} 

This is a good time to point out in the following scripts I show throughout this article you will see two different services used for audible notifications. They essentially do the same thing except for a minor difference. The one here is script.ah_report and it broadcasts announcements on the main house audio system when everyone is awake, but once people start going to sleep it switches to just using the Google Home devices which are in located in areas of the house that wouldn’t contain sleeping people. It is meant for more informational notifications and it can be silenced completely if needed. The other is script.jarvis_alert and it has no conditions. It is meant for urgent or critical messages that is broadcast through the house no matter the time of day. It cannot be silenced.

I have a plan to break down the spoken notifications in a more detailed post, but for now that distinction will have to do.

Armed – Home (Voice)

Sometimes we want to armed the security before the automatic time. I have also setup some Alexa that can arm the system via voice command.

Saying “Alexa, activate barn door protocol”, or “Alexa, raise the shields,” tells Alexa to execute the script Activate Barn Door Protocol:

activate_barn_door_protocol:
    sequence:
    - service: script.ah_report
      data:
        call_confirmation: 1
    - delay:
        seconds: 2
    - service: input_boolean.turn_on
      entity_id: input_boolean.sentry_mode
    - delay:
        seconds: 2
    - service: script.security_check_failed

This one simply responds audibly to the command (this is to make it more like J.A.R.V.I.S.) and turns on sentry mode. Then waits two seconds and executes script.security_check_failed that was referenced above.

You may also be asking if the system gets armed when guest mode is on. Why yes it does, but it simply requires us to manually do that. Eventually it won’t need to do that

Armed – Away

Armed Away works in a similar fashion, but it is based on presence detection. This one uses multiple presence sensors to track all the people coming and going. But the main backbone of my presence detection is the Life360 integration. If you are not using this and you are having issues with presence detection adding it to Home Assistant may change your life.

I am not going to detail the presence detection triggers because those are going to be different for everyone. If you want to see what I do you can always check out the presence.yaml in my packages folder. It just your general automation that fires when state changes on the presence sensors.

The basic gist is once everyone leaves a series of security scripts are executed to ensure the house is locked up and ready to respond to intrusion.

First we check to make sure all the doors are closed, and if not we turn on the lockdown issue input boolean. This is done via two different scripts.

security_check_garage:
    sequence:
    - condition: state
      entity_id: binary_sensor.garage_door
      state: 'on'
    - service: input_boolean.turn_on
      entity_id: input_boolean.lockdown_issue

and

security_check_zones:
    sequence:
    - condition: state
      entity_id: group.doors
      state: 'on'
    - service: input_boolean.turn_on
      entity_id: input_boolean.lockdown_issue

These could be handled by one, but I plan on having different actions to follow the lockdown issue switch being turned on and just haven’t gotten to it. Most of those additions will involve removing manual steps. For example, Home Assistant can just close the garage if we leave and it is still open.

Anyway, turning on input_boolean.lockdown_issue activates and alert that pings our phones every 2 mins to get our attention.

If both of those conditions are false, then nothing happens and script.lockdown shown above turns on sentry mode. As a backup script.lockdown_issue also runs:

lockdown_issue:
    sequence:
    - condition: state
      entity_id: group.external_doors
      state: "on"
    - condition: state
      entity_id: sensor.family_status
      state: "Away"
    - service: input_boolean.turn_on
      entity_id: input_boolean.lockdown_issue
    - service: script.text_notify
      data_template:
        title: "Lockdown Issue!"
        message: "Doors are open and it appears everyone has left!"

This one simply sends yet another text message if we are gone and the doors are open. This might be overkill, but I want to make sure everyone knows there is an issue that prevented the system from being armed. This allows us to address it before we get too far from the house.

So now, the system is armed, so what happens if it is tripped? Head over to Part Two of this series to get the rest of the story.

Until then…Go Automate Something.

Mastodon