---
title: "Home Assistant as a security alarm: arming, entry delay and an alert when it goes off"
description: "Home Assistant’s built-in alarm panel, a front-door sensor and a presence sensor make a home alarm with an exit time, a disarm time on entry and a notification on your phone."
canonical: "https://realhomeautomations.com/en/projects/home-assistant-security-alarm-entry-delay/"
language: en-US
updated: 2026-11-25T15:20:11+00:00
---

# Home Assistant as a security alarm: arming, entry delay and an alert when it goes off

Home Assistant’s built-in alarm panel, a front-door sensor and a presence sensor make a home alarm with an exit time, a disarm time on entry and a notification on your phone.

> Canonical HTML page: https://realhomeautomations.com/en/projects/home-assistant-security-alarm-entry-delay/

- **Difficulty:** Intermediate
- **Build time:** 60–90 minutes
- **Reading time:** 5 minutes

## Tools required

- Home Assistant
- Door sensor (Sonoff SNZB-04PR1, one per door or window)
- Presence sensor (Sonoff SNZB-06P, USB-C power)
- Zigbee hub or adapter (or Home Assistant with a Zigbee adapter; not included in the product)
- Phone with the Home Assistant app (with notifications allowed)


## What readers will learn

- Make an alarm panel with an exit time and a disarm time on entry
- Connect the sensors to the triggering
- Get a notification on the wait and on the trigger


## Skill requirements

- Add a Zigbee device to Home Assistant
- Edit configuration.yaml and paste YAML into automations

## Project kit

