private@homelab: ~/latest
Home Assistant · Zigbee2MQTT · local control
private@homelab:~$ cat guides/article.md
·
· ·
6–10 minutes
read

Sonoff SNZB-04P Door Sensor: Zigbee2MQTT Setup Guide

Pair the SONOFF SNZB-04P with Zigbee2MQTT or ZHA: CR2477 battery, mounting, MQTT states and current tamper support, with practical checks for older setups.

The SONOFF SNZB-04P is a Zigbee door/window contact sensor with a tamper input. It can join Zigbee2MQTT or ZHA directly, so the independent-coordinator setup does not require an eWeLink account or SONOFF bridge. The useful checks are the exact model, its mounting position and the support included in your installed integration.

The SNZB-04PR2 is a separate, newer model with different batteries and dimensions. Older tamper reports also need their version context: the SNZB-04P ZHA quirk has been merged and is included in the released version checked here. This guide uses vendor documentation and released integration code, not a new physical-device test.

What the “P” adds over the plain SNZB-04

The Zigbee2MQTT pages for the SNZB-04P and SNZB-04 share four main reported properties; the P adds a tamper property. That is a comparison of their exposed properties, not a claim that their hardware, battery or reporting behavior is otherwise identical.

Property SNZB-04 SNZB-04P
contact Yes Yes
battery Yes Yes
battery_low Yes Yes
voltage Yes Yes
tamper Not listed Yes

SONOFF describes tamper detection as a way to notice removal even if the sensor and magnet are moved together, leaving the contact state unchanged. Treat it as a separate input to test after mounting. A door opening and a sensor being removed are different events.

The SNZB-04P manual documents Zigbee 3.0, a five-second button hold for pairing and slow LED flashing during its pairing window. Use that model’s instructions rather than the reset sequence for another SONOFF sensor.

  1. Confirm the label says SNZB-04P and remove the battery insulation tab if the unit is new.
  2. Start permit joining in Zigbee2MQTT, or add a device through the ZHA integration. Use one coordinator network for the sensor.
  3. Hold the sensor’s button for five seconds until the LED flashes slowly. Wait for the device interview to finish; check the integration log if it does not.
  4. Give it a useful name, such as front_door_sensor, and verify open/closed reports before sticking it down.
  5. Align the marks on the sensor and magnet, with one on the moving part and one on the fixed frame. SONOFF’s installation instructions call for a closed-door gap under 20mm. Check the complete opening travel and repeat the test at the final location.
  6. Close permit joining and check the Home Assistant entities and any alert automation.

For a failed interview, check the battery/tab, distance to a working coordinator or router, permit-join status and the actual model signature. Retry the documented pairing sequence while looking at the log. Do not start by resetting an unrelated working Zigbee network.

The device page lists OTA support. Firmware transfer to the sensor is over Zigbee, but an OTA provider may fetch the image from an internet server first. Check model compatibility and keep the battery device available during an update; OTA capability does not mean every firmware file is suitable or already downloaded.

What it publishes over MQTT

A device named front_door_sensor publishes under the configured base topic, normally zigbee2mqtt/front_door_sensor. This is an illustrative state payload, not a captured reading or a promise that every field arrives in the first message:

zigbee2mqtt/front_door_sensor
{
  "contact": true,
  "battery": 100,
  "battery_low": false,
  "tamper": false,
  "voltage": 3000,
  "linkquality": 132
}

contact: true means closed and false means open. Home Assistant door/window binary sensors use on for open, so Zigbee2MQTT discovery maps that polarity appropriately. Test the raw MQTT value and HA state once before building a notification. Our MQTT topics and attributes guide explains the surrounding message structure.

The current device page makes an important distinction: contact and battery-low are report-only, while tamper, battery and voltage also support /get. None of these five properties has a normal /set operation. To request tamper status, use the MQTT publish tool with:

Tamper status request
Topic: zigbee2mqtt/front_door_sensor/get
Payload: {"tamper": ""}

Use your actual base topic/name. A sleeping device may need to be awake for a read, and a timeout is not proof that tamper is permanently latched. Battery percentages, reported voltage and link quality are diagnostic inputs, not guarantees that the sensor will deliver every event.

Battery: CR2477 on the SNZB-04P, AAA on the R2

SONOFF’s SNZB-04P specifications state a 3V CR2477 cell and a transmitter size of 50.5 × 32 × 21.9mm. The advertised battery life is over five years; it is a vendor estimate, not a measured replacement interval for your installation.

