[OBSOLETE] Xiaomi Sensors and Button (beta)

I also have tried using the LONG press and single and double press with these buttons. No luck but haven’t reached out to see if its even possible. If it is then it opens up Many possibilities . But the New Samsung buttons they do what you want. Sorry to say but also they seem to be V3 hub only…

Unfortunately, no.

In order to use a held button action to ramp up or down the level of a dimming bulb, there would need to be a separate “button - held” event at the start, and a “button - released” event at the end.

Both the A4refillpad and bspranger/Xiaomi device handlers for the original Xiaomi button only send the “button - pushed” or “button - held” event when the button is released. Also, the SmartThings button implementation doesn’t support a “button - released” event, which explains why the Smart Lighting app doesn’t have an option to raise / lower the level of a dimmable switch/bulb when button XXX is held.

There are workarounds for this which involves using other SmartApps or WebCoRE and assigning “button 1 - held” to the start of raising/lowering the level of a dimming switch or bulb, and then “button 2 - held” to stop changing the level. In the device handler, it would have to send the corresponding events when the button device is held and then released after being held, but it only really works if the button hardware itself can recognize the difference between a press and being held and sends different messages for those two actions. The original Xiaomi button hardware does not support sending a button held message.

As explained above, both device handlers for the original Xiaomi button support “button - pushed” (short press) and “button - held” (long press), but those event messages only happen when the button is released. However, double-press of the original Xiaomi button is not supported in SmartThings.

Hi All,

I’m new forum member and I still don’t have ST hub .
The Xiaomi DH is super critical for me as I read that not only the prices are great but they are very good sensors .
I read that ST v3 has issues with Xiaomi sensors .
The problem is that I can’t find affordable ST v3 Europe as they out of stock in some online stores or very expensive .
Saying this, I have 2 questions:

  1. Is it possible to make ST v3 compatible with Xiaomi sensors ?
  2. If not, where can I buy ST v2 Europe frequencies in reasonable price that also send to Israel .

Appreciate Any other Ideas

Thanks All

Hi guys!

first of all sorry for my English, its not my main language.

I am asking the users who has the door/window sensors for a long time.
Does it now working properly? I read lots of disconnections, problems and so on…

But now 1 year later this topic started, is it stable and good?
Also what about the battery life?

I am asking this because i am moving to a new house and i want to put lots of these sensors into it.

thank you

My experience is that they are Rock solid…
As long as you have a good Zigbee network or are in range from the hub…
Mine have run on the same batteries for little over a year know, and shows 97% left…

Hi Brian,

Check this post:

There is special procedure that you need to follow to avoid frequent disconnections.
Following the procedure described in the attached post, I have had 100% success in correctly pairing Xioami/Aqara devices.

Thank you for your answer!

I am going to use it with V3 HUB, i hope everything will going well.


What is the correct way to re-pair a Xiaomi button? I have the round Xiaomi button that has been working for months. And then 1-2 weeks ago, it is shown as disconnected. This occurs around the same period which my hub seems to be dead running out of battery. After fixing the hub, the Xiaomi button is the only one not working. I tried replacing the CR2032 battery of the button but no help.

I have seen instruction about how I need to turn off zigbee repeaters. I only have 1 repeater which is a light switch. It is not convenience to turn it off as I need to do it from the breaker.

What I am still not clear is if I need to remove the Xiaomi button from my list devices, which means I have to redo all my automations as well. Do I need to remove the Xiaomi button from my Hub?

I have pushed the reset/link button several times. I have not seen any Event listed under my hub related to the button press. Is this expected?

First, I would go get yourself an IKEA Trådfri outlet as a repeater for the Xiaomi devices. They are inexpensive and work great for not only Xiaomi, but other Zigbee devices as well. Most repeaters are not compatible with Xiaomi, but the Trådfri outlet is. I added two of them on November 18, 2018 and I have not had a single Xiaomi or any Zigbee device for that matter, drop off since.

Next, @veeceeoh recommends this method on Hubitat. It would be something similar on SmartThings.

I have also had success on occasion by simply removing the battery for 30 seconds, put it back in and then single pressed the button. It reconnected. Did that a few times with success before I had the Trådfri outlets. Now I don’t have to. Of course, if I lose power long enough I might have to.


Hello! Just got my smartthingshub and trying to add som sensors to it, got some motionssensors and temprature sensors and leaksensor added succesfully, im trying to add xiaomi original button but it wont pair like the others in the app but i can see them working in the eventlist.

I see that i can add device manually but what info do i need to edit to the device from eventlist? Network id? Button wont change state in app when ive tried.

Should i just keep trying add throught the app untill it pops up?

Thanks for help.

Guys is there a different device handler for long press of the xiaomi button from just the standard press, if so can you point me in the direction of the long press option.

Cheers in advance :slight_smile:

You could try the catchall pairing method, which is detailed nicely in Post 165 of this thread. It works great for pairing, though some here feel that it results in less stable performance, and devices dropping off easier. I’ve a few xiaomi devices I paired with the catchall method over a year ago that have never dropped off though.

The a4refillpad button DTH in the first post of this thread has an emulated hold function. The hold function isn’t super reliable just due to the fact that it’s emulated and the nature of potential delays in the cloud processing, and you need to have the timing right to get it to work, but it’s the only DTH I’m aware of with that capability.

