Xiaomi / Aqara ZigBee device drivers (possibly may no longer be maintained)

Thank you. Both the DH and webcore are working!

1 Like

Button WXKG01LM isnt implemented yet right?

I only have the two-button model, WXKG02LM.

However, the driver for that should also work for the one button model, but it will just work as a single button of course, sending a button 1 pushed event.

Can you try it to check and let me know if it works?

The code can be copied from here.

1 Like

It seems to work but it’s sending 2 times that it’s been pushed. Even if i try to push it as quick as i can.

2018-04-08 10:36:17.660:infoButton Triggered
2018-04-08 10:36:17.612:infoButton: Button pushed 1
2018-04-08 10:36:17.407:infoButton Triggered
2018-04-08 10:36:17.369:infoButton: Button pushed 1

Also wondering how i subscribe to the event on your buttons.

I used to use this:
subscribe(Button, “button.pushed”, ButtonPushedEventHandler)

But dont think you use that one, any idea what i need to use to subscribe to a pushablebutton?

Details regarding Hubitat’s Button Implementation can be found here…

1 Like

It appears that the single-button model may send messages when it’s pressed and when it’s released.

However, I don’t think you’ve assigned the device driver I linked to, because it would never post “Button triggered” log messages.

Please try going to the device details page, assigning the Xiaomi Aqara Dual Button Light Switch driver, click “save”, then turn on debug log output, “save”, and post your log entries that occur when you click the button, hold for a few seconds and release. That should produce the Zigbee messages in the log that I need to make the device driver compatible.

1 Like

My bad! I was trying my own version.

2018-04-08 18:37:18.200:debugButton: Left button pushed

2018-04-08 18:37:18.189:debugButton: Parsing description: read attr - raw: 82B70100060800001001, dni: 82B7, endpoint: 01, cluster: 0006, size: 08, attrId: 0000, encoding: 10, value: 01

2018-04-08 18:37:18.002:debugButton: Left button pushed

2018-04-08 18:37:17.990:debugButton: Parsing description: read attr - raw: 82B70100060800001000, dni: 82B7, endpoint: 01, cluster: 0006, size: 08, attrId: 0000, encoding: 10, value: 00

Great! Based on the times in the log output, it appears you just clicked the button once, right?

Also, can you try holding the button for 3-5 seconds, and post the log output for that?

Tried it:

2018-04-08 19:14:36.347:debugButton: Left button pushed

2018-04-08 19:14:36.326:debugButton: Parsing description: read attr - raw: 82B70100060800001001, dni: 82B7, endpoint: 01, cluster: 0006, size: 08, attrId: 0000, encoding: 10, value: 01

2018-04-08 19:14:33.307:debugButton: Left button pushed

2018-04-08 19:14:33.290:debugButton: Parsing description: read attr - raw: 82B70100060800001000, dni: 82B7, endpoint: 01, cluster: 0006, size: 08, attrId: 0000, encoding: 10, value: 00

Wait a second - you said model WXKG01LM, right?

I think I confused this model with a different button.

Does your button look like this:


If yes, then you should use the “original” Xiaomi Button device driver. It supports button hold, single-click, double-click, triple-click, quadruple-click, and also quintuple-click.

EDIT: I have released a new version of the round button device driver; please see my next post (below).

[UPDATE] All Xiaomi Device Drivers except Aqara Button

Links to updated code

Changes from previous versions
All device drivers

  • added (informational) info log message toggle preference setting, for displaying helpful plain English" / non-debug log messages
  • custom attribute events (for use with webCoRE) now use more accurate Epoch Time stamp
  • changed Battery Replaced Date to use system-formatted new Date() date/time stamp
  • removed Date Format and 24 hour clock preference settings because they are no longer used
  • removed lastPressedDate because it doesn’t serve any real purpose on Hubitat
  • edited preference setting and log message text for clarity

Aqara Leak Sensor device driver

  • added custom lastDry attribute event for webCoRE use

both Motion Sensor device drivers

  • added custom lastInactive attribute event for webCoRE use
  • changed default of motionreset to 61 seconds (1 second longer than normal hardware reset of 60 seconds)

Temp/Humidity Sensors device driver

  • added attribute "pressure", "Decimal" to be used for custom pressure value events

Note: These device drivers are not final, and some features or preferences may be added / removed


The button seems to work! Thank you for the effort :wink:

1 Like

For anyone who downloaded the updated code for the Aqara Leak Sensor driver, @NoWon alerted me to an issue that shows an error on the log page and prevents the wet / dry status to be sent to the hub.

I have fixed the code, but I won’t be able to test it until I get home in about 8 hours.

If you want to revert to the previous v0.6 code, it is still available here.

Sorry for any inconvenience, and thanks for your patience!

The updated Aqara Leak sensor driver code is now working correctly. Version is now v0.7.1, grab the code from here.

1 Like

working great thank you

Thanks again for these drivers Keith. Just received my Aqara button today. Pairing was easy. Hope it stays paired, as this thing is so cool, and an incredible deal vs a Flic. So far I’m using single-click, hold, double-click and triple-click with the Button Controller app. All are performing perfectly.

1 Like

@veeceeoh: Would it be possible for you to add a offset configuration field for the Aqara motions sensors, to compensate for variances in there illuminance reporting? Thanks!


[UPDATE] v0.7.1 of Aqara Motion Sensor Device Driver

This small update adds an Lux value offset preference setting:


  • The lux upper limit of the Aqara Motion Sensor is 1000 or 1200 (depending on model revision) and does not seem to be highly accurate.
  • Although a lux reading message is sent by the sensor when motion is detected, the order of lux and motion detection messages is not always the same (i.e., the lux value message may be sent before or after the motion detected message.) With that in mind, a change in lux value should probably be evaluated before evaluating whether motion detected = true in an automation app rule.

Is anyone else seeing their Xiaomi (original) motion sensors not going inactive after a while? It’s normally fine after the hub has been rebooted, but within a day or so the runIn() call doesn’t seem to do anything.

I’m wondering if there’s a resource that’s not being freed somewhere, although I can only assume that it’s in the Hubitat firmware, since the DTH looks perfectly fine.

Download the Hubitat app