[OBSOLETE] Xiaomi Sensors and Button (beta)

I updated the code last night, it didn’t change anything right away but checked it today and both contact sensors are reporting 100%, thanks

Finally found it…try this

https://github.com/bspranger/Xiaomi/blob/master/devicetypes/a4refillpad/xiaomi-aqara-temperature-humidity-sensor.src/xiaomi-aqara-temperature-humidity-sensor.groovy

1 Like

All of my Xiaomi motion and door/window sensors became unresponsive today after many months of smooth sailing. I tried rebooting ST hub and short-pressing the pair button on the motion sensor but it didn’t work. Anyone else having an issue all of a sudden?

Try removing the battery and replacing it after a few seconds. Shouldn’t have to pair it again since it’s already paired. I see this like if there was a power outage or the internet went down

Hi,

Does anyone have any further guidance on how to pair this device? https://www.gearbest.com/alarm-systems/pp_610095.html?utm_source=email_sys&utm_medium=email&utm_campaign=shipping6
The xiaomi WXKG02LM. (it is a zigbee device).

While putting my ST app to “add a thing”, I have pressed the button for 5 seconds until the blue lights flashed 3 times. While at the same time, reviewing my ST logs. There was no “catchall” shown :frowning: I repeated the process 6 times for good measure).

I can’t think what else to do, any further guidance is welcome.

Many thanks

Wanted to let you know that I have been able to install Xiaomi door sensor and button without issue using the device handlers listed. Thank you!
As for pairing, I connected both by installing the device handlers first, then “add a thing”, long press and then a long series of short presses till the device was discovered. Have them both running for 2 days without issue.

2 Likes

I’ve got two Xiaomi buttons. The first one seems to be behaving itself OK, but the second one appears to be recording “held” quite often instead of a press. Even when I hold it for less than a second and I’ve set the DH to 4 seconds.

It also seems to be a little fiddly if it recognises anything, it’s closer to the hub than the other one.

Any suggestions? Is it worth trying a relink or do I have a duff one?

I seem to have fixed the temperature offset issue. I assume it’s only been affecting people using degrees F and not C. The highlighted “tempOffset” below, on line 163, is fixed. It originally just said “offset”. My sensor is now reporting temp properly with an offset of -2. :+1: Of course, you’ll have to apply this fix yourself, unless @a4refillpad & @ArstenA update their github code.

image

Awesome - updated my code.

I noticed both of my devices are already battery dead. Are these thing just refreshing non-stop? I’m not sure how to delay check-in to save battery.

I’ve had mine since early August and it’s reporting 66% battery right now. I’m not sure what the threshold is for reporting, but mine seems to report any time there’s a change in temp, humidity, or battery.

This is a great post. Needs to be pinned to the top. :slight_smile:

This worked for me. It was very easy for me to pair. I held down the sensor for about 3 seconds until i saw blinking lights. And then pressed the button once (short press) and was able to get the sensor to show up in the hub. Once I added the sensor as an unknown Thing, I changed the device type to Smartsense Moisture Sensor like MaverickASC suggested, and dunked the sensor in some water and was able to see Wet/dry right away.

Still not sure what happened to my Xiaomi devices. All but one stopped responding. Taking the battery out and replacing doesn’t work and trying to re-pair works for a while then the device again falls off the network. I will say that my zigbee NYCE garage door sensor also stopped responding at the same time which makes the whole situation especially odd. My many zigbee Iris door/window sensors are are still working fine.

The math for adding pressure offset is wrong. On line 248, it should be:
result = ((pressureval + pressOffset)/100 as Float)

Can you fork the code make the change and then do a pull request?

I have one of the motion sensors and I’m using the DH listed here.

I linked it up in June, and so far I have had a perfect track record of performance.

In that same time I have had to remove and repair my ST Motion sensors at least 2 or 3 times EACH!

Time to buy some more Xaiomi sensors I think… I just wish I could get them somewhere that didn’t take a month to ship to the UK!

EDIT: I just purchased 6 more.

I too am a big fan of the Xiaomi sensors. My 6 motions sensors arrived yesterday and they work just fine with the handlers in this topic. But from what I understand from the Xiaomi documentation, the motion sensors should also have light sensor capabilities. Has anyone managed to tap into the LS. If that’s the case what handler did you use?

I just now purchased the Temperature/Humidity sensor but can’t get it to work with this custom handler. I only see humidity ? It doesn’t update either. ?

So I fixed the 2 issues for the temp/humidity sensor handler in my own code.
(offset → tempOffset
and
the above mentioned calculation.
But now my sensors seems dead? Will pull the battery when I get home, see if it gets it going. Someone needs to update that code with these 2 fixes.

Have you added another zigbee device which is mains-powered by any chance?
My experience is that some repeaters don’t work well with Xiaomi sensors. So I decided to go full Xiaomi (and Zwave).

For quite some time i only had Xiaomi devices and used the Xiaomi plugs as repeaters. I had to take all the other brands offline, because sensors stopped working.

I now have added quite a few IKEA bulbs and these work fine as repeater for the Xiaomi sensors, but I have had bad experience with other brands like Osram and the original ST outlet.

1 Like