Product Guides

Best Zigbee Door & Window Sensors for Home Assistant: Setup and Automation Guide

Best Zigbee Door & Window Sensors for Home Assistant: Setup and Automation Guide

Introduction

When you try to connect your new door and window sensor with lights or switches from different brands, you quickly run into the same problem — everything lives in a separate app or ecosystem, making it difficult to build the automations you actually want.

Home Assistant fixes that. It's a free, open-source platform that unifies devices from any brand — local control, no cloud dependency, and automations that keep working even if your internet goes down.

This complete, up‑to‑date guide shows you how to add a Zigbee door/window sensor to Home Assistant in 2026, create practical local automations, and pick the best sensor for your setup.

 

Why Use a Zigbee Door/Window Sensor for Home Assistant?

When it comes to door and window sensors for Home Assistant, there are several protocol options available — Zigbee, Wi-Fi, Z-Wave, Bluetooth, and others — each with its own strengths and trade-offs. But if you prioritize local control, fast response, low power consumption, and stability, Zigbee remains one of the most popular choices for Home Assistant door and window sensors.

  • Local Control: Connect directly to Home Assistant via ZHA or Zigbee2MQTT. Your automations run locally with no internet required, and your data stays private.
  • Fast Response & Low Latency: Compared with many cloud-dependent devices, Zigbee typically delivers lower latency and smoother automation performance, with state changes usually reported in under a second.
  • Low Power Consumption: Most Zigbee sensors offer excellent battery life of 1–2 years, and some models push even further.
  • Reliable Stability: Zigbee devices form a self-healing mesh network that does not rely on the internet and is not affected by external network outages. When deployed properly — with enough mains-powered Zigbee router devices and good channel planning — Zigbee delivers long-term connection stability.

 

Best Zigbee Door and Window Sensors for Home Assistant

If you're looking for reliable Zigbee door and window sensors for Home Assistant, both the SNZB-04P and SNZB-04PR2 offer seamless integration via ZHA and Zigbee2MQTT.

They deliver reliable local automations, fast response times, long battery life, and built-in tamper detection, making them ideal for monitoring doors, windows, cabinets, drawers, closets, and other entry points around your home.

SNZB-04P: Long Battery Life & Low Maintenance

SONOFF SNZB-04P Door and Window Sensor

SONOFF Zigbee Door/Window Sensor | SNZB-04P

$15.90

【Door & Window Monitoring】Automatically turns on lights when a door or window is opened. Triggers audible and visual alarms for unauthorized entries and sends instant app notifications to keep you informed...

View Product

Key Features:

  • Fully compatible with both ZHA and Zigbee2MQTT
  • Instant open/close status reporting in Home Assistant
  • 5+ year battery life (CR2477) for ultra-low maintenance
  • Built-in tamper detection for security alerts
  • Simple and quick installation with 3M adhesive

*Note: Keep the gap between the sensor body and the magnet within 20 mm (0.79 inches) when the door or window is closed.


SNZB-04PR2: Slim Design & Versatile Installation

SONOFF SNZB-04PR2 Door and Window Sensor

SONOFF SenseGuard DW Gen2 Zigbee Smart Door/Window Sensor | SNZB-04PR2

$13.90

【Slim and Discreet Design】Weighing only 45.1g, the smart door window sensor features a compact design that takes up minimal space and does not affect door or window operation or overall home aesthetics...

View Product

Key Features:

  • Fully compatible with ZHA and Zigbee2MQTT
  • Fast open/close status reporting in Home Assistant
  • Slim body design for tight or narrow frames
  • 3-year battery life with AAA batteries (affordable, widely available, and easy to replace)
  • Built-in tamper detection (exposed in Home Assistant)
  • Supports horizontal, vertical, and detached magnet installation

Home Assistant Features Supported by SNZB-04P & SNZB-04PR2:

Feature

ZHA

Zigbee2MQTT

Opened/Closed Status

History Record

