logo elektroda
logo elektroda
X
logo elektroda

Which hassle-free door opening sensor for Home Assistant? Sonoff SNZB-04

p.kaczmarek2 843 14
ADVERTISEMENT
Treść została przetłumaczona polish » english Zobacz oryginalną wersję tematu
  • Orange box with Sonoff logo, showing a wireless door/window sensor illustration. .
    Door opening sensors with WiFi communication have already been discussed extensively on our forum. We even managed to find, with our joint efforts, a way to reprogram such sensors based on a module from BK7231 so that they could be activated locally and Home Assistant paired over MQTT. However, this proved to be a rather difficult and problematic task, so here I want to show a simpler and more reliable alternative.

    For comparison - the aforementioned topics about sensors on WiFi:
    Door/window sensor without TuyaMCU - deep sleep and energy saving, OpenBeken .
    Energy-saving (?) battery-operated door/window sensor on WiFi DS06

    So let's start with the purchase. It is said that products on Zigbee are a bit more expensive, but I only paid £35 for the Sonoff SNZB-04. Is there a catch somewhere?
    An orange box of the Sonoff SNZB-04 wireless door/window sensor rests on a wooden surface. Orange box with white SNZB-04 text on the top edge. Back of Sonoff SNZB-04 door/window sensor box with technical specifications. .
    Sonoff SNZB-04 door/window sensor kit with manual and mounting tape on a wooden surface. .
    The sensor is very small indeed. The transmitter measures 47x27x13.5mm and the magnet 32x15.6x13mm. The whole thing is powered by a CR2032 (3V) battery. Normally this sensor works with the manufacturer's gateway, so I'll post its instructions here, but I'll pair it myself with HA via Zigbee2MQTT:
    An open user manual showing steps for adding a sensor to an app and removing the battery insulation sheet. Open user manual of Sonoff SNZB-04 sensor with visible QR code and link to the product manual website. .
    Markings:
    White Sonoff SNZB-04 door/window sensor shown from the back with technical markings, lying on a wooden surface. .

    Pairing with Home Assistant .
    There is not much to tell here. I have Home Assistant set up according to a theme from a couple of years ago, but updated of course:
    Home Assistant tutorial - configuration, WiFi, MQTT, Zigbee, Tasmota .
    Zigbee2MQTT I also updated:
    How do I update Zigbee2MQTT Home Assistant to the latest version? Unsupported device? .
    If we need to, we reset the device according to the instructions, at HA we make sure that pairing is enabled. The sensor should appear in our panel:
    Zigbee2MQTT panel showing device list, including a newly added device labeled as “Unsupported.” .
    The sensor provides its status (open or closed door), battery status (separately true/false determination if low and numerical voltage) and signal quality:
    Configuration panel for the Sonoff SNZB-04 door/window sensor in Zigbee2MQTT. Zigbee2MQTT information panel displaying Sonoff SNZB-04 door sensor status: door open, battery full, voltage 3000 mV, signal quality 81 lqi. Screenshot of the Zigbee2MQTT panel showing the state details of a Sonoff SNZB-04 door sensor, including battery, contact, and signal status. .
    And that's it, you can already do automation based on that.


    Interior of the Sonoff SNZB-04 .
    Now we'll take a look inside, essentially just for educational purposes. We remove the lid:
    Opened Sonoff SNZB-04 door sensor with visible CR2032 battery and PCB on a wooden surface. .
    The PCB can also be removed, it is only held on by the clips:
    Disassembled Sonoff SNZB-04 door sensor on a wooden surface: visible case parts, coin cell battery, and PCB. .
    PCB designation: RB-DS01 V1.0 2020/12/17
    Close-up of a PCB with a CC2530 chip inside a Sonoff SNZB-04 door sensor. Inside of Sonoff SNZB-04 door sensor with visible battery and PCB. Sonoff SNZB-04 sensor PCB with visible CC2530 chip on a wooden surface. Close-up of Sonoff SNZB-04 sensor PCB with prominent CC2530 chip and electronic components. .
    The whole is based on a CC2530, just like the relay shown in the past:
    Sonoff Basic ZBR3, which is the famous relay version on Zigbee. Interior, schematic .
    The whole thing runs directly from the battery, there's no inverter, so it's economical and efficient.

    Summary .
    For small battery-powered devices, just like door/window sensors or temperature sensors, Zigbee is in my opinion by far the better and more convenient choice, even more so if you want to pair the whole thing with Home Assistant. With WiFi-based sensors, this is problematic and the batteries wear out quickly anyway. I guess the only plus of the WiFi-based solution is that it can be scripted a bit more, e.g. such a WiFi-based door-opening sensor, after changing the firmware, can send an HTTP GET packet we specify to the server when an event is detected.... but to what end?
    For most applications, what I have shown here will definitely suffice.
    Finally, this Zigbee device, being battery powered, does not extend the range of our network. This should be kept in mind.
    All in all, I recommend it - especially for this price.
    And which door/window sensor do you guys use? .

    Cool? Ranking DIY
    Helpful post? Buy me a coffee.
    About Author
    p.kaczmarek2
    Moderator Smart Home
    Offline 
    p.kaczmarek2 wrote 11775 posts with rating 9904, helped 562 times. Been with us since 2014 year.
  • ADVERTISEMENT
  • #2 21558492
    TechEkspert
    Editor
    What is the estimated battery life?
  • #3 21558503
    gulson
    System Administrator
    £35 for a ZigBee sensor is really not much.
    If there is nothing wrong with the design, the battery will last for 2 years.
    I use Aqara, although the price is high.
  • #4 21558505
    p.kaczmarek2
    Moderator Smart Home
    It depends on how many times the door is opened, but more or less.
    The manufacturer's website about the SNZB-04P states that:
    The image shows a CR2477 battery and information stating it can last up to 5 years. .
    Overall, Zigbee solutions are great for battery-powered devices.
    Helpful post? Buy me a coffee.
  • ADVERTISEMENT
  • #5 21559082
    krzbor
    Level 27  
    I recommend AQARA - dimensions 41 x 22 x 11 which is even smaller. All AQARA products are characterised by exceptional aesthetics, which is no small matter when it comes to windows and doors. They can be purchased for as little as £54. I installed such a sensor in the garage to check whether the garage door is closed. I glued the sensor itself to the guide rail and the magnet to the trolley. Be sure to buy the AQARA T1 series. By the way, this type of sensor is easy to convert to a switch. We usually have Zigbee buttons. I have not seen the layout of a classic ON/OFF switch. Here it can be easily done - just wires in parallel to the reed switch, although it is better to solder the reed switch.
  • #6 21559157
    gulson
    System Administrator
    Interesting idea with this redesign, basically you could send the state of any electronic device (even a complex one) that makes a momentary short circuit.
    Thanks!
  • #7 21559180
    TechEkspert
    Editor
    A good result for such small batteries, Zigbee is, however, highly energy efficient.

    For the more power-hungry, a rechargeable version has been developed in the CR2032 format: LIR2032H
    on Ali at £5 or £10 with USB charger.
  • #8 21559582
    TechEkspert
    Editor
    @p.kaczmarek2 is there any chance to compare the dynamic power consumption to send one message in a sensor with WiFi and zigbee and the power consumption in standby?
    E.g. using a measurement resistor and an oscilloscope showing the voltage drop over time?
  • #9 21559614
    łuki_mar44
    Level 18  
    I personally use Shelly BLU Door/Window .

    Shelly BLU Door/Window wireless sensor in wood-like finish, consisting of two rectangular components. .

    This is a bluetooth contractron connected to my HomeAssistant via an ESP32 Gateway. The manufacturer provides a battery life of up to 5 years.

    As a gateway I chose m5stack-atom-lite you can also substitute this on the most ordinary ESP32 as someone has in his resources.

    Communication: Contraktron <--- Bluetooth ---> Gateway <--- WiFi ---> HA.


    Home Assistant notification about window status – “closed” status from 2 hours ago. .

    Plus automation with notification to phone:

    Home Assistant notifications on a smartphone lock screen about opening and closing a dining room window. .
  • ADVERTISEMENT
  • #10 21559777
    TechEkspert
    Editor
    BLE, also an interesting solution, 5 years on CR2032 is very good. I wonder how many times a day they report presence regardless of reed switch activity.
  • ADVERTISEMENT
  • #11 21560333
    łuki_mar44
    Level 18  
    From what I can see from the Logs in HA the reed switch only reports when there is an event.
  • #12 21560407
    TechEkspert
    Editor
    Is there monitoring of battery status in addition to events?
  • #13 21560420
    łuki_mar44
    Level 18  
    The reed switch has battery control as much as possible. In addition, window angle + light sensor.


    Shelly Bluetooth panel showing two devices with full battery: window sensor (HST) and kitchen switch. .


    Shelly contact sensor control panel showing battery level, window status, light intensity, and event log. .
  • #14 21560441
    TechEkspert
    Editor
    Not bad, what time does it send status information when no events occur?
  • #15 21560485
    łuki_mar44
    Level 18  
    Unfortunately, as far as I can see, this integration does not have a status entity for this device.

    There is only an option to tick regarding the cyclic querying of entities for the BTHome integration.

    Screenshot of BTHome integration settings in Home Assistant with the system options window open. .

    As far as updating entities is concerned, this only happens when there is a physical change in the opening of a door
    or a change in lighting intensity.

    A graph showing light intensity (lux) readings from a Shelly BLU Door/Window D2D1 sensor for May 2025. .

    P.S. In my spare time, I will try to check if the BTHome integration displays some kind of notification when it loses connection
    with the reed switch.
ADVERTISEMENT