Zigbee development Part 2 – Aqara Sensors and buttons

Aqara sensors from Banggood

I’m becoming increasingly impressed by the tiny Aqara sensors – first of today’s bunch –

And here below is the motion sensor, running smoothly with my new Electrolama ZZH dongle (coordinator) running Zigbee2MQTT. I long-pressed the tiny button on the side/top/bottom of the sensor and the ZZH immediately picked it up and added it to the network.

I renamed it to “aqara-movement-1” to avoid having to memorise the usual cryptic Zigbee numbering. I’m thinking as this is actually vibration-sensing rather than movement sensing, it belongs on a window or door – or anything indoors really where you want to detect vibration. I THINK the part number is DJT11LM (the box was in Chinese). Size of the unit is 36mm x 36mm x 9mm

A quick screen-grab of the payload should show you all you need to know about this tiny device. The ad states that “Aqara Smart Motion Sensor need to be used with Xiaomi Upgrade Version Multi-function Gateway or Aqara Hub. Cannot be used independently. Please confirm the model of the gateway before connecting.”Trust me, it’s working without any of that using my Zigbee2MQTT-based SONOFF and dongles.

Aqara Smart Motion Sensor from Banggood

action: “vibration”
angle: 7
angle_x: 3
angle_x_absolute: 87
angle_y: 1
angle_y_absolute: 89
angle_z: 87
battery: 100
linkquality: 150
strength: 109
voltage: 3025

Above is what comes out of an MQTT payload when you shake the sensor (I was holding it at the time) – simple.

Next: the “”. This time model ID MCCGQ11LM. The manual comes in English and other languages. The main unit is 41mm x 22mmm x 11mm (the magnet is much smaller).

I have no idea why it’s giving temperature as well, but that’s a bonus – though the latter didn’t seem to change when I blew on it. The contact status however, definitely changed..

battery: 100
contact: true
linkquality: 144
temperature: 31
voltage: 3055

Next: The “” or BUTTON to be more accurate. Spec: model WXKG11LM – size 45mm x 45mm x 12mm

action: “single”
battery: 100
click: “single”
linkquality: 162
voltage: 3085

I should point out that in all of the units covered here, adhesive pads are already attached for mounting and spares are supplied.

