[RELEASE] Xiaomi Aqara Mijia Sensors and Switches Driver

Yeup. Lol

Just released version 0.07 which adds 3 new devices:

  • Xiaomi Mijia Wireless Switch : WXKG01LM
  • Xiaomi Aqara Wireless Mini Switch : WXKG12LM
  • Xiaomi Aqara Water Leak Sensor : SJCGQ11LM
1 Like

Nice work, I love simply drivers with a basic functionality but a presence functionality would be nice, especially for the Xiaomi drivers. Any change you will add it?

2 Likes

How did you make those tiles?

1 Like

Yup very nice tiles @BrunoVoeten
Are you using tile master?

1 Like

It is made using Device WatchDog

2 Likes

Good idea. I'm adding a simple presence to the driver to change state if no communication after 3 hours. That seems a reasonable timeframe as the devices generally report battery status every 50 minutes.

3 Likes

@chirpy - Thanks much! I had been using @veeceeoh 's drivers for my Aqara and Xiaomi devices but recently was getting javascript errors [java.lang.ClassFormatError: Truncated class file (parse)]. Your driver works great for Xiaomi Aqara Motion Sensor (RTCGQ11LM). Thanks so much for making these available!

1 Like

this is interesting ... one of two aqara WSDCGQ11LM temp sensor.
Just looking more - it's not just the temp but the humidity reading has gone wonky as well.

I'd try pressing the button on it (just a short push) and see if it corrects itself.

EDIT: I'll also add some failsafes to ignore out of sensible range values.

EDIT2: I'll also fix that pressure unit, which should be hPa :roll_eyes:

It corrected itself the next temp reading w/o any intervention. ?? Possible just a comm error ??

I actually am just interested in the temp & humidity so it’s ok if the pressure is wonky .... approx 9 times too high? I have two of the sensors and they are both reading the same thing so must be the driver.

Thanks about the failsafe warning. Not actually using them for anything yet. Seeing if they stay connected now that I have them back on my C7.

New version released:

v0.08 - Added simple presence tracking that checks the devices presence and will change state if no data receieved
Added support for MCCGQ01LM
Added safeguard limits to humidity, pressure and temperature measurements
Fixed the pressure unit description to hPa

4 Likes

This driver just gets better and better! I'm using it for most of my Aqara devices now and the presence check is a very nice addition. The only device I have that isn't covered yet is the WXKG11LM single button device . I have just tried it with the latest version in case it works the same way as either the WXKG01LM or WXKG12LM but while it seems to pick up the presence of the device it doesn't get any button presses. This is what the logs give for a button press, if that is any help adding this device:

2021-02-01 11:35:01.020 am infoSky Reboot Button present
dev:1292021-02-01 11:35:00.962 am infoSky Reboot Button contact changed to closed
dev:1292021-02-01 11:35:00.957 am debugProcessing Xigbee data (cluster:0006, attrId:0000)
dev:1292021-02-01 11:35:00.949 am debugIncoming data from device : read attr - raw: 726D010006100000100000001001, dni: 726D, endpoint: 01, cluster: 0006, size: 10, attrId: 0000, encoding: 10, command: 0A, value: 0000001001

What is the model name in the Device Details section of the device page?

A test would be to make a temporary change to the driver and update the two instances of:

getDeviceDataByName('model') == "lumi.sensor_switch"

to the name in the model field and try it out.

The model name is

lumi.sensor_switch.aq2

Changing the driver as you suggested now gets button press working OK :+1:

The only thing is it also gives a button held event after however many seconds I set in the driver for button hold duration even though I don't hold the button down.

EG driver set to 3 seconds but the button being pressed and immediately released gives this:

[dev:36](http://192.168.1.91/logs#dev36)2021-02-01 04:01:43.729 pm [info](http://192.168.1.91/device/edit/36)Aqara Button held for at least 3 seconds

[dev:36](http://192.168.1.91/logs#dev36)2021-02-01 04:01:40.760 pm [info](http://192.168.1.91/device/edit/36)Aqara Button present

[dev:36](http://192.168.1.91/logs#dev36)2021-02-01 04:01:40.702 pm [info](http://192.168.1.91/device/edit/36)Aqara Button pushed

[dev:36](http://192.168.1.91/logs#dev36)2021-02-01 04:01:40.694 pm [info](http://192.168.1.91/device/edit/36)Aqara Button contact changed to closed

[dev:36](http://192.168.1.91/logs#dev36)2021-02-01 04:01:40.672 pm [debug](http://192.168.1.91/device/edit/36)Processing Xigbee data (cluster:0006, attrId:0000)

[dev:36](http://192.168.1.91/logs#dev36)2021-02-01 04:01:40.661 pm [debug](http://192.168.1.91/device/edit/36)Incoming data from device : read attr - raw: 5E74010006100000100000001001, dni: 5E74, endpoint: 01, cluster: 0006, size: 10, attrId: 0000, encoding: 10, command: 0A, value: 0000001001

Thank you for that. That should be sufficient for me to add WXKG11LM to the driver. It looks like that version of the switch doesn't support hold/release so I'll exclude it.

1 Like

This is the driver that I have been using for this if it is any help.

EDIT Reading the comments in it, it seems there are 2 different versions of the same model number with slightly different behavoirs. Thanks Aqara!

Mine is the r1 version. I'm happy to do any amount of testing as I have a spare button connected to a spare hub.

veeceeoh's driver

I have pushed v0.09 which should hopefully support the older WXKG11LM variant of the Aqara button.

1 Like

The WXKG11LM offers single, double, triple and quadruple presses, but no hold. The WXKG12LM reports on single, double, hold and SHAKE!

1 Like

...and the shake is implemented :grinning:

2 Likes