SmartThings Community

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

The new Aqara Button DTH is still in beta, so it’s not found in the normal location in the GitHub bspranger repository. It’s still an active “Pull Request”, with comments and notes found here:

The latest version of the beta is v1.3.5b, which can be directly copied from here.

I am working on another update that is intended bring compatibility with the next Hub firmware update, v25.x. If all goes well it may even expand on the functionality of the DTH because more hardware features will be accessible.


Can you share more details:

Which ST update?
Which DTH are you using?
Which device / sensor?


Sorry, this is not possible. Also, I don’t have any information as to whether the new Smartthings outlet (GP-U999SJVLDAA) will work well with Xiaomi / Aqara devices.

1 Like

Xiaomi Aqara Temperature Humidity Sensor

WSDCGQ11LM

ID: 2016DP6443

This is with a Gen 2 hub.

Firmware Version: 000.024.00020

Hardware Version: hub v2, US customer Rev E

Thank you for looking into this. I have 6 other of the same sensors attached. They were a pain, but I can’t get these last two attached.

Hello all. Picked up the motion sensor the other day, i think i managed to pair it but its ciming up as a “thing”. I renamed it but all it says it “please wait”

I must have done something wrong?

Did you install the device type handler for it? Once it pairs and you rename it, you will likely need to log into IDE and assign the correct device type.

Thanks. Yeah I added the device handler first
Do I have to then go to the device and do something?

No, you don’t need to do anything else to the device. You need to log into the IDE portal (here:IDE Login, select your location/hub, go to the “My Devices” tab, select the motion sensor, scroll to the bottom and select edit, click the dropdown that says “type” and select the device type that matches the device handler you’ve installed (should be “Xiaomi Aqara Motion Sensor”), then click the update button at the bottom of the page.

This FAQ might be helpful: https://community.smartthings.com/t/faq-an-overview-of-using-custom-code-in-smartthings-smartthings-classic/16772

1 Like

Yeah when I said device I meant to say device handler.
Thanks for the help. :).

Ok managed to go in and change it to motion sensor, all im getting now is ST saying “motion” next to this device in the app. Nothing is triggering it

Okay, let’s start over. A few questions so I can even begin to help:

  • What’s the model of the motion sensor? There are two models, so that’s important to know.

  • Which DTH code did you add to your hub’s Groovy IDE?

  • To check whether it paired properly, can you post a screenshot from the motion sensor’s device details page in the IDE? Log into IDE, click on My Devices at the top, then click on the name of the motion sensor (in the “Display Name” column), and then look for the section row labeled “Data:”. Here’s what it looks like for one of my Aqara Motion Sensors:

  • In that same device details page, you should also see information in the “Current States” section row. A screenshot of that could be helpful.

  • Finally, in the SmartThings Classic mobile app (not the new “Samsung Connect” mobile app), change to the “My Home” tab, select your motion sensor to view it, and press the “Reset Motion” app tile. Next in IDE, click on Live Logging and then walk in front of the motion sensor to activate the motion detected message. Do you see any log output from the motion sensor? If yes, please copy and paste it in a post here.

Thank you.

Thanks. Ok ive removed and and im now trying to re pair it again. not easy.
After i do that i’ll check back in ( if i ever re pair it again ) :slight_smile:

Managed to sort it out mate. Thanks alot though

1 Like

[UPDATE] Xiaomi Smart Plug DTH v1.1

(For Xiaomi’s ZigBee Outlet model ZNCZ02LM)

This release adds power / energy metering support, with all thanks and credit going to GitHub user @mike-debney.

The updated DTH code can be copied directly from here . Please note that I have not been able to test the new code changes because I do not own a Xiaomi Smart Plug myself. Any feedback from Xiaomi Smart Plug users would be greatly appreciated!

Changes :

  • added parsing of wattage power load messages from the outlet
  • added support to create power load events for use in SmartApps
  • added parsing of wattage power metering messages from the outlet
  • added support to create power metering events for use in SmartApps
  • added device power and energy meter value display tiles

Screenshot

1 Like

Can I ask a real noob question. Have a aqara neutral single wired switch and johndoyle is working fine but temp doesn’t update and new connect app doesn’t show on or off. I have changed the DH to zigbee switch so the light on off works from front page but no temp. Now I would like the temp but prefer the on/off state working better. Can I modify the ZigBee switch code to show temp?

