Sonoff SNZB-04 Zigbee Opening Sensor: Features, Integration into Home Assistant

Review of Sonoff SNZB-04 Zigbee Opening Sensor 2022. Today we are going to take a look at one of Sonoff-branded wireless smart home sensors. These products are well known to all enthusiasts – not least because of their budget. And the hero of today’s review – Sonoff SNZB-04 opening sensor – is no exception to this rule.

Buy Sonoff SNZB-04 Zigbee Opening Sensor from Official store on Aliexpress


  • Model – Sonoff SNZB-04
  • Interface – Zigbee 3
  • Power supply – CR2032 battery
  • Temperature range – -10 + 40C
  • Weight – sensor 18 gr. magnet 5,3 gr
  • Size – sensor 47x27x13.5 mm, magnet 32×15.6×13


The signature color of Sonoff product boxes – changes over time. From blue to marine green, which is now orange. The box is the smallest possible size, indicating the model and basic parameters.

The delivery set includes a sensor with a magnet, a set of double-sided tape stickers and a small booklet with instructions. Also included in the box is a mark on the passage of quality control.

All entries in the instructions are made in 7 languages, including English. Here, by the way, the version of Zigbee is mentioned – the third, although this is not directly indicated in the characteristics.


Structurally, sensors of this type consist of two parts – a larger one, the sensor itself, with the entire electronic part and a battery, and a smaller one – a magnet. The principle of operation is a reaction to a magnet.

The shape may vary from manufacturer to manufacturer, Sonoff chose a rectangular brick. The small damage below, which is visible on this slide, is already the result of my tests, out of the box – everything is whole.

Backside. These covers are removable, we will look under them soon. When used, it is assumed that double-sided tape will be glued exactly here.

Compared to a similar sensor from the xiaomi mijia ecosystem. The Xiaomi product is more compact and tidier, but also more expensive. Although in essence he is no different from the hero of the review.


Let’s see what’s inside the device. In the small part, everything is simple – there is a small cylindrical magnet here.

In the large part there is a sensor, and the board has rounded edges, similar to the aforementioned sensor from Xiaomi. The battery is protected from discharge during shipment by an insulating film, which must be removed before use.

This sensor uses a standard and well-known to many – the CC2530 module with an internal antenna. Therefore, I will not be surprised if third-party firmware is developed for it. A reed switch MEDER-B J 1/8 from Standex-Meder Electronics was used here as a signal element.

In general, there are no questions about the assembly, with the exception of the contact plate for the battery. It is clearly soldered by hand, and, at least in my version, it does not hold the battery very confidently. I had to pin a piece of rubber on top so that the plate also pressed against the case lid.

Operating principle

So – the principle of operation of the device is that the magnet acts on the contacts inside the reed switch – which can be closed and open. Here is the maximum distance from which the magnetic field begins to act.

Once again, but without the case – the reed switch is in a normally open state. This means that when there is no magnet nearby, the reed switch breaks the electrical circuit. When the magnet is near, the reed switch closes. Thus, the sensor belongs to the class of binary sensors – it has two states – closed – closed, and open – open.

Instead of a magnet, the contact can be closed in any other way – even just a piece of wire. This provides ample opportunities for customizing the sensor. For example, connect external moisture and pressure sensors, mechanical switches and buttons.


To put the sensor in pairing mode, you need a paper clip. It is not included in the kit, but you can use a paper clip from a smartphone – the one that opens the tray with SIM cards, or just a stationery.

As usual – I try to consider as many options as possible for connecting the monitored device. And here I will not deviate from this. I even found a native Sonoff gateway in my bins, and I will start testing with it.

By the way, the gateway came to me quite a long time ago, at least a year ago, back in the pre-release – in a completely white box without identification marks. The firmware on it is also ancient, unfortunately all my attempts to update it were unsuccessful, so I admit some unprincipled changes on fresh firmware.


