Setting up the Sonoff Zigbee Door/Window Sensor with Home Assistant
Want to know instantly when a door or window opens — without relying on cloud apps or Wi-Fi? The Sonoff Zigbee Door/Window Sensor connects directly to your Home Assistant Zigbee network for fast, local, and reliable automation. You can use it to turn lights on/off, save energy and keep track of who's where.
What You’ll Need
-
Sonoff Zigbee Door/Window Sensor (SNZB-04)
-
A Zigbee coordinator set up (e.g. Sonoff Zigbee 3.0 USB Dongle Plus)
-
A working ZHA or Zigbee2MQTT setup in Home Assistant
Step 1 — Power the Sensor
The Sonoff SNZB-04 ships with a pre-installed CR2477 battery and a pull tab that prevents contact during shipping.
Simply pull out the plastic tab — the LED will blink once to confirm it’s now powered on.
No battery installation is needed.
Step 2 — Prepare Home Assistant
Option A: Using Zigbee2MQTT (Follow this to setup Zigbee2MQTT)
-
Go to Settings → Add-ons → Zigbee2MQTT → Open Web UI.
-
Click Permit join (All) this will allow devices to automatically connect.
- Once the device has connected, press Disable join.

Option B: Using ZHA
-
Go to Settings → Devices & Services → Zigbee Home Automation → Configure → Add device.
It will search for zigbee devices.

Step 3 — Put the Sensor Into Pairing Mode
On the SNZB-04 sensor, press and hold the button on the bottom (next to the LED) for about 5 seconds until the light begins blinking (it is quite dim and hard to see).
This indicates that the sensor is now in pairing mode and broadcasting to join your Zigbee network.
Step 4 — Wait for Detection
After a few seconds, the sensor should appear automatically:
-
In Zigbee2MQTT, it will show up in the Devices list or logs with a name like:
0x00124b00294a1234 (SONOFF SNZB-04)
-
In ZHA, Home Assistant will display a popup saying “Device found” and automatically add the sensor to your device list.
-

Step 5 — Test the Sensor
-
Simply move the smaller sensor, next to and then away from the other:
-
In ZHA, the device will swap between on/off.

-
In Zigbee2MQTT, the “contact” value should toggle between true/false.

-
Your sensor is now ready for automations, simply mount it, so when the door/window is shut the gap is less than 30mm.
FAQ
How can I check the battery level?
Both ZHA and Zigbee2MQTT expose a battery entity or attribute. It usually updates once every few hours. You can view it from the device page in Home Assistant.
How do I re-pair or reset the sensor?
Press and hold the pairing button for 5 seconds until the LED blinks rapidly. This clears the previous network and re-enters pairing mode. You can then follow the pairing steps again.
What is the connectivity range of the SNZB-04?
Typically up to 30 m indoors depending on wall thickness and interference. Range can be extended by adding Zigbee routers or powered devices (such as smart plugs or bulbs).
Does it work offline?
Yes. Like all Zigbee devices, it communicates directly with your coordinator and doesn’t require internet access once paired.
Leave a comment