1 Like

@MinerJason so fingers crossed that should work with the single press button as well then.

Cheers again.

Yes, single press works just fine with that DTH, and hold works most of the time once you figure out how long you need to hold it. I use that DTH with several buttons around my house, two acting as doorbells, and one controlling some lighting.

1 Like

Outstanding, TVM

The main disadvantage to using the “catchall” method is that in most cases, the device’s ZigBee ID is unknown to the SmartThings hub, and so the hub has no way to identify the device when it needs to be rejoined after dropping off the ZigBee mesh network.

A ZigBee ID is a unique 16-digit hexadecimal identifying string that is very similar to the MAC address used for IEEE 802 networks (i.e., Ethernet, WiFi, & Bluetooth). When a ZigBee device is paired with a hub, the device is supposed to send its ZigBee ID to the hub, and also the hub assigns a 4-digit hexadecimal Device Network ID (DNI) to the device (which functions similar to a IP address on a Ethernet / WiFi network).

If a device drops it’s connection with the hub for some reason, the DNI is unassigned, but if the device subsequently attempts to connect, the hub can use the device’s ZigBee ID to match to the device’s entry in the hubs device list, and assign it a new DNI.

Without any ZigBee ID, the hub has no way to match a disconnected device to its entry in the hubs device list. So both automatic rejoin and manual rejoin will fail. By manual rejoin, I mean when the user puts the hub and device in pairing mode in an attempt to rejoin it. Without the ZigBee ID information, the hub will decide it’s a “new” device, and the user has to set it and any of its automations up from scratch.

You can see whether a device’s ZigBee ID is known to the hub by logging into the SmartThings Groovy IDE and viewing the Device List Page:

As long as your device maintains it’s connection with the hub, not having the ZigBee ID isn’t a problem. So that’s why the “catchall” method works for many users. For others, due to interference or weak signal strength, they have issues that seem to indicate a lack of stability. Really it’s just that the hub can’t rejoin the sensor to the network.

In my testing, I have noticed that in rare cases, a Xiaomi / Aqara device will supply its ZigBee ID to the SmartThings hub after being paired using the “catchall” method. Also, it’s quite common for the ZigBee ID to show up in the Hub Events list (IDE > My Hubs > List Events) at the time when attempting to pair the device. It would be a 16-digit hexadecimal string beginning with 00158D (which indicates the manufacturer). Simply copy that entire 16-digit string, and then paste it into the hub’s device details for that device (IDE > My Devices > click Edit > paste string into “Zigbee Id” text field > click Update).

Actually there is a complete newer and updated set of DTHs for Xiaomi / Aqara devices, with links and discussion here:

All of these updated Xiaomi / Aqara DTHs correctly parse battery voltage data, and many improvements have been made both in functionality and features.

The updated Xiaomi “Original” Button DTH, which can be grabbed from here, uses the same method as a4refillpad’s DTH to emulate a button hold function, but with some changes in the code to improve reliability and accuracy. @MinerJason is 100% correct in saying that it can’t be fully reliable due to delays in SmartThing’s cloud execution of the DTH code, however.

Personally, I own both a SmartThings hub and a Hubitat Elevation hub, which executes all code locally, and having ported over all of the SmartThings DTHs to Hubitat can confirm that local execution makes a massive difference in reliability of the emulated button hold feature.

Honestly, if you are looking for the ability to do “long press” or button hold, I would choose another button besides the original round Xiaomi Button. I’d recommend an Aqara Button, but there are now three different revisions, and the only one guaranteed to provide hardware-based button hold that works on the SmartThings platform (using the updated DTH I mention above) is the Aqara Button model WXKG12LM.

1 Like

I’m not sure how rare it is. I know a lot of people like to fill in both the network id and zigbee id fields when using the catchall method (often with the same 4 digit network id), but I’ve always left the zigbee id blank. I find that if I leave it blank, and leave the device very close to the hub until the first check in (50-60 min for most Xiaomi devices), that the zigbee id will usually populate automatically within the first day or so. Absolutely agree that having the zigbee id helps tremendously in keeping devices connected long term.

Good to know! I like Brian’s xiaomi/aqara dth’s a lot, and currently use many of them. Last I tried that button dth didn’t have the emulated hold. I’ll have to take another look at it, because the improved battery reporting would be great!

I’ve been seriously considering moving towards Hubitat. The idea of local execution is really appealing to me for a variety of reasons.

Thanks. I ended up cutting the power to my only Zigbee repeater to complete the reregistration. Xiaomi Zigbee Door/Window Sensor, Motion Sensor, & Smart Button Device Type [beta]

Next time I will try the 30s battery removal and see if it can reconnect.

1 Like

I’ve read this thread well not al of it as so long. But I can find out I add them to SmartThings and to get it all to work. Can someone point immune into the right direction.

LOL. Sorry, but you’ve got a lot of reading to do!

I originally started with Original & Aqara Xiaomi Zigbee Sensors (contact, temp, motion, button, outlet, leak, etc) when I got my first Xiaomi device. I’m on Hubitat now, but I did pair a Xiaomi leak sensor using the information (somewhere) in it to pair the sensor shortly before I sold my SmartThings hub.