Tamper Alert

Opened/Closed for a Duration

Local Automation

OTA Updates

Battery Level

SNZB-04P vs. SNZB-04PR2: Which One Should You Choose?

  • Choose the SNZB-04P if you want maximum battery life and a low-maintenance, install-and-forget experience for long-term Home Assistant deployments.
  • Choose SNZB-04PR2 if you need a slim design for narrow frames, easy-to-replace AAA batteries, or more flexible mounting options (horizontal, vertical, or detached magnet installation).
Neither model is better than the other — both are reliable Zigbee contact sensors for Home Assistant. The choice depends on your installation environment and battery preference, and since both are affordable, you can choose one or even deploy both in different areas of your home.


How to Add a Zigbee Door/Window Sensor to Home Assistant (ZHA & Zigbee2MQTT)?

There are two main ways to bring a Zigbee contact sensor into Home Assistant — ZHA (Zigbee Home Automation) and Zigbee2MQTT (Z2M).
Both options enable fully local automation in Home Assistant, meaning your door and window sensors continue working even without an internet connection. 

Preparation

Before diving in, make sure you have the following ready:  
👉 New to Zigbee dongles? See these guides:

Add a Zigbee Door/Window Sensor via ZHA (Recommended for Beginners)

If you're new to using Home Assistant, the ZHA method is best for you — it's built into Home Assistant, no extra software required, and easy to set up. Once enabled, most Zigbee contact sensors can be paired in just a few clicks. 
Step 1:  Enable ZHA in Home Assistant:
  • Go to Settings → Devices & Services in Home Assistant
  • Click Add Integration → Zigbee Home Automation (ZHA)
  • Follow the setup wizard to complete Zigbee network initialization
Once finished, Home Assistant will create your Zigbee network automatically.
Step 2: Pair the Door/Window Sensor:
  • Go to Settings → Devices & Services → ZHA → Add Device to open the pairing window
  • Put the contact sensor into pairing mode (usually hold the button on the sensor until the LED flashes)
  • Wait a few seconds for Home Assistant to detect the device
  • Once found, you can rename the sensor (e.g., Front Door Sensor, Bedroom Window Sensor) and assign it to a room for automation use. 

Step 3: Confirm Device in Home Assistant: 

Once added, the sensor will appear under Devices & Services → ZHA

Typical exposed entities include:

  • Open / Closed status
  • Battery level
  • Device availability
  • Tamper status (if supported)
  • Signal strength (LQI / RSSI) 
  • Activity logs

Add a Zigbee Door/Window Sensor via Z2M (Recommended for Advanced Users)

Zigbee2MQTT requires an MQTT broker and additional setup, but provides more advanced device control and broader compatibility, but comes with a more complex setup. 
Basic Setup Flow:
  • Install and configure the MQTT broker (e.g., Mosquitto)
  • Install Zigbee2MQTT in Home Assistant
  • Enable "Permit Join" in the Zigbee2MQTT web interface
  • Put your door/window sensor into pairing mode (same as above).
  • The sensor will appear in Zigbee2MQTT – it then automatically shows up in Home Assistant with all its entities.

📖 Detailed step‑by‑step setup guide:

⚠️ Before setup, check whether your device is supported: Zigbee2MQTT official supported devices list


Top 5 Door/ Window Sensor Automation Ideas in Home Assistant

💡 Auto lighting

Open the front door after dark, and the hallway light turns on. Close it, the light turns off. No switches, no fumbling.  

🔔 Security alerts

Get an instant notification on your phone whenever a door or window opens while you're away. You can set up door sensors to trigger alerts whenever a door or window opens while you're away.

❄️ HVAC control

When a window is opened, automatically turn off heating or cooling, so no energy is wasted. Especially useful if you forget to turn off the AC before opening windows.  

⏱️ Open too long alerts

