7 min read

Boost Your Home Security with These Home Assistant Automations

Table of Contents

I always felt a little uneasy paying a monthly subscription for a home security system that felt disconnected and basic. I wanted more control and smarter notifications, without the recurring fees. I was already running Home Assistant for my smart lights, and it hit me: why not build my own powerful, custom DIY security system? It turned out to be easier than I thought, and now I have a system that’s tailored perfectly to my family’s needs. Here’s how you can do it, too.

Safety First: Digital and Physical Precautions

This project is mostly software-based, but good habits are key to keeping your system secure and reliable.

  • Secure Your Network: Your smart home is only as secure as your Wi-Fi. Use a strong, unique password for your network and consider creating a separate guest network for visitors.
  • Use Strong Passwords: For your Home Assistant instance, use a long, complex password that you don’t use anywhere else.
  • Plan for Power Outages: Your system can’t protect you if it’s offline. Consider plugging your Home Assistant server and Wi-Fi router into an Uninterruptible Power Supply (UPS).
  • Check Local Regulations: If you plan to use an audible siren, check your local noise ordinances and any rules about false alarms.

Tools & Materials

This setup is flexible, but here’s a great starting point.

Hardware:

  • Home Assistant Server: A Raspberry Pi 4/5, an old laptop, or a dedicated device like a Home Assistant Green.
  • Zigbee or Z-Wave Coordinator: A USB dongle (like a Sonoff or Zooz stick) to allow your sensors to talk to Home Assistant.
  • Door & Window Sensors: These are the backbone of your system. I recommend Zigbee sensors from brands like Aqara or Sonoff for their affordability and reliability.
  • Motion Sensors: To detect movement in key areas. Again, Zigbee models are a great choice.
  • (Optional) Smart Siren: For an audible deterrent.
  • (Optional) Smart Plugs/Lights: To create visual alerts.

Software:

  • Home Assistant: The free and open-source software that will run your system.
  • Home Assistant Mobile App: For receiving critical notifications on your phone.

Project Prep: Setting the Foundation

Before you can build automations, you need a solid base.

  1. Install Home Assistant: If you haven’t already, get Home Assistant running on your chosen hardware. The official website has excellent guides for every platform.
  2. Set up the Coordinator: Plug in your Zigbee or Z-Wave USB stick and install the corresponding integration in Home Assistant (e.g., ZHA or Zigbee2MQTT). This is how Home Assistant will communicate with your sensors.
  3. Pair Your Sensors: Follow the instructions for your sensors to put them into pairing mode. In Home Assistant, go to your Zigbee/Z-Wave integration and start the discovery process. Give each sensor a clear, descriptive name (e.g., “Front Door Sensor,” “Living Room Motion Sensor”) as you add it.
  4. Install the Mobile App: Download the Home Assistant Companion App on all relevant phones and set up the notifications component. This is crucial for getting alerts.

Step-by-Step Guide: Building Your Security Automations

This is where the magic happens! We’ll create a few core automation routines. In Home Assistant, go to Settings > Automations & Scenes to get started.

1. The “Away” Mode Automation

This automation arms the system when the last person leaves the house.

  • Trigger: When the state of your zone.home entity (which tracks people) changes from a number greater than 0 to 0. This means the house is empty.
  • Condition: (Optional) You can add a condition that this only runs during certain hours if you like.
  • Action:
    1. Call a service: notify.mobile_app_your_phone with the message “Away mode armed. The house is now protected.”
    2. Set a helper: We’ll need a “toggle” helper to track the alarm state. Create one at Settings > Devices & Services > Helpers. Call it “Alarm Armed”. The action here is to turn input_boolean.alarm_armed to “On”.

2. The Intrusion Alert Automation

This is what happens when a sensor is tripped while the system is armed.

  • Trigger:
    • Trigger 1: Front Door Sensor state changes to “On” (or “Open”).
    • Trigger 2: Living Room Motion Sensor state changes to “On” (or “Detected”).
    • …add a trigger for every security sensor.
  • Condition: The input_boolean.alarm_armed helper must be “On”. This ensures the alarm only goes off when you’ve armed it.
  • Action: This is where you decide what happens!
    1. Critical Notification: Use notify.mobile_app_your_phone to send a critical alert that bypasses Do Not Disturb.
      • Message: {{ trigger.to_state.attributes.friendly_name }} detected! Intrusion alert!
      • Title: 🚨 HOME SECURITY ALERT 🚨
      • Data: push: { sound: { critical: 1, name: 'default', volume: 1.0 } }
    2. Visual Alerts: Turn all lights in the house red and make them flash. You can create a scene for this and simply call the scene.turn_on service.
    3. Audible Alert: If you have a smart siren, call the service to turn it on.

3. The “Disarm” Automation

You need a way to turn it all off when you get home.

  • Trigger: When the state of zone.home changes to a number greater than 0 (someone has arrived).
  • Condition: The input_boolean.alarm_armed helper is “On”.
  • Action:
    1. Call a service to turn input_boolean.alarm_armed to “Off”.
    2. Call a service: notify.mobile_app_your_phone with the message “Welcome home! Alarm disarmed.”
    3. Turn off the flashing lights or siren if they were activated.

Finishing Touches & Cleanup

Your core system is now active, but a little polish makes a world of difference.

  1. Create a Dashboard: Build a simple dashboard in Home Assistant. Add a button to manually toggle your input_boolean.alarm_armed helper. You can also add badges for each of your door/window sensors to see their status at a glance.
  2. Test Everything: This is the most important step. Arm the system and purposefully open a door. Does your phone get the alert? Do the lights flash? Walk back into the house. Does it disarm correctly? Fine-tune the automations until they are 100% reliable.
  3. Presence Simulation: For an advanced touch, create a vacation mode. When you’re away for an extended period, have an automation that turns various lights on and off in the evening to simulate presence, making your home a less attractive target.

Conclusion

You’ve just built a smart, personalized, and subscription-free home security system. The beauty of using Home Assistant is its endless customizability. You can add cameras, smart locks, or even integrate it with your smoke detectors. You now have more than just an alarm; you have a responsive smart home that actively works to keep you safe and informed. Enjoy the peace of mind