Instead, try adding ocfDeviceType: "oic.d.switch" and genericHandler: "Zigbee" to the definition() line in John Doyle’s DTH:

In other words, change line 15 from

definition (name: "Xiaomi Zigbee Mains Toggle Switch", namespace: "johndoyle", author: "John Doyle") {

to

definition (name: "Xiaomi Zigbee Mains Toggle Switch", namespace: "johndoyle", author: "John Doyle", ocfDeviceType: "oic.d.switch", genericHandler: "Zigbee") {

The ocfDeviceType definition is used by the new SmartThings Samsung Connect mobile app, but unfortunately SmartThings has not provided any documentation on how to integrate it into custom DTHs yet.

As for genericHandler, this is something very new with absolutely no explanations, but it has been added to SmartThings’ official ZigBee-based device DTHs so it’s worth a try.

Did t work I’m afraid. I’ll stick with the normal ZigBee switch. Thanks any way

For those who are still struggling with keeping these devices connected, i’d like to share my personal experience.

I bought 15 of these devices, all of them stayed connected on the first try except for my temperature and humidity sensors. If you had been researching pairing these, you will find there are at least 3 different recommended methods an device set up. Here is what i found worked for me.

  1. Set up device handlers on SmartThings IDE
  2. On the classic SmartThings app, press “Add a Thing” to start the pairing.
  3. On the device, hold the pairing button/pin until the LED comes on, device is now reset and in pairing mode.
  4. Wait until the device shows up on the SmartThings app, this might take up to 3-5 minutes.
  5. Confirm adding the device
  6. Check the device every hour, specifically “Last Event” time. If the time is stuck for 30 minutes or more, the connection has dropped. Remove the device and repeat from Step #2.

For some of my temp/humidity sensor, i only had to repeat these steps 3-5 times to get it to stay connected. However, i have this one that took more than 15 tries… No idea what is causing this, but just keep trying at it and eventually it will work.

The game changer for me is that i found out i didn’t need to read the catchall and create the device manually in SmartThings IDE like many had suggested. This allows me to repeat the steps in rapid succession without getting super annoyed.

Hopefully these steps can help others who are as frustrated as i was.

2 Likes

[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

15 Likes

I can certainly test the 2 button DTH if needed on my V2 hub. This would be awesome and could change my mind on a couple of options I was contemplating.

Is it worth starting a clean thread with all the changed in Function and availability.

Also will this give more reliable pairing and remain paired better? Often the information is not easy to find in such a developed thread.

Not sure if that’s a good idea. There’s already some confusion for users on where to look with two major threads, and a bunch of smaller ones.

No. SmartThings’ change in the newest firmware only affects certain kinds of messages received from ZigBee devices after they have been paired.

It is really important to understand that there is absolutely nothing that can be done in the device handler (DTH) code to help with pairing of Xiaomi / Aqara ZigBee devices. Also the DTH cannot help in keeping them connected after they have been paired.

People should continue to attempt pairing Xiaomi / Aqara ZigBee devices the “normal” way, using the “Add a thing” method in the SmartThings Classic mobile app first, and only if that’s unsuccessful then use the “catchall” method.

As for Xiaomi / Aqara devices dropping their connection, the number one probable reason for this is due to other ZigBee devices on the network acting as ZigBee repeaters that are incompatible with Xiaomi / Aqara’s non-standard method of maintaining their connection.

Most ZigBee devices that are mains-powered (plugged into a wall socket) are repeaters (with the exception of some smart bulbs such as Sengled). The only ZigBee repeater devices confirmed to work with Xiaomi / Aqara devices are XBee Zigbee modules (see here for more info), IKEA Tradfri Outlet / Bulbs, and user iharyadi’s custom ZigBee multi-sensor repeater solution. Also in theory Xiaomi / Aqara’s own mains-powered devices like the Xiaomi Smart Plug or the Aqara Wired Smart Wall Switches should work as compatible repeaters, but I don’t own any myself and haven’t read enough reports by users to know for sure.

Personally, the only repeaters I use are some XBee modules and an IKEA Tradfri Outlet, and I almost never see my Xiaomi / Aqara ZigBee devices drop off the network. Full disclosure: I have moved nearly all of my home automation setup to a Hubitat hub, but the same issues with incompatible repeaters apply there as well. However, I am doing frequent testing with my 40+ Xiaomi / Aqara devices on the SmartThings platform in order to improve and update the SmartThings device handlers (DTHs).

4 Likes