Xiaomi & Aqara Devices - Pairing & Keeping them connected

Great, got them all paired back up without having to remove them. Hopefully they all stay on on the new channel…

So I rejoined everything but then the problemmattic xiaomi sensors dropped off again even after changing the zig bee channel. Is it the same in Hubitat like it was in ST where it was recommended to not have any repeater devices on during pairing?

Personally I have no experience as I've just bought my first Zigbee repeater and managed to get it to pair with my Hubitat a couple days ago. It's worth a try to unplug all repeater devices though.

If you scroll up through this thread, look for @NoWon's posts about his ongoing tests with different repeaters.

How can you tell wether it paired to the hub vs a repeater? I have a few PEQ smart plugs which is a rebranded Centralite 3-series plug, same as ST, LOWE's etc., plugged throughout the house for various things like coffee machine and space heaters... So I'm wondering if these repeaters arent good with Xiaomi devices. Right now all my non Xiaomi devices stay connected with no issues, and about half my Xiaomi devices stay on. So i'm wondering if the ones that are dropping off are paired to repeaters, jut don't know how to tell.

When connected to the hub and working properly (responding to commands).
If you unplug the smart plugs do the devices stop responding to commands?
If they do then they (the signal) are going through the smart plugs.
If they continue to work normally then they are not going through the smart plugs.

If they are not going through the smart plugs
You will have to remove the devices from the hub and then with the smart plugs plugged in re pair the devices back into the hub. Then test them to make sure they are going through the plug again.
Best way is to remove power from all repeater devices that you do not want to go through and then pair the device. then restore power back to the other repeaters.

Other than @NoWon's suggestion of unplugging repeaters to see if devices still respond to commands (or in the case of Xiaomi devices, send reports, because they don't respond to commands), there's nothing available from the Hubitat hub interface to help.

I have read on the SmartThings forum that using an XBee module and XCTU software, a Zigbee network can be mapped, which shows exactly which devices are connected through repeaters:

I have just ordered an XBee myself, so I am going to be learning about this in more detail soon!

So after all the problematic sensors were rejoined they all fell off again. So i did a remove and repair to see if that would be better now that all the zigbee repeaters (centralite plugs) were also plugged in an powered. They all fell off again. I’m going to change my zigbee channel and try again. Next i’ll try without repeaters like I did with ST. ST worked fine with all my sensors. So far with Hubitat as soon as I added the non xiaomi sensors most of my xiaomi sensors started to fall off…

for my problematic devices I did not remove them from the hub.
I put the hub in pairing mode and then with the battery cover off of the device very quickly lifted the battery slightly to remove power and put it back. Basically a reset and then pushed/held the pairing button until it flashes 3 times. It has been a few days and they have stayed.
Not just my xiaomi zigbee devices.
doing it a few times just to make sure you got it to reset does not appear to hurt.
I suspect like my SYLVANIA plug the other zigbee devices may not be pairing completely/correctly but once partially paired you can then complete the full pairing.
Just like my SYLVANIA plug which once completely/properly paired has been fine for 10 days now.

I also noticed that when discovering a device and a device was stuck in initializing that doing the battery reset made them complete.

I got my XBee connected last night, and had a look at my Hubitat's Zigbee mesh map.

It turns out there's just two Sengled bulbs connected through my Securifi Peanut Plug. But at least now I can do some experimenting with how well Xiaomi devices work/stay connected when paired through the Peanut, or if connected to the Peanut after first pairing directly with my Hubitat hub and then rebuilding the mesh (by turning off the Hubitat's Zigbee Stick for 20-30 minutes).

I didn't mention it before, but an XBee can also work as a standalone ZigBee repeater. I'm looking into whether I can power it using a powered USB hub and then when I need to map the mesh network, I could just plug in my laptop to access the XBee.

It will take a while for me to get back with some reports on my Xiaomi device & Zigbee repeater experiments though, because I have been experiencing a number of issues with my Hubitat in the past week. Just last night I discovered events on all devices that Apps were subscribed to were being completely ignored - WebCore, RM, etc., and it was only resolved with a reboot of the hub. Also, a number RM rules have not been working this week as they have, despite no changes. It's very frustrating and I am really glad that I'm still testing out my Hubitat with a limited number of devices and just a few rules rather than having completely moved over everything immediately from my SmartThings setup.

damn the wife is going to kill me but I ordered the 100 mW version to help extend my coverage area as well.

