In the article on Sonoff SNZB-03 motion detector and Ikea TRADFRI motion detector I have already mentioned motion detectors that a smart home can also be expanded into a (restricted) alarm system.
The motion detectors can monitor the interior and let you know if movements have been detected in the apartment/house even though nobody is at home.
Another strategy to be informed about a potential burglary is the perimeter surveillance. So you check continuously whether all windows and doors are closed and remain closed.
The Xiaomi Aqara MCCGQ11LM door or window sensor can be used for this purpose. This consists of the actual sensor housing and a separate magnet. Both are attached to a window or door in such a way that a reed contact in the sensor is actuated when it is opened or closed.
The sensor then sends the event via Zigbee to your smart home system (e.g. Node Red) where it can then be processed further.
For example, a message via Pushbullet / pushover / E-mail be sent to you.
Alternatively, the sensor can also be used for other purposes. For example, monitoring of the refrigerator door could also be set up in this way. Various applications are possible with this sensor. 🙂
How to integrate the Xiaomi Aqara MCCGQ11LM door or window sensor into your smart home system is described in the following article.
I know the following tips are always somehow annoying and seem unnecessary. But unfortunately, many people who knew "better" have already lost eyes, fingers or other things or injured themselves due to carelessness. In comparison, a data loss is almost not worth mentioning, but even these can be really annoying. Therefore, please take five minutes to read the safety instructions. Because even the coolest project is not worth an injury or other trouble.
Affiliate links/advertising links
The links to online stores listed here are so-called affiliate links. If you click on such an affiliate link and make a purchase via this link, Nerdiy.com will receive a commission from the respective online store or provider. For you the price does not change. If you make your purchases through these links you support Nerdiy.com to be able to offer more useful projects in the future. 🙂
Before you start this article, you should have prepared a Raspberry Pi so that it can be reached via the network and controlled via SSH. Of course, zigbee2mqtt and Node Red should also be installed and configured.
- RaspberryPi - Setup for Nerdiys!
- RaspberryPi – The first configuration!
- RaspberryPi - Controlling the RaspberryPi via SSH
- NodeRed - Installing NodeRed on the RaspberryPi
- Zigbee - Installing zigbee2mqtt on the Raspberry Pi
- Zigbee - register devices, sensors and actuators with zigbee2mqtt
In the following lists you will find all the parts you need to implement this article.
|1x||Screwdriver set Buy at Amazon|
|1x||SD card reader Buy at Amazon|
Enable Zigbee2mqtt Dashboard
In my opinion, the easiest way to add new devices to your Zigbee network is to use the zigbee2mqtt dashboard. In case you haven't activated this yet, you will find helpful hints in the article Zigbee - Administration of Zigbee2mqtt via the dashboard.
Register sensor to zigbee2mqtt
Before you install the Aqara door or window sensor using Node Red evaluate it, you must first integrate it into your Zigbee network.
I have a little more detail on how to integrate devices into your own Zigbee network in the article Zigbee – register devices or sensors and actuators with zigbee2mqtt described. The following two steps summarize this briefly.
To put the Aqara door or window sensor into pairing mode, you have to insert the battery and the button
- hold down for about 5 seconds
The blue LED in the sensor should then flash and the sensor should connect to your Zigbee network shortly afterwards.
You can track the status of the connection process in the zigbee2mqtt log.
Log into the NodeRed configuration interface
Before you can edit your NodeRed configuration, you must - if activated - first log into the NodeRed configuration interface.
Import node code
The dashboard node should already be installed and configured so that you can also control your Zigbee device via the NodeRed dashboard or display the values. You can find information about this in the following article.
After that, all you have to do is import the NodeCode linked below into your NodeRed environment. Information on how to import NodeRed code can be found in the article Node Red - Import and export Node code .
As always, you can find the NodeRed code in the Nerdiy Git repository under the following link:
Of course you still have to adapt the code to your Aqara door or window sensor. In order for this to work correctly, you still have to enter the IEEE address or the "friendly name" of your door or window sensor in the Node Red code.
To do this, open the properties of the marked node and enter your IEEE address in the marked area under "Payload...". How to find out the IEEE address of your Zigbee device is in the article Zigbee – register devices or sensors and actuators with zigbee2mqtt described.
The received states and values are forwarded to the nodes in the area marked in red.
In the dashboard you can then see whether the sensor has detected a closed window or door, what the battery charge status is and the approximate temperature on the sensor.
View of the measured values of the Aqara door or window sensor in the dashboard.
You can of course also use the newly registered Zigbee device via the zigbee2mqtt Dashboard control or read out.
In the following category I have also listed other Zigbee devices which can be controlled or read out with the Node Red code offered there.
More articles on the topic
I have summarized other articles on the subject of Zigbee and zigbee2mqtt in the following category. There you will also find articles on various Zigbee devices and how they look like Node Red can be controlled.
Have fun with the project
I hope everything worked as described for you. If not or you have questions or suggestions please let me know in the comments. I will then add this to the article if necessary.
Ideas for new projects are also always welcome 🙂 .
P.S. Many of these projects - especially the hardware projects - cost a lot of time and money. Of course I do it because I enjoy it, but if you think it's cool that I share the info about it with you, I'd appreciate a small donation to the coffee fund 🙂 .