The guests left the front door open: a notification after 15 minutes
A front-door sensor and an automation in Home Assistant send a notification when the door stays open for 15 minutes. For a rental apartment and for any door that shouldn’t stay open.
- Level
- Beginner
- Active time
- 30–60 minutes
- Home Assistant required
- Yes
In a rental apartment the guests often go out and forget the door ajar. A front-door sensor and one automation in Home Assistant send you a notification when the door has been open for 15 minutes without interruption.
What you will get
A notification on your phone when the front door stays open for 15 minutes. The automation only notifies. It doesn’t close the door, doesn’t lock it and doesn’t see who is inside. A brief opening, for example when carrying luggage, doesn’t send a notification.
What you need
- A door sensor: Sonoff SNZB-04PR1, Zigbee 3.0, CR2477 battery.
- You already have: Home Assistant and a phone with the Home Assistant app.
You need a Zigbee hub or Home Assistant with a Zigbee adapter.
The hub or adapter is not included in the product. The sensor does not connect directly to the Wi-Fi router. We have no ready-made kit for this project.
- Setup time: 30–60 minutes.
- Skills: you add a Zigbee device in Home Assistant and paste YAML.
- Installation: the sensor is stuck on, with no tools and no connection to mains voltage.
How it works
The sensor is in two parts, a transmitter and a magnet. A closed door means they are close to each other. Home Assistant shows binary_sensor with the state on with an open door and off when it is closed. The automation starts when the state becomes on, and waits 15 minutes. If the door closes earlier, the wait is interrupted and there is no notification.
Steps
- Add the sensor in Home Assistant. Pair it through the Zigbee integration or Zigbee2MQTT. After you pull out the battery insulation, the sensor goes into pairing mode by itself for about 3 minutes. If the time runs out, hold the button for 5 seconds. In Settings → Devices & services a device with
binary_sensorfor a door should appear. - Stick the sensor on. The transmitter goes on the frame, the magnet on the leaf. The gap between the transmitter and the magnet with the door closed is under 20 mm according to the manufacturer. Open and close the door and watch the state change between
onandoff. - Check the notifications. Install the Home Assistant app on the phone and log in to your system. Settings → Devices & services → Mobile App shows the phone. The name of the notification service is of the form
notify.mobile_app_<phone-name>. - Create the automation. Settings → Automations & scenes → Create automation → Create new automation → three dots → Edit in YAML. Paste the example and replace the sensor’s entity ID and the notification service name with your own.
alias: "Front door: open for over 15 minutes"
description: "A notification when the front door has been open for 15 minutes without interruption"
mode: single
triggers:
- trigger: state
entity_id: binary_sensor.front_door_contact
to: "on"
for: "00:15:00"
actions:
- action: notify.mobile_app_telefon
data:
title: "The front door is open"
message: "The door has been open for more than 15 minutes."
You paste it as one automation in the editor. binary_sensor.front_door_contact and notify.mobile_app_telefon are example names. 15 minutes is an example threshold: replace “00:15:00” with the time you need.
Checking the result
- Normal case. Open the door and leave it for 15 minutes. The notification comes to the phone once, shortly after the 15th minute.
- Brief opening. Open and close the door in less than 15 minutes. There is no notification.
- Notification for the test. So you don’t have to wait, temporarily change “00:15:00” to “00:00:30”, check, and put the value back.
- The sensor is unavailable. If the sensor becomes
unavailableorunknownwhile the door is open, the wait is interrupted and there is no notification. Take a weak battery into account too. - Restart. If Home Assistant restarts during the wait, the wait is lost. The door has to be closed and opened again.
If it doesn’t work
- There is no notification. Check in Traces whether the automation started. If it did, check the notification service in Developer tools → Actions.
- The notification comes too often. The door swings on the edge of the gap. Reduce the gap between the transmitter and the magnet and check that they are aligned by the markers.
- The sensor drops out. A Zigbee sensor is weak over long distances. Add a mains-powered Zigbee device along its path.
- The notification comes, but the door is closed. The magnet is on the wrong side of the transmitter. Align the markers.
Limitations and turning it off
- The sensor says only “open” or “closed”. It doesn’t know who is in the apartment and whether there are guests.
- The notification goes through the Home Assistant app. If the phone has no connection, no notification is received.
- The automation does not lock and does not close.
- A door sensor does not record image or sound.
- The automation is stopped from Settings → Automations: turn it off or delete it. The door keeps working as before.
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: automations, triggers, 22.11.2026
- Home Assistant: Companion App, notifications, 22.11.2026
- SONOFF: SNZB-04PR1, manual, 22.11.2026
- Home Assistant: Zigbee Home Automation, 22.11.2026
Need a hand?
We can set up and install everything in this project. In some regions we install it ourselves — ask us.
Contact us


