Xiaomi & Aqara Devices - Pairing & Keeping them connected

NOTE: Although many users have had great success using them, Xiaomi / Aqara ZigBee devices are NOT officially supported or guaranteed to work on the Hubitat Elevation platform.

Because of their small size, simple design, and relatively low price, the Chinese home automation (HA) market ZigBee mesh network-based devices from Xiaomi / Aqara have seen an increasing level of popularity in other countries, where users are attempting to integrate them with their HA hub platform of choice, instead of the Xiaomi or Aqara Gateway hub they were designed to work with.

However, because the currently available Xiaomi / Aqara ZigBee-based devices are NOT 100% compliant with certain aspects of ZigBee specification, there are significant limitations and challenges to be aware of when attempting to use them with a Hubitat Elevation hub.

The non-standard ZigBee implementation of Xiaomi / Aqara devices results in the following potential issues and difficulties when used with a Hubitat hub:

  • Pairing Xiaomi / Aqara devices may require multiple attempts before successfully being connected to a Hubitat hub, or in some situations fail completely.
  • Xiaomi / Aqara devices are incompatible with most ZigBee repeater devices, resulting in dropped connections when they connect via those repeater devices.

A ZigBee repeater device (also known as a ZigBee router) works similar to a WiFi Extender or WiFi Mesh router, allowing other ZigBee devices to connect to it rather than directly to the hub. Most mains-powered (plugged into wall power) ZigBee devices are repeaters, with a few exceptions including some ZigBee smart bulbs (such as Sengled's bulbs).

For general information to help successfully pair Xiaomi / Aqara devices, keep them connected, and lists of ZigBee repeater devices reported to be work / not work, please continue reading down through this post.

Pairing Xiaomi / Aqara Devices

Best Practices When Pairing

  • Before anything else, if you haven't read it already, please read Hubitat's informative and helpful How to Build a Solid Zigbee Mesh support how-to article. Based on that article, you should:
    • Check that you have enough ZigBee repeater devices, and if you don't have any, invest in some repeaters that are known to work with Xiaomi / Aqara devices. Please see a list of repeaters confirmed to work near the bottom of this post. However, you should also...
    • Make sure you don't have any "incompatible" ZigBee repeaters (i.e., reported not to work with Xiaomi / Aqara devices). Again, please check the list near the bottom of this post.
    • Pair your Xiaomi / Device in its intended final location, not next to the hub. As explained in the above linked how-to page, pairing a ZigBee device next to the hub and then moving it can result in a dropped connection or other issues (such as dropped ZigBee messages).
  • Follow the pairing procedure specific to the Xiaomi / Aqara device. In general, please refer to my basic pairing instructions found in this post. Here are links to pairing instructions / recommendations for some specific devices:
  • Be patient. Some users have reported needing to go through numerous pairing attempts before success. As in 10-20+ minutes of attempts.
  • If a Xiaomi / Aqara device just won't complete the pairing process, there are a few things that can be tried to manually pair it to a Hubitat hub. Please see this post for details.

Possible reasons for pairing difficulties

  • Interference from another nearby Zigbee hub and/or 2.4GHz WiFi router (see this post for more information)
  • The device may simply be difficult to pair with a non-Xiaomi hub, for example: the 2 button Aqara Smart Wall Switch model WXKG02LM.
  • Pairing through an incompatible Zigbee repeater device (see lists, below)
  • The maximum end-device limit has been reached: 32 ZigBee end devices can be connected directly to the Hubitat hub, and any ZigBee repeater devices used to go above that maximum will also have a limit on how many end-devices can be connected through them.
  • A "weak" Zigbee network mesh (e.g., the device is too far from the hub or a repeater)
  • The Zigbee Stick may need to be reset. (There is one reported instance of a reset resolving pairing issues with Xiaomi / Aqara buttons.)
  • Low battery voltage. Some people have reported replacing the battery on their newly received Xiaomi / Aqara devices solved pairing issues.
  • ZigBee Channel. See Changing the Hubitat hub's ZigBee channel, below, for more information.

Keeping Xiaomi / Aqara Devices Connected

Potential reasons for dropped connections

  • A "weak" Zigbee network mesh (e.g., the device is too far from the hub or a repeater)
  • Interference from another nearby Zigbee hub and/or 2.4GHz WiFi router
  • The Xiaomi device is connected through a Zigbee repeater device which has an end device timeout which is shorter than the normal Xiaomi check in frequency. (See list of repeaters reported to work / not work with Xiaomi devices below.)
  • Low battery voltage. Even with a relatively "high" reported battery level, some people have reported replacing the battery resolved dropped connection or "lost" message issues.
  • ZigBee Channel. See Changing the Hubitat hub's ZigBee channel, below, for more information.

Zigbee repeaters reported NOT to work with Xiaomi devices

  • Centralite 3-Series Zigbee Plug (Model 3100)
  • Centralite 3210-L Zigbee Smart Plug (same as Iris 3210)
  • General Electric (GE)
    • Zigbee Wall Switch 45856GE
    • Zigbee Dimming Wall Switch 45857GE
    • Zigbee Dimming Smart Plug 45852GE
  • Iris 3210 Zigbee Smart Plug
  • Ledvance RT RGBW recessed color light
  • Orvibo Zigbee Smart Outlet (see here for more information)
  • OSRAM/LIGHTIFY
    • Most OSRAM ZigBee products appear to be incompatible, based on various reports (see two possible exceptions in the "reported to work" section below.)
  • PEQ 4257050-ZHACP Lamp Module
  • Securifi Peanut Plug
  • SmartThings
    • Zigbee Outlet (any model)
  • Sylvania SMART+ Plug 72922-A (but the non-"A" variant seems to work)

Zigbee repeaters reported to work with Xiaomi devices

Possible solutions to Xiaomi / Aqara Connection Issues

  • Don't use any "incompatible" ZigBee repeater devices at all, just ones that are confirmed to work.
  • Make sure incompatible repeaters are distant enough that Xiaomi / Aqara devices don't route through them. Only an XBee or ZigBee sniffer can help verify this, but keep in mind this is a risky solutionbecause ZigBee end devices can change their connection to a different parent (router) at any time.
  • "Sandbox" your Xiaomi / Aqara devices on a different hub. Options:
    • Use a second Hubitat hub or SmartThings dedicated to just Xiaomi / Aqara devices and "compatible" repeaters, and use @srwhite's amazing HubConnect app to share devices to your primary hub.
    • Use a Xiaomi Gateway hub with your Xiaomi / Aqara devices and share them to your Hubitat Hub using @fison67's Mi Connector app for Hubitat.
  • Change your hub's ZigBee channel. See below for more information.

Changing the Hubitat hub's ZigBee channel

Changing the ZigBee channel of a Hubitat hub can be potentially disruptive to the normal operation of all ZigBee devices, involving waiting for the mesh network to "heal" itself and often requiring manually re-pairing or re-joining devices. With this in mind, it is probably best attempted as a "last resort" troubleshooting step. Here are a few things to consider before changing your hub's ZigBee channel as a troubleshooting step for pairing or connection issues with Xiaomi / Aqara devices:

  • Xiaomi Gateways have been reported to operate on ZigBee channel 25, channel 20 and channel 11 (here and here), so the assumption is these are "safe" channels for Xiaomi / Aqara devices. Also, a number of Hubitat users have reported success with their Hubitat Hub's ZigBee radio set to channel 13.
  • If using a 2.4 GHz WiFi router in the same house / space, note that the Hubitat's ZigBee channels and 2.4 GHz WiFi occupy the same frequency range, with the potential of issues due to interference. It is recommended that the Hubitat's ZigBee channel be set to a channel with the least overlap / interference with the 2.4 GHz WiFi router's channel(s), or vice-versa. Please see this post for more information.
  • Please make sure to read the Zigbee Information page of Hubitat's Documentation for information on how to change your hub's ZigBee channel.

If you are looking for Hubitat device drivers for Xiaomi sensors, buttons, etc, please see this thread.

20 Likes

I can get the Xiaomi original (round) temperature/humidity sensors to pair (I think?) and Iā€™m using bsprangerā€™s api but they donā€™t report temperature or humidity correctly. I think the api needs an overhaul. I get the following error:

For input string: "read attr - raw: 6DC50104020A0000298507, dni: 6DC5, endpoint: 01, cluster: 0402, size: 0A, attrId: 0000, encoding: 29, value: 0785" on line 220

Yes, I know exactly what is going on. I'll have a Hubitat device driver ready to test very soon.

6 Likes

I tried to pair the ā€˜originalā€™ Temperature and Humidity sensors and the pairing process worked perfectly again. Didnā€™t even have to try twice.
However, the reported values donā€™t seem to be recognized properly. Check-in times and the read Attr values do get updated but no temperature or humidity values are shown.

So this device is incompatible at the moment. However, I intend to keep this paired as is to test how long the pairing and Check-ins last, compared to the motion sensors I paired previously (which are still going strong).

That's good to hear. When it paired, did it show up as "Device" or was the SmartThings device handler automatically chosen as the device driver?

I have posted a v0.1 beta device driver for the Xiaomi "Original" Temp/Humidity sensor on GitHub. EDIT: now updated to v0.5, fully functional and compatible with both of Xiaomi's models of Temperature/Humidity sensors - please see this new thread for Xiaomi device driver releases.

It is reading the reported temperature and humidity values correctly so far, but I missed the first battery report after pairing, so I still need to change the code for that to work.

I did see the one Temp/Humidity sensor I was testing remain connected and reporting to the Hubitat for over an hour, but it dropped the connection after about 90 minutes. I was able to get it reconnected by going into "Discover Devices" mode, and then short-pressing the sensor's reset button, waiting for one long blink (failed to connect) or three-quick-flashes (successful connection), after each press.

On the third press, I saw 3 quick flashes, and it was reconnected without having to do the full pairing process! That's somewhat good news.

1 Like

I paired my round sensor to Hubitat and it did not choose the right driver even though I had already loaded your driver into the hub. It paired as a generic device and I had to manually select your driver after it paired. I will report back if it continues to stay connected. It was previously paired to ST and it remained connected and reported updates throughout the day.

I have fixed this issue, and created a new single unified device driver for both the Xiaomi "original" and Aqara Temperature/Humidity sensors.

As promised, I have started a new thread just for announcements of all new Xioami device drivers for Hubitat that I release.

Many thanks to you, @ajayjohnm, @oldernstone and others for your feedback! Please keep it up and hopefully we'll get these things working with the Hubitat!

1 Like

I moved all my Xiaomi Motion and humidity/temp Sensors over to the Hubitat.

  • first removed them all from SmartThings
  • Then I powered off and removed the batteries from my SmartThings hub to try and avoid any interference.
  • I have not moved any other zigbee repeater devices to my Hubitat yet
  • Then I paired my Xiaomi sensors to the Hubitat

I have left my SmartThings hub powered off to see how long they stay connected. So far 3-4 hours

To get my Xiaomi sensors to stay paired to SmartThings afew months ago I had to kill all the power in the house (didnā€™t want to disconnect all the hard wired zigbee switches) then pair to SmartThings.
Going to try this way first.

total
2 original Motion Sensors
4 Aqara Motion Sensors
3 Aqara Temperature/Humidity

2 of the Aqara Motion Sensors kept showing up only as a device but I changed them to the proper device type and they are working fine. I did try removing them several times and adding them again but these 2 always showed up as just a device.

I also have 7 SmartThings zigbee water sensors installed and they took about the same time to pair.
All of the sensors took a little while and a few attempts to pair.

Thanks for the feedback!

I assume that you added my device driver code for both the original and also Aqara Motion sensors, so if that's true, then if you have time, could you try re-pairing one of your Aqara Motion Sensors, copy and post the text that appears when the "More" button is pressed?

With that text, I can check whether the "fingerprint" used in the device driver to match to the device being paired should be modified. I only have one Aqara Motion Sensor, and it is correctly recognized as a match to my device driver every time.

yes using your code

first one:
manufacturer:null
address64bit:00158D00016DAF0D
address16bit:C2C1
model:lumi.sensor_motion.aq2
basicAttributesInitialized:true
application:null
endpoints.01.manufacturer:null
endpoints.01.idAsInt:1
endpoints.01.inClusters:0000,FFFF,0406,0400
endpoints.01.endpointId:01
endpoints.01.profileId:0104
endpoints.01.application:null
endpoints.01.outClusters:0000,0019
endpoints.01.initialized:true
endpoints.01.model:lumi.sensor_motion.aq2
endpoints.01.stage:1234:

second one:
manufacturer:null
address64bit:00158D00016DAF75
address16bit:1BE4
model:lumi.sensor_motion.aq2
basicAttributesInitialized:true
application:null
endpoints.01.manufacturer:null
endpoints.01.idAsInt:1
endpoints.01.inClusters:0000,FFFF,0406,0400
endpoints.01.endpointId:01
endpoints.01.profileId:0104
endpoints.01.application:null
endpoints.01.outClusters:0000,0019
endpoints.01.initialized:true
endpoints.01.model:lumi.sensor_motion.aq2
endpoints.01.stage:4

They both appear to have a hard time initializing I have to press the pairing button again sometimes several times after they are first found to complete the pairing.

Thanks for posting that information. So it appears there's 2 variants of the Aqara Motion Sensor! As you've already seen, I've updated the device driver with the new fingerprint based on your data.

Hopefully that will help the hub to automatically chose the correct driver for your Aqara Motion Sensors.

Sorry to repeat the news from my other thread, but this one is important and shouldn't be missed...

2 Likes

Both my original xiaomi temp humidity sensors are still sending updates. Itā€™s been 6ish hours since the hub update. Great work!

5 Likes

More good news:

When I checked on all of my Xioami sensors this morning, everything is still connected.

Even better, the Hubitat hub started passing on the status reports from my ā€œOriginalā€ & Aqara Door/Window contact sensors, Aqara Leak sensor, Aqara Motion sensor, ā€œOriginalā€ button, and 2-panel wall-mount switch, which is evidenced from regular battery state events from all of these devices, either every 50 or 60 minutes. Iā€™m not sure why it took over 2 hours after pairing for that to start happening, but the fact that they are still connected and reporting is a very good sign that they will no longer be dropping their connection with the Hubitat.

Iā€™m going to leave all of my Xioami sensors in the same room as the Hubitat hub for a few days, and if they remain connected, move them to more distant locations. I donā€™t have any other Zigbee devices that are routers (repeaters) so I donā€™t currently have a way to test if Xioami sensors will work in that kind of mesh topography along with the Hubitat. Hopefully someone else with Xioami sensors who does also have Zigbee router-capable devices can report here with their findings.

1 Like

that update happened about the middle of pairing all my devices and not sure all which where paired on the new vs old update. But I did have to re-pair my temp/humidity late last night after the update (they were initially paired on the old update) and re-pair late last night on the new update, they have stayed connected now over 14 hours now. Motion sensors I am not sure on which update they were paired half stayed paired over 14 hours but have now re-paired them on the new update so will see.
note: to re-pair I removed the devices and then re-added them.
Great news if they stay paired

I just paired a Xioami round button to Hubitat. It paired as a Device; when I push the button it produces the logging below (is there a button driver to try?). Iā€™ve mapped the mesh with my XStick and see that it is routing through an Iris SmartPlug. Iā€™ll let you know if it stays paired.

Xiaomi Button 6, parse description: read attr - raw: 4D3C0100060800001001, dni: 4D3C, endpoint: 01, cluster: 0006, size: 08, attrId: 0000, encoding: 10, value: 01

For me, the Hubitat chose my new Xioami Door/Window device driver when I paired my Xiaomi "original" button and I can check the Events to make sure it's still connected and sending reports, but since the "Device" device handler produces log messages, you could keep your Log window open to watch for that. If left idle, it should send a "status report" message every 60 minutes which will look like this:

read attr - raw: 81470100003002FF4C0600100121BA0B21A813240100000000215D062058, dni: 8147, endpoint: 01, cluster: 0000, size: 30, attrId: FF02, encoding: 4C, value: 0600100121BA0B21A813240100000000215D062058

If the Iris SmartPlug can pass on all messages and allow Xioami devices to remain connected, that would be awesome. Thank you for the feedback, and let us all know how it does. I do wish the Hubitat could give ZigBee mesh routing information. I'm going to have to get a ZigBee sniffer myself.

Not yet. But I have already done all the testing I need to make it. The big problem is how to approach the functionality of the device driver, considering that the button's hardware supports multi-clicks, and sends unique messages for double to quadruple-clicks.

Please refer to my Xiaomi device driver forum thread for more detailed information on my findings with the round button. I'm hoping to get other user's input on what they'd like from the device driver before I sit down to complete it.

After about an hour it stopped logging button presses. I put the hub in add mode and did a short press which produced 4 blinks, then this was logged (subsequent presses produced the shorter log entry as in my prior post; Iā€™ll give it a couple of hours to see if it drops off again):

2018-02-25 14:44:37.871:debugXiaomi Button 6, parse description: read attr - raw: 7DB10100003002FF4C0600100021EC0B21A8012400000000002182002063, dni: 7DB1, endpoint: 01, cluster: 0000, size: 30, attrId: FF02, encoding: 4C, value: 0600100021EC0B21A8012400000000002182002063

dev:2442018-02-25 14:44:37.818:debugXiaomi Button 6, parse description: read attr - raw: 7DB10100002C050042126C756D692E73656E736F725F737769746368, dni: 7DB1, endpoint: 01, cluster: 0000, size: 2C, attrId: 0005, encoding: 42, value: 126C756D692E73656E736F725F737769746368

So, weird thing here. Of my two round Xiaomi Temperature Humidity Sensors (Iā€™m just gonna start calling them RXTHS from now on) one is still reporting temperature and humidity every .5C change or so, and battery reports every hour. The other one is only reporting battery, hasnā€™t reported a temperature or humidity change in 2 hours. Maybe the temperature has been stable enough not to report anything, but that seems unlikely.

2 of my 3 Aqara Temperature/Humidity fell asleep as well just stopped reporting after 14 hours. I pushed the pairing button a bunch of times to wake them up and off they went.
I did move them to their locations so maybe just to far away but SmartThings work in these locations but maybe Hubitat can not do the distance. Will put them back there and see how they do.
The third one is closer to the hub and it is still working fine.
All of the motion sensor are still working fine as well but they are still sitting on my desk next to the hub.