I’m finding that my Aqara sensors never drop off my network but the original Xiaomi ones do.
I never had any problems with ST. All types were rock solid.
Both my ST and HE hub are using zigbee channel 20.
Would that cause an issue?
I’ve just changed my HE hub to channel 21 to see if it makes a difference. Just waiting for things to check in then we will see what happens.
Is anybody else having similar issues? i.e. Aqara OK but Xiaomi flakey?

From everything I have read, yes, that creates potential for issues due to interference, especially if the two hubs are located nearby. Also, if you're now using channels 20 & 21 for Zigbee, your 2.4GHz WiFi should be set to channel 1 for the least interference. See my earlier post in this thread here (if you haven't read it yet.)

As for Aqara sensors vs original Xiaomi ones, I have a bunch of each of Door/Window Sensors and Temp/Humidity sensors, and haven't seen any trend for one type or the other dropping their connections.

My SmartThings hub, which is in the same centrally located room as my Hubitat and my 5GHz/2.4GHz WiFi router, is on channel 15, and I also never had any Xiaomi devices (original or Aqara) drop off.

Here's what I've tried for channels with my Hubitat Hub so far:

  • Channel 26 - Most Xiaomi devices paired relatively easily, and out of 21, just a nearby Aqara Leak Sensor and a more distant original Xiaomi button lost their connection after 3-4 weeks. I did some reading on Zigbee & 2.4GHz WiFi interference, and after l checked the WiFi channels used by neighbors and read up on how my WiFi router handles its 2.4GHz high-speed mode (see my post here), I decided to change my WiFi 2.4GHz to channel 11 and my Hubitat to Zigbee channel 13.

  • Channel 13 - I got impatient waiting for devices to "find" the new channel after changing it, so I sped up the process by manually re-joining them, which went quite smoothly. But then about a week later, when I was trying to re-join a couple of original Xiaomi buttons that I had temporarily moved over to my SmartThings hub for some DTH code testing, my Hubitat just wasn't "seeing" them.
    I also wasn't able to pair a number of other Aqara buttons, including two of the brand new Aqara model WXKG12LM that I had been able to pair with the Hubitat just some days prior. I even tried temporarily changing to a number of other Zigbee channels to see if the devices would repair, but with no success. After another week, after Hubitat staff confirmed there hasn't been any changes in recent hub updates, and I also wasn't able to pair a Securifi Peanut Plug I bought, I decided to reset my ZigBee stick and start all over again.
    Due to a glitch with manual Zigbee Channel selection not working correctly after the stick reset, I landed up on channel 20 (but thinking I had chosen channel 13) and suddenly I was able to pair all the devices that had been refusing to pair. Interestingly, before I had reset the Zigbee stick, I had tried pairing devices with the channel set to 20 with no success. So it seems that something had gone wrong with the configuration or data stored on the Zigbee stick that was only cleared out by resetting it. With channel 20 chosen, I then needed to change my 2.4Ghz WiFi channel again, so I've set it to Channel 1 for the least interference.

  • Channel 20 - It's been about a week, and so far, so good. The Xiaomi buttons and the Peanut plug paired easily, as was re-joining all the other Xiaomi devices and my Sengled bulbs that were still on my Hubitat's device list. Since I now have an XBee that allows me to look at the map of my Zigbee mesh, I will be experimenting with Xiaomi devices connecting through the Peanut Plug (which works as a Zigbee repeater). I'm crossing my fingers that I don't run into the same troubles as mentioned above which required a Zigbee stick reset to get things working again.

Quite the journey you’ve been on with your Zigbee devices! Lucky 13 still serving me well, including with the two Xiaomi leak sensors and my new Aqara button. Probably because I don’t have that many devices and nothing really that far away from the hub. :man_shrugging:

Thanks for the info @veeceeoh
I had already allocated my router to a fixed channel. Picking 1 as it is out of the zigbee channel 20 range.
Changed my zigbee channel to 22 and re-associated all my Xiaomi devices.
I’ve left ST on channel 20.
Will see how long things remained paired up.
They did stay connected for over a week before they started to gradually drop off.

No matter what I do I cannot get my Xiaomi motion sensors to stay connected. I have about 12 of them an only 1/2 of them stay paired. I’ve tried changing my wifi and zigbee channels based on @veeceeoh charts to ensure there is no interference, reseting the zigbee stick and deleting and re-adding all the devices. But no matter what I try everything drops off. Anyone have luck with 12 or more motion sensors staying connected? When I was using ST they were at least staying on.

