[OBSOLETE] Original & Aqara Xiaomi Zigbee Sensors (contact, temp, motion, button, outlet, leak, etc)

[UPDATE] “Original” Xiaomi Button DTH v1.3

For Xiaomi’s round button, model WXKG01LM

button
This release adds support for previously hidden functionality that has been “revealed” with firmware version 25.26. Because Hub Firmware 25.26 is required, this new DTH should only be used by SmartThings Hub v2 and v3 users. Let me repeat that:

NOTE: This updated DTH only works with Hub Firmware 25.26 or higher, which is currently only available for SmartThings v2 or v3 Hubs

The updated Xiaomi Button DTH code can be found here.

NOTE: After updating to the new DTH, open the preference settings for your button in the SmartThings “Classic” Mobile App and then press “Save”. This will set up the correct increased number of buttons available for automations.

If you don’t have a SmartThings v2 or v3 Hub:

Please use the OLD previous version of the Xiaomi Button DTH code, which has been renamed to xiaomi-button-old-firmware. The direct link to the “old firmware” DTH code is here (make sure to change to this if using the GitHub Repository Integration in your IDE).

Main Changes

1) Added support for multi-click actions:

Action SmartThings Event Notes
Single press button 1 pushed
Hold button 1 held Event comes after button is released ~
Double-click button 2 pushed
Triple-click button 3 pushed
Quadruple-click button 4 pushed
Shizzle-click button 5 pushed 5 or more multi-click

~ Note: The default minimum time required to hold the button for the held event is 2 seconds, and this can be changed in the preference settings, found by clicking the gear icon while viewing the device in the SmartThings Classic mobile app

2) Removed preference setting to optionally send “button 2 pushed” event on hold
Because of the newly added functionality, it doesn’t make sense to allow a button hold to generate a button 2 pushed event when a double-click now does that.

3) Attempted to add support for the new Samsung Connect mobile app (UNTESTED)
This was done by adding an ocfDeviceType definition, but SmartThings has not published any documentation on adding support for the new mobile app, and currently devices using custom device handlers (like this one) are NOT yet officially supported in the new mobile app.

Detailed Change List

  • added support for multi-click actions (double, triple, quadruple, and > 5-click)
  • removed preference setting to send button 2 pushed event on hold (button hold now always sends button 1 held event)
  • added method imports to match official device handlers on GitHub/SmartThingsPublic
  • removed unneeded endpointId and profileId from device fingerprint
  • added ocfDeviceType to definition in attempt to get device handler working with new SmartThings Samsung Connect mobile app
  • added preliminary support for Device Watch
  • added initial button event for proper configuration during device pairing
  • improved followup in updated() after user saves preference settings
  • added more helpful inline comments to code
  • minor code cleanup and reorganization

This updated and improved device handler code is open source and free.
But if it has helped you, a coffee / beer donation is always very much appreciated!
PayPal: 37544ab59e07a5c90719f07501453cae3ed7b043 Venmo: @KeithPG

~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~

[UPDATE] Aqara Button DTH v1.4.3

For models WXKG11LM (original / new revisions) and WXKG12LM

aqarabutton
This release fixes “broken” functionality for the original revision of Aqara Button model WXKG11LM due to a change in Hub Firmware version 25.26. However, this new DTH also adds multi-click functionality for the same Aqara Button model, which was not available in previous firmware versions.

Because I only own some of the model WXKG12LM Aqara Buttons, I am unable to test this updated DTH code with the original and new revisions of the model WXKG11LM buttons, so I am calling it a beta until I hear back from owners of these other two models.

NOTE: This updated DTH only works with Hub Firmware 25.26 or higher, which is currently only available for SmartThings v2 or v3 Hubs

The updated Aqara Button DTH code can be found here.

NOTE: After updating to the new DTH, open the preference settings for your button in the SmartThings “Classic” Mobile App and then press “Save”. This will set up the correct increased number of buttons available for automations.

If you don’t have a SmartThings v2 or v3 Hub:

Please use the OLD previous version of the Aqara Button DTH code, which has been renamed to xiaomi-aqara-button-old-firmware. The direct link to the “old firmware” DTH code is here (make sure to change to this if using the GitHub Repository Integration in your IDE).

Main Changes

1) Added support for model WXKG11LM (original revision) multi-click actions:
In addition to single-click, now double-clicks, triple-clicks, and quadruple-clicks are supported, generating a button pushed event for button 1, 2, 3, & 4, respectively. See the chart below for a comparison of the functionality of all three Aqara Button models.

2) Added button release support for models WXKG11LM (new revision) & WXKG11LM
Now these two models offer the option of using another button pushed event when the button of these two models is released after being held. See the chart below for more details about the functionality of all three Aqara Button models.

3) Attempted to add support for the new Samsung Connect mobile app (UNTESTED)
This was done by adding a ocfDeviceType definition, but SmartThings has not published any documentation on adding support for the new mobile app, and currently devices using custom device handlers (like this one) are NOT yet officially supported in the new mobile app.

For instructions on how to check exactly which model and revision of Aqara Button you have, please see this post.

Functionality Comparison Chart

Action WXKG11LM (orig) WXKG11LM (new) WXKG12LM
Single press button 1 pushed button 1 pushed button 1 pushed
Hold * button 1 held button 1 held
Double-click button 2 pushed button 2 pushed button 2 pushed
Triple-click button 3 pushed
Quadruple-click button 4 pushed
Shake button 3 pushed
Release * button 3 pushed button 4 pushed

