SmartThings Community

[RELEASE] Xiaomi Sensors and Button (beta)

In the over 1.5 years I’ve been using Xiaomi / Aqara devices I’ve never had the batteries die, but I can confirm that their Status can be marked as “OFFLINE”, even with SmartThings’ Device Health feature turned off:

I have read reports of Device Health being unreliable, so I have it turned off.

Really the best way to know whether a Xiaomi / Aqara device has gone offline for any reason is to look at the time of the most recent battery percentage report.

All battery-powered Xiaomi / Aqara ZigBee devices check in with the hub every 50-60 minutes and send a battery voltage report at the same time. So I would suggest setting up a piston with logic that sends an alert if no battery percentage event has been generated by the device in over 2 or 3 hours.

If having trouble setting up a piston with that kind of logic, there is also a very nice customizable SmartApp which can send notifications based on time since the last XXXX event, or battery level, or temperature:

EDIT: It would be really helpful if you could check the events lists for the final battery voltages / percentages just before those sensor’s batteries died, and share those values.

Yeah, the problem is that these devices apparently don’t go OFFLINE in the IDE even if they haven’t communicated in over a month. I assumed that would be a good value to watch for device issues, and it seems it is - except for these. Of course, I can create a new piston to just watch the value of my Xiaomi devices, I was hoping that kind of device specific piston wouldn’t be required.

I’ll take a look at Simple Device Viewer, but man would I prefer to have all my automations in Webcore.

And finally, as far as battery percentages go, they seem to vary pretty wildly. I’m about 90% sure that one of them last checked in with 80% before dying.

1 Like

@veeceeoh I am hoping that you can help me figure out what the problem is with my aqara WXKG11LM buttons.

I was happily using my aqara buttons to open and close my gate and garage door until they stopped working a few days ago. When I pressed the buttons, there is no event button being pushed when I checked the events log. However, I do see the lastcheckin and lastcheckinCore events as shown below. Any idea?

Aqara Button WXKG11LM last checkin is Sun Mar 31 2019 5:19:08 PM
Aqara Button WXKG11LM last checkin co re is 1554027548374

The V2 firmware was recently updated. You will need to update your DTH with this one.

1 Like

@TylerDurden it works! Thank you very much.

Yes, there were changes in the latest firmware, and I updated all the Xiaomi / Aqara button device handlers:

[ANNOUNCEMENT] All Xiaomi / Aqara wireless button users

Hub Firmware 25.26 has been released for SmartThings v2 & v3 Hubs

The new firmware includes changes that “break” some functionality in the previous device handlers, but also allows for much improved functionality.

In order to fix the issues and add improved functionality, I have updated all Xiaomi / Aqara Button device handlers (DTHs). All SmartThings v2 & v3 Hub users are encouraged update to the newest DTHs immediately.

Please see this post for all details and links to the updated DTHs.

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

2 Likes

Hi everyone

stupid question. i have the original button and have updated my handler. it now registers single, double triple etc. however cant seem to get it to work in core / how to pick up the different presses in smartthings. pleases can someone let me know the right ‘instructions’ / app to use to take advantage of the now 5 options?

thank you

My smart lighting app doesn’t seem to give me those options…

Hi Davey, please disregard my response. My wires got crossed and I thought I was responding to a question about double tapping on a GE Jasco switch. Sorry about that.

Hi,
I have a question. The readings from the temperature,humidity sensor are visible in the new version of the application?
Regards,
Maciej

Any exams of how to use in core please? Struggling to get it to recognise the different taps.

Thank you

Yes they are.

1 Like

Here is an example of how I use the humidity reading and some logic to set a variable that dictates whether the fan should come on in my bathroom.

Thank you :slight_smile:

Anything in single, double, triple presses etc? Can’t get it to recognise however in smartthings it shows these actions…

@Davey1985 - I assume you looked at my announcement post for the new device hander?

All the different press types for the model WXKG01LM Xiaomi button result in standard SmartThings button pushed events except for when the button is held. In that announcement post I included a chart showing that:

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

So the button number needs to be part of the piston’s conditional, something like:

if
Device_Name's button #2 gets pushed

Something isn’t correct there. You should see another selection option for “Button Number”, like this:

The only thing I can think of that may be going on here is that your SmartThings Hub is not yet “aware” that the Xiaomi Button can send events for buttons #1-5.

In order for the hub to know how many buttons to make available to smart apps, a device handler has to send a numberOfButtons event.

All of the Xiaomi / Aqara button device handlers sends the numberOfButtons event when the button is paired, but if a user already paired a button and just changes from the old device handler to the new one, the number of buttons isn’t automatically updated.

To manually update the number of available buttons with the new driver, try opening the preference settings for the button in the SmartThings Classic mobile app, and then just press save:


Please let me know if that worked.

1 Like

Thank you. Before you posted they appeared so was just taking a bit of time to filter through.

Hey, how did you get the humidity to show above the temperature? On mine, it is reversed.

My humidity sensor became “unavailable”. Any steps to get this working again?

Thanks!

Check the status of the sensor in IDE…
If status is HUB_DISCONNECTED try rebooting your hub from within the IDE…
Otherwise a re-pairing should help…