Get notified if a door or window has been left open for more than 10–15 minutes. This automation is erfect for garage doors, back doors, fridge doors garage doors, back doors, fridge doors, balcony doors, storage rooms, you name it.  

📭 Mailbox Alert

Stick a door sensor inside your mailbox and get a notification — When the postie opens the lid, Home Assistant sends a notification: "Mail has arrived."
Below, we'll walk through the most popular automation to start with: automatic lighting control.

How to Automate Lighting with Contact Sensors in Home Assistant?

Automation logics:
     ✅ When the door opens after dark → the light turns on automatically.
     ✅ When the door closes → the light turns off after a short delay.
This runs as two separate automations — one for open → light on, one for close → light off. Both take under 2 minutes to set up. 
📌Best for: Entryways (front door, back door), pantries, storage rooms, garages, bedrooms, or any space where you want hands-free lighting at night without the light triggering unnecessarily in broad daylight.

Automation 1: Door Opens → Auto Light ON

To make sure the light only turns on when it's actually dark, there are two ways to control when this automation activates.
Pick the one that suits you:

How it works

Best for

Sun-Based

Only triggers after sunset, stops after sunrise — adjusts automatically with seasons

Set-and-forget, no maintenance

Fixed Time Window

Triggers between set hours (e.g., 5 PM–7 AM ) — same every day regardless of weather

Predictable, weather-proof control

Both methods use the same steps — only Step 3 (Condition) differs. 

Step 1:  Open the Automation Editor:

  • Path 1: Go to Settings > Automations & Scenes > Create Automation > Create New Automation.
  • Path 2: go to the sensor Device Page > click "+" icon in the Automations card > select Create New Automation.
Step 2: Add a Trigger:
  • Click Add Trigger > select Device > Device.
  • Device: select your door and window sensor.
  • Trigger: select Opened.

 Step 3: Add a Condition (pick one): 
 🌇 Sun-Based:
  • Click Add Condition > select Time and Location > select Sun.
  • After: select After Sunset. 
📣Tips: Set an Offset of 00:30:00 if you want the automation to start working 30 minutes after the actual sunset, when it starts getting dim.
 🕔 Fixed Time Window:
  • Click Add Condition > select Time and Location > select Time.
  • After: set your start time (e.g., 17:00:00 or 5 PM).
  • Before: set your end time (e.g., 07:00:00 or 7 AM).
  • (Optional) Check specific weekdays if needed