* Notes on hold & release: Models WXKG11LM (new revision) and WXKG12LM send a “held” message when the button has been held for 400 milliseconds. This timing is hardware-based and cannot be changed, but the button can be held as long as liked. With both models a “released” message is only sent when the button is actually released.

Detailed Change List

version 1.4.3

  • fixed issue with erroneous battery level events from catchall: messages that don’t actually contain battery voltage data

version 1.4.2b

  • Model WXKG11LM (original revision) - all button click actions should now generate correct button X pushed events
  • Model WXKG11LM (original revision) - all button click actions should now be correctly displayed in main tile for the button viewed in the SmartThings Classic mobile app

version 1.4.1b

  • Model WXKG11LM (original revision) - fixed an issue in v1.4b where single-click messages were not correctly recognized
  • removed duplicate call to initialization() because model information is normally not available until configure() is called during pairing

version 1.4b

  • Model WXKG11LM (original revision) - added compatibility with hub firmware v25.20 and higher
  • Model WXKG11LM (original revision) - added support for multi-click actions (double-, triple-, and quadruple-click)
  • Model WXKG11LM (new revision) - added support for “button 3 pushed” event when button is released after being held
  • Model WXKG12LM - added support for “button 4 pushed” event when button is released after being held
  • added method imports to match official device handlers on GitHub/SmartThingsPublic
  • removed unneeded endpointId and profileId from device fingerprint
  • added ocfDeviceType to definition in attempt to get device handler working with new SmartThings Samsung Connect mobile app
  • added preliminary support for Device Watch
  • added incompatible device handler warning to users running firmware 24.x or earlier
  • added initial button event for proper configuration during device pairing
  • improved followup in updated() after user saves preference settings
  • added more helpful inline comments to code
  • minor code cleanup and reorganization

This updated and improved device handler code is open source and free.
But if it has helped you, a coffee / beer donation is always very much appreciated!!
PayPal: 37544ab59e07a5c90719f07501453cae3ed7b043 Venmo: @KeithPG

~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~

[RELEASE] Aqara Wireless Smart Light Switch DTH v0.9.2

For 2016 & 2018 revisions of the 1-button WXKG03LM and 2-button WXKG02LM


This new device handler (DTH) was split off from the “old” Aqara Button DTH in order to best support the two revisions of the one and two-button Aqara Wireless Smart Light Switches. The code has been written so that this device handler can be used with any firmware version, but for users with hub running on Hub Firmware 25.26 or higher, all three actions of the older 2016 revision two-button model WXKG02LM are now recognized: left, right, and both button(s) pushed.

All users of Aqara Wireless Smart Switches are highly encouraged to start using this DTH immediately! You may discover you have more button actions available to make use of in Smart App automations than with the old DTH.

The new Aqara Wireless Light Switch DTH code can be found here.

If you were are already using the old Aqara Button DTH with a paired Aqara Wireless Light Switch, you will need to change to this new DTH. Log into your hub’s Groovy IDE, go to the “My Devices” tab, click on the name of your Aqara Wireless Light Switch in the “Display Name” column, scroll all the way down and click the “Edit” button. Click the pop-up list next to "Type: ", select “Xiaomi Aqara Wireless Switch”, and then click the “Update” button. IMPORTANT: After updating to the new DTH, open the preference settings for your button in the SmartThings “Classic” Mobile App and then press “Save”. This will check your button model and set up the correct number of buttons available for automations.

For instructions on how to check which revision of Aqara Wireless Light Switch you have, please see this post.

Model WXKG03LM (1-button) Function Chart

Action 2016 revision 2018 revision
Single press button 1 pushed button 1 pushed
Hold * button 1 held
Double-click button 2 pushed

Model WXKG02LM (2-button) Function Chart

Action Side 2016 rev (old FW)* 2016 rev (new FW) 2018 revision
Single press Left button 1 pushed button 1 pushed button 1 pushed
Single press Right button 1 pushed button 2 pushed button 2 pushed
Single press Both button 1 pushed button 3 pushed button 3 pushed
Hold ** Right button 1 held
Hold ** Right button 2 held
Hold ** Right button 3 held
Double-click Left button 4 pushed
Double-click Right button 5 pushed
Double-click Both button 6 pushed

*Note about 2016 revision of 2-button model WXKG02LM: For users with SmartThings Firmware 24.x or lower, all three button actions (left/right/both pressed) pass on the same button pressed message to the DTH, so there’s no way to tell which button(s) were pressed, and so only button 1 pushed events are generated. With Firmware 25.21 or higher, the three different button actions are recognized.

**Notes about the hold function: Both of the 2018 revision of the two models send a “held” message when the button(s) have been held for 400 milliseconds. This timing is hardware-based and cannot be changed, but if the button(s) are held for more than 10-15 seconds the device will go into pairing mode, so be careful! No button release message is sent by any of the Aqara Wireless Light Switches.

Detailed Change List

version 1.4.1b

  • Initial release

version 1.4.2

  • changed device definition name to get GitHub Integration working correctly

This new improved device handler code is open source and free.
But if it has helped you, a coffee / beer donation is always very much appreciated!
PayPal: 37544ab59e07a5c90719f07501453cae3ed7b043 Venmo: @KeithPG

18 Likes