Xiaomi & Aqara Devices - Pairing & Keeping them connected

Thank you for sharing this information. I really appreciate it.

I have a relatively small house as well (1400 sq ft), and my experience with my two Aqara Motion Sensors is that they have no more or fewer issues maintaining a connection with my Hubitat hub (or ST hub for that matter) than any of my other Xiaomi devices.

That said, one of them dropped it's connection last week, and when I re-joined it, it decided to go through my Securifi Peanut Plug, so that connection lasted less than a day. No surprise because in my previous testing I found that Xioami devices just won't stayed connected through the Peanut Plug. My theory is that the Motion Sensor switched from being connected directly to my Hubitat over to the Peanut Plug. I have removed my Peanut Plug from my network completely and will monitor how it goes.

Not surprising because the whole dropped connection issue is apparently due to Xioami devices not correctly following the Zigbee "leave and rejoin" message a hub sends when a device tries to check in after the End Device Aging timeout period has gone past. If your hub was shut down and missed one or more check ins from devices, when it was turned on again it may have asked the devices that had unsuccessfully tried to check in to "leave and rejoin". I base this theory on my experience with having to turn off my hub for some time while doing electrical work. When I booted it up again, some - not all - of my Xiaomi devices did not reestablish their connection and I needed to manually re-join them.

I'm sure your absolutely right about the Xiaomi not being fully compliant with the spec. I did just setup another button last night, and it was interesting that this was the first button I've had drop off. When I received it, I paired it with the hub, but I wasn't ready to put it to use, so I tossed it in a box in the basement, about as far as you can get from the hub and still be inside the house.

Unlike the motion sensor, which I was able to just press the pair button once to get it active in the hub again, I had to completely reset the button and pair it again with the hub. So far it's been fine now that it's in place, and not as far from the hub. Range definitely seems to be a larger issue with Xiaomi than any other device that is actually compliant. Sounds like @gavincampbell may have found a good solution. I'm hopeful it'll work for me too if I start having issues. I really like the size and design of the Aqara products and the prices are just sooooo easy on the wallet. Just received my first Aqara door/window sensor today. Wish me luck!

I think I have too. Today I did a test. Using xtcu I could see that 4 devices were routing through a specific sylvania plug so I pulled that plug. It was offline for about 5 hours and I was hoping the devices would reroute but I also realize that could take up to 24 hours. All they did was stop reporting in. I then plugged the plug back in and the devices came back online without me having to do anything.

This was better than I expected.

I have 4 of the sylvania plugs, one xbee and the hub. Looking at my device map my devices like the hub first, then the xbee and then one of the plugs. I have two plugs with no devices on them but need those plugs anyways so it just adds to the routing.

It has been solid now for a few weeks. No drop offs and I have devices scattered through 3 stories in a 2400 sq ft home. The devices report in almost every hour. Sometimes I can see that they can skip a few hours but they are still online and working.

One of the key things I did also was reset the zigbee stick. It put the hub on channel 23 which makes sense as that won’t cross over with the channels used by my eero. It looks like when you do a reset it does a scan and picks the best channel.

1 Like

I recently changed my HE ZigBee channel to 21 and now I'm rebuilding since 26 didn't seem to be an optimal option.

Using your settings I was able to get the first XBee3 to join but when I use the same config but just changing NI the second one won't pair. Are there any other settings that need to be unique?

I had the same problem a few days ago It was like it was stuck
where the hub initially saw the device but I tried doing some other settings so removed the Xbee and then tried re-pairing it but it didn't finish pairing and then hub would not see the xbee but when I did a scan with my other connected xbees they saw it connected to the hubitat network even though Hubitat didn't see it.
not sure if using Xtcu to recover the xbee and rewrite it's firmware fixed it or setting the problem xbee to an end device and then re-pairing it fixed. After setting it to an end device and re-pairing it to Hubitat. Hubitat could see it then. I could then remove it from Hubitat and reset the xbee setting back to a router and pair it again to Hubitat
I would try the recovery firmware option first.
end devices settings and a few I have also adjusted to attempt improvement
NJ = FF (to extend the joining time might help so device pair to them first)
NH = FF (maybe so devices could travel farther by going through more routers)
AP = 0 (for an end device)
SM = 1 (has to be not 0 for end devices)