Step 4: Add an Action:

  • Click Add Action > Device > click Device.
  • Device: select your Light (it's usually the switch that controls your lights).
  • Action: select Turn on.
  • Save & Name: Click Save, and name it like "Door Opened - Turn Light ON"

Automation 2: Door Closes → Auto Light OFF

Step 1: Create a new automation in the same way.  
Step 2: Add a Trigger:
  • Click Add Trigger > select Device > Device.
  •  Device: select your sensor.
  • Trigger: select Closed.

Step 3: Condition: Leave this empty — you want the light to turn off whenever the door closes, regardless of time. 
Step 4: Add an Action: 
  • Click Add Action > Device.
  • Device: select your Light.
  • Action: select Turn off.
  • Save & Name: Click Save, and name it like "Door Closed - Turn Light OFF".


Conclusion

Whether you're building local lighting automations, improving home security, or creating a fully local smart home, both the SNZB-04P and SNZB-04PR2 contact sensors integrate seamlessly with Home Assistant through ZHA and Zigbee2MQTT.
Once you've added your first Zigbee door and window sensor to Home Assistant, expanding your setup becomes simple — from entry doors and garage doors to cabinets, drawers, mailboxes, refrigerators, pet doors, and more.





FAQs

Q1: How do I add a Zigbee door and window sensor to Home Assistant?

To add a Zigbee door and window sensor to Home Assistant, you need a Zigbee USB coordinator (such as the SONOFF ZBDongle-E or ZBDongle-P), the ZHA integration enabled under Settings → Devices & Services, and your sensor in pairing mode. 
Once ZHA opens a pairing window, press and hold the button on your sensor for 5 seconds until the LED flashes — the sensor will appear in Home Assistant within seconds.

Q2: Does a Zigbee door sensor work with Home Assistant without internet?

Yes. Zigbee door and window sensors integrated into Home Assistant via ZHA or Zigbee2MQTT operate entirely on your local network. All automations run locally on your Home Assistant instance — no cloud server is involved, and everything keeps working normally even when your internet connection goes down.

Q3: Should I use ZHA or Zigbee2MQTT for my door and window sensor in Home Assistant?

Both work well with SONOFF Zigbee door and window contact sensors.
  • ZHA — Best for beginners. It's built into Home Assistant, easy to set up, and works reliably for most door and window sensors.
  • Zigbee2MQTT — Better for advanced users. Requires a separate MQTT broker, supports more devices, and offers deeper customization and more control—but comes with a more complex setup.
👉 If you're just starting, ZHA is the easier path. If you want maximum control and feature coverage, Zigbee2MQTT is worth the extra setup. 
👉 For a full comparison: ZHA vs. Zigbee2MQTT: The Best Zigbee Integration for Home Assistant?

Q4: Can a Zigbee door/window sensor trigger automations in Home Assistant without any coding?

Yes. Home Assistant's visual automation editor allows you to create door/window sensor automations without writing a single line of code.
As shown in this guide, you can easily build automations for lighting, security alerts, notifications, and more directly through the UI —just use the visual automation editor to set a trigger, condition, and action, then save to activate it.
YAML is completely optional and mainly used by advanced users who want more customization and control. 

Q5: Do I need a Zigbee hub to use a Zigbee door sensor with Home Assistant?

No. Home Assistant eliminates the need for a separate Zigbee hub. All you need is a Zigbee coordinator — such as the SONOFF ZBDongle-E or ZBDongle-P, plugged directly into your Home Assistant device.
The built-in ZHA integration handles all Zigbee communication locally, with no third-party hub or cloud service required.

Q6: How many Zigbee door and window sensors can I add to Home Assistant?

Home Assistant's ZHA and Zigbee2MQTT integrations support large Zigbee networks. Most home deployments handle 30–100+ sensors without issues, provided the Zigbee mesh is properly designed.
The key is having enough mains-powered Zigbee devices — such as smart plugs or bulbs — distributed throughout your home to act as signal routers and keep all battery door sensors reliably connected.

Q7: Can I use a Zigbee door sensor with Home Assistant for home security?

Yes. A Zigbee door and window sensor is a practical foundation for a local home security setup in Home Assistant. You can configure automations to send instant push notifications to your phone when a door or window opens while you're away, trigger a siren, start a camera recording, or log all entry events — all running locally without any subscription fee or cloud dependency.

Q8: What is the difference between the SONOFF SNZB-04P and SNZB-04PR2?

The SONOFF SNZB-04P and SNZB-04PR2 are both Zigbee 3.0 door/window sensors that work natively with Home Assistant via ZHA or Zigbee2MQTT. Both offer built-in tamper detection, OTA firmware updates, provide local automation without cloud dependency, and respond to open/close state changes in under a second.
The key difference is that the SNZB-04P prioritizes ultra-long battery life (5+ years on a CR2477 coin cell). The SNZB-04PR2, by contrast, focuses on a slim and compact design and versatile installation: 90×26×13.5 mm, standard AAA batteries (up to 3 years), and a magnet that mounts horizontally (30 mm gap) or vertically — ideal for narrow frames, tight spaces, or uneven gaps.






 

Reading next

Home Assistant Water Leak Sensor Setup Guide 2026: Get Leak Alerts Before Water Damage Happens
Home Assistant Temperature & Humidity Sensor Setup and Automation Guide 2026

Leave a comment

All comments are moderated before being published.

This site is protected by hCaptcha and the hCaptcha Privacy Policy and Terms of Service apply.