Let’s start the logical part with the native Ewelink application. We go into the gateway plug-in, click add a device – which puts the gateway into connection mode for 60 seconds, at this time we press the sensor pairing button with a paper clip until the red LED blinks three times through the body. Following this, the gateway will detect and add a new device.

The sensor will appear in the general list and the list of gateway devices. It does not have a plugin as such – it only has a trigger log. Top right – the settings menu, where you can specify the name and location, enable push notifications and remove the device.

The sensor can participate in automations – to the section of conditions IF. And it has two states – open when there is no magnet nearby and closed – when a reed switch acts on a magnet.

Accordingly, these states serve as scenario conditions. The scripts themselves can work either constantly or at strictly specified times and days of the week. For example, when used in the office, you can disable triggering during business hours, monitoring activity only at night and on weekends.

Home Assistant

I will start the integration methods in Home Assistant right from the native gateway. It is supported by AlexxIT’s Sonoff LAN addon. The addon is included in the standard list of HACS integrations. After connection, the sensor will automatically be forwarded to the system as a binary sensor. The default device class is specified as a door sensor, if necessary, it can be changed through the customization section.


The device is also supported in zigbee2mqtt integration. I must say right away that all my sticks, including the test one, work on zstack 3 firmware. Turn on the connection mode and use a paper clip to activate pairing on the sensor.

The whole process takes about 30 seconds, after which the sensor goes through the interview and connects to the system.

Determined quite correctly – from the manufacturer and model to the image. Since the sensor uses an autonomous power supply, it is a final device and cannot transmit messages from other sensors through itself.

In this integration, the sensor gives as many as 5 parameters. Three of which are binary and have true or false states. This includes contact – this is the state of the reed switch, battery_low – it will turn on when the battery charge becomes low and the tamper – in theory, it should turn on when the sensor is removed from its place, but in fact it is turned off even if the sensor is completely disassembled and removed from the case.

Two more are the actual battery level and signal quality.

In the new version of zigbee2mqtt, in the settings section, you can now specify the retain parameter. He is responsible for saving topics of the state of sensors in mqtt. If the parameter is not set, when the Home Assistant is restarted, the state of the sensor will not be known, since the topic will not be saved.

And if you set it, then each change will be saved, thereby after rebooting you will see the last state that came from the sensor, even if it was before the reboot. I personally install it for all my devices.

Over-the-air updates via zigbee2mqtt – as of the release date of this review – are not supported. Let’s see what happens next.

In Home Assistant, the device is forwarded through the MQTT integration – with the five entities I just talked about. By default, the sensor has a door class, which can be changed through the customization section.

An example of displaying a sensor on a network map. Here he built a route through a router, the role of which is played by a socket – adapter Blitzwolf SHP – 13

SLS Gateway

When using SLS gateways, there are no problems either. On the gateway, we start the connection mode, and on the sensor we press with a paper clip until the LED blinks red three times. If requested, you may have to additionally press the pairing button to continue the interview.

The sensor is detected and added completely correctly. Naturally also as a final device.

Unlike zigbee2mqtt – the SLS gateway will display all entities only upon their first change. From the beginning, there is only the signal level. By moving the magnet, we create the essence of contact. The rest will appear on its own later.

Device entities also get into Home Assistant through the mqtt integration. The number of entities will increase as data is received from them. By default, the sensor is also defined as a door sensor.

Video version of the review


During testing, sometimes it seemed to me that the sensor changes state with a slight delay. Perhaps, of course, I’m finding fault, but such a feeling has developed. The advantages of this device can be attributed to its budget, to the disadvantages – the design of the case, not a very high-quality contact plate, tight back covers – you still have to open the sensor, and the plastic is easy to damage.

I think that the most likely use case is just DIY on the principle of contact closure, perhaps even without a case. It’s not as bad to remake it as the Xiaomi or Aqara sensor.

Rate article
Add a Review