- [Smart Door and Window Sensor Sonoff SNZB-04PR1 – Zigbee 3.0 Protocol, CR2477 Battery Powered, Real-Time Opening Alerts, eWeLink &#038; Home Assistant](https://realhomeautomations.com/en/product/smart-door-and-window-sensor-sonoff-snzb-04pr1-zigbee-3-0-protocol-cr2477-battery-powered-real-time-opening-alerts-ewelink-home-assistant/index.md)

You leave home and want to know that the front door can't be opened quietly. Home Assistant has a built-in model of an alarm system: arming, an entry delay and a notification when it goes off. Here we put it together with a door sensor and a presence sensor.

 ## What you will get

 An alarm panel in Home Assistant with "away" and "home" modes. With the door open in "away" mode the panel goes into a wait, gives you time to disarm it and, if you don't, sends a notification to your phone.

 ## What we need

- [Door sensor Sonoff SNZB-04PR1](https://realhomeautomations.com/bg/produkt/smart-door-and-window-sensor-sonoff-snzb-04pr1-zigbee-3-0-protocol-cr2477-battery-powered-real-time-opening-alerts-ewelink-home-assistant/): one for the front door; add one for each door or window you want to watch.
- [Sonoff SNZB-06P](https://realhomeautomations.com/bg/produkt/sonoff-snzb-06p-zigbee-presence-sensor/): one presence sensor in the hallway or the living room. It works on USB-C power, so it needs a nearby outlet.
- Home Assistant and a phone with the Home Assistant app.

 You need a Zigbee hub or Home Assistant with a Zigbee adapter.

- **Setup time:** about 60–90 minutes.
- **Skills:** you edit `configuration.yaml`, add Zigbee devices and paste YAML into automations.
- **Installation:** the sensors are stuck on, with no connection to mains voltage.
- **Siren:** we don't offer one. The notification on the phone is the only signal in this project. If you have your own siren, you can add it as an extra action.

 ## How it works

 The Manual alarm control panel integration is built into Home Assistant. It is a state machine. When arming, the panel first goes into `arming` for the time in which you leave. After that it is `armed_away` or `armed_home`. When triggered it goes into `pending`, you have time to disarm it, and only after that into `triggered`.

 Three settings determine the times: `arming_time` (exit time), `delay_time` (disarm time on entry) and `trigger_time` (how long it stays in the "triggered" state). The panel itself doesn't know what a door is. The sensors tell it "triggered" through an automation.

 The logic we use:

- The door opens in `armed_away` or `armed_home`: the panel triggers.
- Presence in the hallway is taken into account only in `armed_away`, because in `armed_home` we ourselves move around inside.
- When the state becomes `pending`, you get a notification, and when it becomes `triggered`, you get a second, more alarming one.

 Simeon uses Alarmo, installed through HACS, as the alarm panel, and only its "Armed away" mode. His phone gets a notification at the entry countdown, when the alarm goes off, when it is armed with a window open and when arming fails.

 ## Steps

- **Add the sensors.** Pair them through ZHA or Zigbee2MQTT. The door should give `binary_sensor` with the state `on` when open and `off` when closed. The presence gives `binary_sensor` with the state `on` when a person is detected. Write down their entity IDs.
- **Create the alarm panel.** Open `configuration.yaml` and add the block below. After changing the file, restart Home Assistant. The times are examples.

 ```
alarm_control_panel:
  - platform: manual
    name: Home Alarm
    unique_id: home_alarm_manual
    code: "1234"
    arming_time: 30
    delay_time: 30
    trigger_time: 60
    arming_states:
      - armed_away
      - armed_home
    armed_home:
      arming_time: 0
```

 You replace `1234` with your own code. The panel appears as `alarm_control_panel.home_alarm` and you can put it on the dashboard with an Alarm panel card.

- **Connect the sensors to the panel.** In Settings → Automations &amp; scenes create an automation, switch to Edit in YAML and paste the example. `binary_sensor.front_door_contact` and `binary_sensor.hallway_presence` are example names.

 ```
alias: "Alarm: trigger from door or presence"
mode: single
triggers:
  - trigger: state
    entity_id: binary_sensor.front_door_contact
    to: "on"
    id: door
  - trigger: state
    entity_id: binary_sensor.hallway_presence
    to: "on"
    id: motion
conditions:
  - condition: or
    conditions:
      - condition: trigger
        id: door
        # door: in both modes
      - condition: and
        conditions:
          - condition: trigger
            id: motion
          - condition: state
            entity_id: alarm_control_panel.home_alarm
            state: armed_away
  - condition: state
    entity_id: alarm_control_panel.home_alarm
    state:
      - armed_away
      - armed_home
actions:
  - action: alarm_control_panel.alarm_trigger
    target:
      entity_id: alarm_control_panel.home_alarm
```

- **Add the notifications.** A second automation sends a message when the state changes. `notify.mobile_app_telefon` is an example name; in Developer tools → Actions you find your own.

 ```
alias: "Alarm: notification on wait and on trigger"
mode: queued
triggers:
  - trigger: state
    entity_id: alarm_control_panel.home_alarm
    to:
      - pending
      - triggered
actions:
  - action: notify.mobile_app_telefon
    data:
      title: "Alarm"
      message: >
        {% if trigger.to_state.state == 'pending' %}
        Motion or an open door. Disarm the alarm.
        {% else %}
        The alarm has gone off.
        {% endif %}
```

 ## Checking the result

- **Arming.** From the panel choose "away". Then comes `arming` for 30 seconds, then `armed_away`.
- **Entry.** Open the door. The panel goes into `pending`, you get a notification. Enter the code within 30 seconds: there is no trigger notification.
- **Trigger.** Open the door and wait. After 30 seconds the second notification comes.
- **"Home" mode.** Walk around the hallway: presence does not cause a trigger.
- **Restart.** After a Home Assistant restart, check what the panel shows before you leave.

 ## If it doesn't work

- **The panel doesn't appear.** Check `configuration.yaml` with Developer tools → YAML → Check configuration and restart.
- **It triggers immediately, without a wait.** `delay_time` is 0 for the chosen mode. Check the state settings.
- **No notification comes.** Check in Traces whether the automation started, then the notification action in Developer tools → Actions.
- **Presence triggers on `armed_home`.** The automation is checked only for `motion` at `armed_away`: check the condition.
- **The sensor becomes `unavailable`.** The Zigbee sensor has lost connection; check the battery and the distance to the nearest mains-powered Zigbee device.

 ## Limitations and turning it off

- The system lives on your Home Assistant. If the server, the internet or the Zigbee network stops, the alarm and the notifications stop.
- A door sensor sees only the door it is stuck on. A window without a sensor is not watched.
- The notification comes through the Home Assistant app and depends on your phone.
- Turning off: switch the panel to "disarmed" with the code, or turn off the two automations from Settings → Automations.

 ## Sources and verification status

 The material follows the documentation of the manufacturers and of Home Assistant, read on 22.11.2026. The topic is from Simeon's list of ideas.

- [Home Assistant: Manual alarm control panel](https://www.home-assistant.io/integrations/manual/), 22.11.2026
- [Home Assistant: automations, triggers](https://www.home-assistant.io/docs/automation/trigger/), 22.11.2026
- [Home Assistant: Companion App, notifications](https://companion.home-assistant.io/docs/notifications/notifications-basic), 22.11.2026
- [Home Assistant: Zigbee Home Automation](https://www.home-assistant.io/integrations/zha/), 22.11.2026
- Real Home Automations catalog: Sonoff SNZB-04PR1 and SNZB-06P (product descriptions), 22.11.2026