[OBSOLETE] Xiaomi Sensors and Button (beta)

Following on from the thread here

I’ve starting my own thread for my versions of the Xiaomi Motion, Contact and Smart Button device handler. This is so that people are able to find my device handlers easier and concentrate any discussion specific to my version of the handlers rather than previous ones made by others.

I’ve kept the status as “beta” as the actual hardware do not claim official HA1.2 compliance and are very tricky to pair initially. However, once they stay successfully paired for a few hours, they have been proven over the last couple of months to be extremely reliable.
However, I think it is fair to warn people that this is no guarantee that they will continue to work in the future.

More information about pairing in the original thread here and here. I would suggest people refer to that thread for lot of valuable discussion about the devices and pairing rather than asking here.

pinning this [post] ([OBSOLETE] Xiaomi Sensors and Button (beta) - #165 by Pbrain) as very useful for people having issues pairing.

I’ve now created a handler for the Temperature & Humidity sensor and uploaded into the same github repository.

Warning: Although I’ve included the outlet DH in the repository for completeness, I found that it consistently disrupted my zigbee network for my smartthings sensors causing them to drop off. Therefore personally, I cannot recommend them, however I’ve not heard anyone else reporting the same. So YMMV.

Some people have tried with the V1 hub. I do not expect these to work as it only started working on V2 after a firmware update Q4 of 2016.

This post contains a translated FAQ for the devices from the native Xiaomi website.

Contact Sensor:

Motion Sensor:

Button Handler:

Temperature and Humidity Sensor:


Any news on your temp sensor? :slight_smile:


I never received them and still trying to get my money back. Have not reordered in the meantime so will not be able to work on that device any time soon.

Great to see you starting your own thread. Thanks again for your work.


Good work, I’ve paired my first Xiaomi sensor, a door close sensor, paired by furiously pressing the pairning button before & till about a minute after pairing. But I still do not get the battery update, does it take time initially to appear ?

Also pressing the configure tile does not respond, i.e. it does not show anything.

EDIT: I paired a Xiaomi motion sensor using same method, and same symptoms, no battery level and the configure tile does not work. However I’m able to comfigure using the icon on top right.

EDIT: with the same method, paired a Xiaomi button, it shows battery status, but the other two (motion & door sensor) still does not show battery status.

EDIT: Door close sensor reported battery as 90%

All of this is in the original thread. If you get nothing after a few hours you need to repair until it sticks. This is nothing to do with my handler. I strongly recommend people have a look through the links in the OP to help answer these questions.

Hi Wayne.
I have some of these on order so I’m following this with interest.
Sorry to split hairs here.

Do you mean re-pair or repair as in fix.
Again sorry for the question. :smile:

You are correct… “re-pair”. It is a pain, but you only need to go through it at the beginning , once done they seem to work great. In fact, in my set-up more reliable than my smartthings branded sensors.

I hope they are better than the ST ones as I am sick of continually having to remove/put back the batteries twice a week.

1 Like

I’m glad I’m not the only one doing that recently… since the last hub update, i’ve been doing this randomly on my 27 smartthings sensors… Not had to do it once on any of my Xiaomi sensors yet… fingers crossed.
If it weren’t for the most excellent simple device viewer, my system would be completely up the creek by now.

1 Like

I appreciate all you’ve done here a4refillpad, but I’m struggling with this and I’m hoping you can help,or at least tell me from the folowing where I’m going wrong.

So, I created a device handler from your code (motion sensor) and saved and published. I have then added a new device using the ‘Xiaomi Motion Sensor’ from the drop-down, inserted the ‘catch-all’ string as mentioned in the other thread and added the device. But it just doesn’t seem to recognise motion. Initially the app reads as ‘Motion’ in orange, I then reset that let it sit for a while and try to trigger it, but nothing.

This is the first time I’ve tried working with something which isn’t generally compatible with ST so although I think I’ve followed the process correctly I could be way off.

Do you see any events for the device you’ve added in the IDE? I suspect you haven’t successfully paired it to be honest. If you don’t see any events then you’ve not been successful in pairing and will need to try again.

Ye, nothing other than the event following me clicking the “Reset Motion” button within the app. I’ve tried 4 or 5 times with this now and each time it’s the same result, so I must be doing something wrong along the way, just not sure what. Thanks though, I’ll keeping on trying.

Right, initially adding it as a new device in the IDE is what was causing the problem for me. Removing that and just standing next to the hub and pushing the reset button in a random fashion finally found it as a new device and seems to be working well, for now.

1 Like

Thanks a4refillpad for setup a new thread and putting everything together.
I finally got my Xiaomi motion sensor today and was able to paired it with SmartThings in less than 3 minutes.
The sensitivity, distance, and motion detect angle are way better than Samsung SmartThings Motion Sensor.
It reported 83% battery life left for my Xiaomi motion sensor brand new out of box.
Question, is the Configure button suppose to do anything? When I clicked on it, it didn’t do anything.

1 Like

It does in fact enrolls some configuration down to the device. I not 100% certain the device fully recognises it but does not complain. It’s something i inherited from early device handlers that were successful with getting them stick. The handler does now send the config down automatically when the device joins so may not be necessary having the tile any more. It’s something that I’m playing with and may remove in future revisions.

@a4refillpad Thanks for your hard work regarding this. I have read through all 800 post regarding this and I’m looking to pull the trigger on these however I just wanted to confirm if we need the xiaomi hub or I can connect them directly to smart things. I also wanted to know the best place to get the motion sensors as I saw you did not receive some of your products?

You can connect without the hub. I would advise adding insurance option to any orders made with gearbest and others if you make a larger order. I found that you are left without any compensation if you item does not turn up otherwise.

as long as You pay with paypal you are safe… allways do that…

I only had one issue with GB in many many orders, and was about a refund and return… they were taking to long and paypal resolved…

no store that that can afford having paypal issues :slight_smile:

@a4refillpad @Paulo_Nobrega Thanks for the reply, anyone have experience of them in UK I’m about to put an order in just now