This is a simple one – you (hopefully) can’t go wrong with a button… I covered this and more in the first part of this Zigbee article but here’s a little more. The data from the button offers “single”, double, or – if you hold the button down for a while – “hold” then “release”. SO, if you could for any reason not see the light itself – you could if you wished, use the long-press “hold” option (or “double” action to ensure the light is OFF (or ON).

Actually while I’m here, links for all of the sensors below – I have to say, the Sonoff sensors are good but I prefer the Aqara range up to now purely as they are nicely rounded and use inexpensive CR2032 batteries. Don’t ask why I have 2 links for the Aqara temperature/humidity/pressure sensors (below) – I’ve no idea.

As for why I’m favouring Zigbee temperature sensors over DS18B20 or DHT22-based sensors with ESP8266 controllers (you’ll see plenty about those in previous blog entries) – simple – ok, changing the battery every year or two is a pain but on the other hand – nice case, no worries about false temperatures caused by heat from the control circuitry, easy to use.

As for the battery – you could of course predict battery failure as you can read the voltage at any time. I like it. I need to get some feedback from experienced Zigbee users as to battery fail prediction… as in – at what percentage (or voltage) would one consider it time to change battery..

Next: The Aqara Smart Home Temperature and Humidity Sensors – I have lots of these..

battery: 100
humidity: 40.57
linkquality: 177
pressure: 914.2
temperature: 26.76
voltage: 3015






16 thoughts on “Zigbee development Part 2 – Aqara Sensors and buttons

  1. I am wondering where to start,

    I have aqara small button and i am wondering if there any way to flash them to be able to use them under a Tuya ZigBee Wireless/Wired Gateway Smart Hub

    1. I’ve only used the Aqara buttons with Zigbee2MQTT – i.e. the free, open source gateway I use with both the “Sonoff Zigbee 3.0 dongle Plus” and the “Electrolama ZZH” dongle – no flashing or other alteration was needed to the Aqara buttons – they just work.

      1. I have an Zigbee hub (ethernet). Any advise or workaround or I need a Usb dongle to be able to get it to work ?

        Thank you

  2. Hi,
    I have just received a Aqara Opple 6 button switch from Banggood (https://www.banggood.com/Aqara-x-OPPLE-ZigBee-3_0-HomeKit-Version-Wireless-Smart-Switch-Work-With-HomeKit-From-Eco-system-p-1590410.html?cur_warehouse=CN&ID=6265279&rmmds=search), each button having five actions, single, double, triple, hold and release.

    e.g.
    {
    “action”: “button_1_hold”,
    “battery”: 100,
    “linkquality”: 120,
    “voltage”: 3131
    }

    Pairing with Zigbee2Mqtt was simple, a quick press of a button on the rear of the unit and it was done. The only problem with the unit seems to be that it is not easy to replace the battery. There is a good review here: https://notenoughtech.com/featured/aqara-opple/

    For those wishing to experiment with Zigbee, Waveshare (https://www.waveshare.com/) do a good development kit (CC2530 Eval Kit2), which can be configured as a coordinator, router or end node. However, you also need a CC Debugger Emulator for CC2531 to flash the bootloader (this is the same as the one needed to flash a Zigbee2Mqtt USB dongle.)

  3. One of my favourite Bluetooth LE sensors is the “MiFlora” soil sensor. I’ve had one of these running for over 2 years – to measure the moisture of the soil in the plant pot containing our palm tree at our holiday chalet. The tree is sheltered and doesn’t receive any direct rainfall so I have a very basic irrigation system (ESP8266, Aquarium pump, large water vessel) which I use to deploy water to the plant only when it needs it – and when it’s not freezing outside etc.

    MiFlora sensor: –

    https://www.aliexpress.com/item/1005002709598412.html?spm=a2g0o.productlist.0.0.5d611f52Hwk5KQ&algo_pvid=bb6c27bb-6b83-4890-8f83-32f8994c2225&algo_exp_id=bb6c27bb-6b83-4890-8f83-32f8994c2225-0

    Battery life is good (CR2032) but varies depending on how often you poll it for data. I’ve got a Python script (found on GitHub) which I have running at intervals via a cron job and that sends the temperature, light intensity, moisture data via MQTT to my Pi-based home automation system.

    1. i have the Mi Flora – sadly it got more expensive as time went on (at one point they were about £8) – and I really hate using Bluetooth – a Zigbee version of that would be really nice as I could put them in plantpots all over the place. Yup, I recall I had the Python code on it – do you have the link for that handy while we’re here?

      Is anyone aware of a Zigbee version doing the same thing?

        1. Well, here’s a thing, I found my MiFlora and fitted a new battery (the old one said 1v), I remembered the Python code was still on my RPI – and added some commented out code to find BT devices – on test it returned an error – so I plugged in a BT dongle into the RPi, which returned nothing (expected as the RPI4 interferes with Zigbee as well) so I stuck the dongle on a USB extender – and a load of BT devices appeared including my phones, the MiFlora and more – including my AI temperature wall-mount sensor (see relevant blog entry) which I’d forgotten had BT.

          I ran the Python code (now set to run every 5 minutes until the novelty wears off) and added in Date.now() (as .when)to the JSON payload so I know when the last report was.. ( I do that now with all devices that don’t know the time). All’s well.

  4. I have quite a few Aqara zigbee sensors in ‘casual’ use at home. I have window switches, the mini PIR sensors (really good despite their tiny size – they use an extra large coin cell battery). I also have some lux sensors and temperature/humidity (and some with temp/humid and pressure). I find battery life good – especially if you put your own (known brand) coin cells in to replace the cheap ones that they ship with.

    Also worth noting are the chinese temperature/humidity sensors that work on Bluetooth LE – with the LCD screens. These only send readouts when the temp/humidity changes – hence low power – plus they run on AAA batteries so I’ve had over 18 months battery life from a single AAA battery – I know this as I’ve only just changed the battery for the first time. These are really reliable and I use some Python code that I found on Github to read the bluetooth data – on an Orange Pi Zero with external BLE dongle – or a Raspberry Pi Zero-W which works okay too.

    1. Hi Darren

      (OHHH, before I forget – there’s just been an upgrade to Zigbee2MQTT – installed last night on my RPi4) – yes, I noticed that while most of the sensors use CR2032 batteries, the odd one uses CR2450 – Sonoff sensors use CR2450 – thankfully they seem widely available just like the CR2032.

      I’ve not touched the Bluetooth LE sensors yet. I might try that.

  5. “Peter: Do you know if the windows/door sensors have periodic “open alert messages” indicating that the window/door was left open?”

    These devices do periodically report with state, signal -RSSI and battery level so it is easy to both “watchdog” time them to make sure they are alive and connected and also to automatically monitor battery level trend to warn very early of failure.

    HTH

    Garry

  6. Peter: Do you know if the windows/door sensors have periodic “open alert messages” indicating that the window/door was left open?

    If you have sonoff windows/door sensors, I would like to know the same thing.

  7. I got a pile of this stuff Pete and I like it a lot. As I said in a previous post, I learned what I know cobbling microcontroller projects together using arduino and uPython with MQTT and deep sleep for lots of automation jobs. Our home has a fine mix of functional automations and lots of odd stuff like logging all sorts of events and data to Google Sheets etc but the fact is most of these projects were learning exercises.

    With a fundamental grasp of power, network, communication, sleep, interrupts, load switching and much more, to be able to deploy ready made “potted” solutions that include much or all of this functionality, cost neglideable amounts of money and have a hybrid scandinavian/apple finish, well it is just too easy!

    I have now become lazy combining stuff like a Aquara button and a Tasmota OLED in a 3D printed wall plate for a simple central heating controller. NodeRED decides what to do with single, double or long presses of the button, Tasmota just displays results, even Mrs. GryKyo finds it easy. NodeRED will even email me if I need to put a battery in the button!

    For hackers and makers like us, these are powerful little packages to integrate. FYI their PIR devices allow home security to be very smart with just as little effort to deploy – imagine a wireless battery powered Zigbee PIR inside a wall or floor safe for example…

    G

    1. I think we’re heading in the same direction – Zigbee isn’t ideal as the sensors need battery replacements periodically – but to offset that, they are generally easy to use – I’m continuing to use Node-Red and the new ZZH Zigbee2MQTT dongle is proving great for handling sensors at least – and I can mix that via MQTT (in Node-Red) with my Tasmota-driving switches and lights – it just keeps getting better.

      This morning I got a Zigbee light sensor I’m hoping to use in the hall to turn lights on when it is cloudy outside (I already have software timers on everything of course including dusk/dawn handling but that can’t handle miserable rainy days) – a correctly-placed light sensor should finish things off nicely I hope.

      But just ponder your Zigbee inside a wall – you WILL need to change the batteries at some point – make sure you have easy access panels or you will get into trouble with Mrs. GryKyo 🙂

Comments are closed.