I currently only have 4 motion sensors configured, but they seem solid after resetting, changing channels and only pairing them with the Osram Lightify bulbs powered off.

@humac - How long do the motions sensors remain connected before they drop off the network? An hour, or more?

Also did you do a test without repeaters as you mentioned about a week ago?

I know it's frustrating when Xioami devices worked well or better with a SmartThings hub, but the Hubitat isn't identical in terms of hardware and Zigbee setup.

As for the reason Xiaomi devices drop their connection, it is very likely related to "End Device Aging", as explained by Tom Manley, a SmartThings Software Engineer, last year on the ST Community Forums:

As you probably know, the Xiaomi sensors are very sleepy. Most sleepy end devices that we support will wake up every 6 seconds to 2 minutes to check for messages and to make sure its parent knows it is still there. The Xiaomi sensors do this closer to once an hour. That is zigbee compliant behavior so everything is fine so far.

The zigbee specification includes a section called End Device Aging. It states that a parent must forget about a child that doesn’t check in for a certain amount of time. In other words if the parent (like the hub or another router on the network) hasn’t heard from a device within a certain amount of time it must tell the device to leave and rejoin the network. This isn’t an uncommon thing to happens on a zigbee network and most devices will handle this just fine. When the device does it right you’ll never even notice it was gone for a brief period.

By using a zigbee sniffer I can see all the communication between the sensor and the hub. The sensor is quiet for about an hour and then sends a checkin message to the hub. The timeout for end devices has elapsed so the hub’s zigbee radio doesn’t recognize the sensor anymore. Therefore per the specification it sends the sensor a leave and rejoin request. The sensor replies with a message saying it is going to leave and rejoin. Then it does leave but it does not attempt to rejoin. Instead it appears to factory reset itself. This is why it drops offline and I believe is non-compliant behavior.

According to Tom, the SmartThings hub firmware v0.17 did not send a leave and join request - which was probably a bug, and v0.18 of the firmware included an update to the Zigbee stack which likely fixed that and then users saw their Xiaomi devices start dropping their connections.

One of Tom's suggestions as a workaround was to use a Zigbee router (repeater) device:

One thing you can try to get around this issue is to get the device to join through a device other than the hub. Different routers can have different end device timeouts and if you can find one that has a long enough timeout or that doesn’t enforce the timeout then the sensor may stay on the network. You’d have to have the sensor far away from the hub and close to routers like outlets or bulbs while you join it.

However, if as he explained, different routers/repeaters have different end device timeouts, it's also possible that routers/repeaters with a timeout less than an hour leads to Xiaomi devices connected to that router/repeater dropping their connections. In other words, some brands of Zigbee repeaters may help keep Xiaomi devices connected while others make things worse.

So in your case, any Motion Sensors connected through your Centralite Plugs may be dropping their connection while the ones connected to the Hubitat remain connected.

Something else important to know with regards to End Device Aging and the end device timeout of the Hub and any repeaters is that "original" Xiaomi devices send their check in message every 60 minutes, while the Aqara devices send it every 50 minutes. This means if your hub or repeater has a end device timeout of 60 minutes, "original" Xiaomi devices are more likely to drop their connection, but it may not be all of them, due to variances in the exact timing of their check in message.

As for the Hubitat hub, I have no idea what its end device timeout is set to or whether it sends a leave and rejoin request to devices that haven't checked in before the timeout - perhaps @mike.maxwell knows? All I do know is that something changed with hub update 698 that resulted in Xiaomi devices remaining connected much more consistently than they were prior to that update, based on my and other users' experiences.

I don't remember what the exact number was, but we did set this to over an hour.
Whilst I haven't done a packet cap on these long enough to see them ignore the rejoin request, based on my experience with one of them, that's appears to be what it's doing.

1 Like

@humac -

Based on @mike.maxwell’s reply, my theory is that the problem of some of your 12 Motion Sensors dropping their connection is most likely due to being connected through a Zigbee repeating device which has a end device timeout of less than 60 minutes.

I reset every thing and only paired a single zigbee Xiaomi Aqara Motion device to the hub without any repeaters and this is what the device details show

Create Time 2018-04-18 16:05:28 EDT
Last Update Time 2018-04-18 16:05:41 EDT
Last Activity Time 2018-04-18 16:50:12 EDT

lastCheckin: 1524084551517
lastInactive: 1524084612533
lastMotion: 1524084551604