Motion sensor Aqara Door Sensor: connection to Home Assistant

We increase the IQ of a smart home by adding new sensors. This time Aqara Door Sensor. Now it is becoming fashionable to integrate several sensors into the sensor, for example, Aqara Human Body has, in addition to the motion sensor, also a light sensor, there is now a new Xiaoyan door sensor, and it also has a temperature sensor. Here is only the opening sensor.

Check The Current Price on Aliexpress

The first acquaintance with a smart home and the first disappointment

Probably like many smart home fans, I started with Xiaomi MiHome. It was in the year 2015, when I bought myself a set of sensors and a gateway (in such a red box with hieroglyphs – maybe someone else remembers this one). Xiaomi did not think about entering the international market, so the sensors were connected only to the mainland China region, and therefore everything was stupid to the point of disgrace. After turning on the socket several times through the smart home application and waiting for 3-7 seconds until it is actually turned on (and sometimes commands do not reach at all), it was decided to sell the set. So I lost hope for a smart home.

Revival of hope in the smart home

A couple of years ago I met Tuya Smart and was shocked by the speed of work – everything flew, no errors, just a song. And about a year ago, I decided to automate the dacha, which is operated all year round: I added temperature sensors, and based on them, auto heating of water inlet into the house (the house is frame, you need to heat the rise of water into the house at -7 and below), warming up the rooms , automatic inclusion of the boiler in advance, before arrival. Cameras inside and outside have also been added. All this worked through its services separately, and just recently, with the advent of an inexpensive solution in the form of a Home Assistant smart home server on a custom Xiaomi gateway of the European version, all automation and integration are spinning in one place and, which is very important, everything works locally (even without Internet).

Comes in a box disproportionate to the contents. They obviously do not save on cardboard. The whole box is completely in Chinese, but, interestingly, the insctions are in English, and this is not even Google Translate.

  • Max. sensor sensing distance: 22 mm (in fact, you can do a little more, but sometimes it doesn’t work)
  • Operating temperature: -10 – 50 degrees Celsius
  • Operating humidity: 0 – 95%
  • Battery: CR1632
  • Set: sensor (large), magnet (small), insctions (there is even a English one). On the front side there is an indicator hole. There are 2 spare strips of double-sided tape for both parts of the sensor.

    I honestly thought from the photo that it would be the size of a box of matches. Actually, that’s what he is. Quite small. A button for resetting the sensor is visible from below on a large part (hold it for more than 5 seconds). To close / open the sensor, a certain side is used – on the large one, under the word Aqara, a slot is visible – the same is on the small one, so they need to be connected.

    Under the cover of the most part there is a CR1632 lithium battery. 3B, Panasonic, made in Indonesia. According to the operating time, they say 1-2 years (in practice, this happens, but the main thing is that the sensor does not work at near-zero temperatures or below zero).

    Connecting to MiHome

    To connect to MiHome, you will need a gateway that supports the Zigbee protocol. I have a Xiaomi Gateway 3 gateway (it has been working in the Home Assistant system for a long time – it collects all Bluetooth Mesh devices. It is not untied from MiHome and works stably, only now it is forbidden to flash it programmatically). We go to the gateway, select Zigbee devices. We press the button on the sensor for 5 seconds and hear a beep – everything is ready.

    The sensor is impossibly simple – the reed switch gives the status either closed (closed) or open (open).

    For the test bench, I set up the most illogicalle, but it will do for tests. If the door sensor is open, turn on the socket, and if the movement on the motion sensor is triggered, turn it off. It was possible to do so, when opening, turn on (light, socket, whatever), and turn off when the “Closed” event occurs. What is enough fantasy in general, you can specify several conditions like “If the door is opened and there is movement, then ….”

    Live this miracle of automation works like this. Oddly enough, but here MiHome did a great job – not a single hang, which is very strange.

    Connecting to Home Assistant

    For a compact version of a smart home, I advise you to use Z2M development – a Xiaomi gateway with OpenWRT installed (+ Home Assistant + MQTT, etc.) This is much cheaper than raising a whole server on Raspberry if you have only a dozen sensors.

    The setup is as follows, enable pairing mode in Zigbee2MQTT (or Mosquitto or any other MQTT broker).

    In the case of this Xiaomi gateway, go to 192.168.1.XX:8090 and enable pairing mode via the Permit join button at the top of the page. Reset the sensor by pressing the button for 5 seconds and after a couple of seconds the sensor flies into the Z2M and immediately becomes available in the Home Assistant (MQTT integration in the Home Assistant must be configured to the Zigbee2MQTT address).

    This is the data seen in Zigbee2MQTT. Battery status 100% and 3.075V. Communication status 133 lqi (value from 0 to 255, where more means better communication). Some left temperature of 30 degrees arrives yet, but never changes.

    In the Home Assistant, an entity for the sensor immediately appears with all the parameters. Unnecessary can be easily removed. We are only interested in the Closed/Open status and the battery status, which is best displayed from all sensors on one page, for easier tracking of when to change the batteries.

    Everything works instantly. The next step is to set up automations. In general, if there really was a temperature sensor here, then there would be no price for it.


    Compact sensor, everything works instantly. Good sensing distance of 22mm. As far as I know, in Xiaomi sensors the distance was less, almost close.

    You can buy here: Aqara Door Sensor (From 3 pieces you get $10.81 each)

    Buy with discount
    Rate article
    Add a Review