of course to pair it after writing all the settings remove power from the xbee then put the hub into pairing and repower the xbee.

Updated last night to the latest FW, and had several Xiaomi devices drop off (last events recorded just before the update), after being connected with no issue before the update. Anyone else suffered this? Hopefully this is the result of the hanging after at 15% which a fix has been released today, but still a little worried. Cheers

1 Like

Not have any issues after the update, but I have experienced Aqara Motion sensors not responding after a reboot. Infrequently though. A press of the pairing button creates a new checkin and then they work fine.

Cheers @SmartHomePrimer, I'm watching the logs like a hawk just in case. It wasn't all of them just some. I've just updated again, and watching..... again. Fingers crossed they start reporting soon.

1 Like

@veeceeoh maybe remove The Orvibo Zigbee Smart Outlets from the list of compatible devices as they appear to cause more trouble than they are worth.
The Orvibo Zigbee Smart Outlets were creating a ghost mac FFFF device that could only be seen with the Xbee scans and created interference with other devices.
They did work with Xiaomi devices but may cause random problems.

So I have had my Xbee3 connected And all devices working for weeks but then I had a power outage and only a few rejoined automatically. All my non xiaomi sensors rejoined ok but I have about 1/3 of my xiaomi’s rejoin.

Any ideas on ways to improve the rejoining process with out me having to rediscover/pair them again?

Do you have battery backups? Later this week when my Xbees get delivered, I hope rebuild my mesh with as many Xiaomi sensors routing through them as possible. One Xbee will be plugged into an inexpensive phone charging brick that will be always plugged in, and the other Xbee will be plugged into the UPS that the hub is already on. That's my plan-whether it works, we'll see.

1 Like

I’ll second the UPS recommendation and suggest not to assume you need to re-pair your Xiaomi devices that are not connected. This happened to me when I lost power for an extended period.

First, try just pressing the pairing button, and watch the driver settings page to see if you get a check-in. If you do, trigger the sensor and look to see if you get an updated event.

I use a couple of "low-power" UPS units, both of which have USB ports in addition to AC outlets, so that my hubs and two XBees can survive (relatively short) power outages.

I haven't tried it yet, but for my 3rd XBee, I plan to get a USB battery backup phone charger pack and leave it plugged in to AC. I just don't know if they maintain uninterrupted USB power supply if the AC power quits suddenly. Even if it leads to the Bee restarting, that should be fine, I've restarted them (powered off and then on) plenty of times and not lost any Zigbee device connections.

This often works as opposed to putting the Hubitat in discovery mode and single pressing the pairing button, just remember that pressing the pairing button on Xiaomi motion sensors puts them into "testing" mode, meaning the hardware motion detection timeout shortens to just 3-5 seconds for a period of several hours.


Thanks Keith! That's really useful information I was not aware of.

@veeceeoh regarding the usb battery backup I have one plugged to one of my Xbees and then always charging plugged to the wall and the Xbee stays on if I pull the wall power.

1 Like

Would you mind sharing brand/model you are using? I tried two different ones and neither would charge and discharge simultaneously. I really don't want to have to get yet another APC with USB ports. Thanks

I have a very nice Anker battery and it's true!! I start charging my phone and then plug in the wall wart to charge it and the phone's charge light goes out. :frowning:

So yea, which ones do both? :slight_smile:

I got this one 6 years ago from Costco in Canada. It does not have a brand name on it only says "portable battery charger model apb02f" which looks similar to and has the same specs as an Aluratek (model number matches) but have they update the electronics and will new version still work I do not know. It doesn't look exactly the same as mine so it has been updated.

I also happen to buy a couple of new battery packs on amazon prime day an Aukey and an ikits you are correct they do not work at all, neither works with the Xbee.
The Xbee actually powers off after about a minute whenever plugged in to these does not matter if they are plugged to the wall or not it is like the battery packs do not sense enough draw and they power off.

1 Like

Thanks for the reply. I'll do some research and see what I can find. I don't really have the want or need for a full-fledged UPS in the location I'd like to place my second Xbee. I'll post for others if I find anything that works.