The SenseGuard DW Gen2, SNZB-04PR2, uses two AAA cells and a 90 × 26 × 13.5mm transmitter. SONOFF advertises up to three years and horizontal or vertical mounting. The installation still requires both the main sensor and its magnet.

The R2 has its own Zigbee2MQTT definition. That page also records reports of a missed first action after hours of inactivity, so check its current notes if comparing revisions. It is not evidence that the original P has the same issue.

Use the exact model label and official cell specification when buying a replacement. An unverified third-party CR1632 listing is not evidence of another SNZB-04P battery variant. Actual life depends on the device, cell and use; do not substitute a different size because a generic listing says so.

Tamper in ZHA and Zigbee2MQTT: check the installed support

The SNZB-04P’s tamper status uses SONOFF’s manufacturer-specific cluster 0xFC11, attribute 0x2000. Decimal 64529 is the same cluster ID. Both integrations now have code for this input, but that does not mean every older installation already has it.

ZHA: the older strangeness discussion and support request #3308 describe the earlier gap. PR #3665 merged on 22 March 2025. The released zha-quirks 2.3.0 code, required by Home Assistant 2026.10.0, matches eWeLink / SNZB-04P, creates a diagnostic tamper binary sensor and prevents the unwanted default OnOff entity. It is inaccurate to treat that old missing-quirk report as the current state of every ZHA installation.

If yours still lacks a useful entity, check your Core/quirks version, manufacturer/model signature, applied quirk and disabled diagnostic entities. Compare the physical tamper action with logs and a fresh entity update before installing a custom quirk or re-pairing. The R2’s separate PR #5131 remains a different support track; the P’s quirk does not automatically apply to it.

Zigbee2MQTT: the released converter reads that cluster and supports a tamper-status request. Issue #25069 records a December 2024 attempt to clear tamper on Zigbee2MQTT 1.42.0. Its log shows a failed tamper-status get request with a missing-cluster error. It does not establish that all current units remain stuck, or that absence of /set makes physical recovery impossible.

Restore the normal mounting/cover position, test the tamper mechanism safely and watch for a fresh report; use the supported status read if needed. Do not send guessed manufacturer writes to force a false value. If the state remains wrong, retain the model, firmware, integration versions and debug trace for a reproducible report. This guide does not invent a separate reset command that the device documentation does not provide.

How it compares to Aqara’s door/window sensors

Our Aqara generation comparison covers the alternatives. The Aqara Door and Window Sensor P1, MCCGQ13LM, also exposes tamper and allows detection_distance settings of 10mm, 20mm or 30mm. Its page says to wake it with the button before changing that setting.

The SNZB-04P has a manufacturer-specified installation gap and no equivalent distance setting in its current Zigbee2MQTT exposes. Adjustable distance may help a difficult frame, but test the actual mounting and reliability rather than treating one setting as a universal cure for false opens.

Other SONOFF Zigbee devices, such as the TRVZB radiator valve, have their own independent-coordinator setup. Their procedures are not the SNZB-04P’s pairing sequence. For app-based SONOFF setups, our eWeLink data review discusses the separate cloud services.

FAQ

What does the P add? Tamper is the additional property in the current exposed-property comparison with SNZB-04. That does not make the hardware and batteries identical.

Is the SNZB-04PR2 the same model? No. It uses two AAA cells, different dimensions and a separate device definition. Check its own support and issue notes.

Can I use SNZB-04P without eWeLink? Yes, through a supported Zigbee2MQTT or ZHA coordinator. The independent Zigbee route does not require the SONOFF app account.

Which battery belongs in SNZB-04P? SONOFF specifies CR2477. Follow the exact model specification; a contradictory generic listing is not a verified alternative.

Why is my tamper entity missing or wrong? Check installed support and the applied model/quirk first. Current ZHA includes a P-specific quirk, while Zigbee2MQTT supports reading status. An older failed status read is not a universal current diagnosis.

Is it better than Aqara P1? Compare your frame, battery preference, current integration support and need for adjustable detection distance. Both support contact and tamper inputs, with different configuration and mounting limits.

What this verified, what stays local, what to check yourself

Specifications and installation come from SONOFF; exposes and read access come from Zigbee2MQTT. Current quirk support was checked in the released dependencies for Home Assistant 2026.10.0, and the older reports remain in their original version context. No unit was paired or firmware installed for this guide.

The independent sensor/coordinator route is local Zigbee. Home Assistant notifications, a remote MQTT broker and OTA downloads can involve other services according to your configuration. Verify the contact polarity, tamper behavior, final mounting and any critical alert on your own installation.

local-firstHome Assistantno-cloud