Xiaomi & Aqara Devices - Pairing & Keeping them connected

I’m using the PEQ outlets as repeaters, how can you tell what the end device timeout is?

Are there repeaters that others recommend?

The device driver code creates the inactive event with a countdown timer, so the actual last message sent by the sensor was the same as lastMotion. Using the Epoch Converter webpage, I see that lastMotion was a minute earlier than the Last Activity Time.

So the sensor was online for about 50 minutes, which corresponds to check in interval for Aqara devices. In my experience, then check in message includes the battery voltage data, so if you don't see a battery percentage event, then that check in message was "refused" by the hub or repeater.

Since @mike.maxwell has stated the Hubitat's end device timeout is longer than 1 hour, my deduction is that this Aqara Motion sensor was probably connected through one of your PEQ outlets.

Unfortunately, without an XBee device to map your Zigbee mesh network, the only way to check if an end device is connected through a repeater is through the process of elimination (or if all repeaters are off).

I don't think there's any way to know what the end device timeout is for a repeater device. Maybe contact the manufacturer?

As for recommended repeaters to work with Xiaomi devices, I don't know of any that are 100% recommended. A number of people have been doing experiments / tests with different repeater-capable devices, and posting their findings in this thread.

Also, an XBee device can be used as a repeater, and its end device timeout (known as "Child Poll Timeout") can be user-adjusted, as explained in this post on the SmartThings Community Forums. If you continue reading after that post, you'll see that one person who has a couple XBees is doing some tests to see if his Xiaomi devices maintain their connection through the XBees - but with his SmartThings hub, not Hubitat, of course.

I have an XBee as well, but I haven't had time to do any tests to see if it will work well as a repeater for Xiaomi devices. When I have a chance to do that and also tests with my Securifi Peanut Plug I promise I will report back here.

I want to like these little guys, I really do...

2 Likes

So far, I’ve not had much problems pairing and keeping my Aqara motion sensors connected. But I did have issues when I’ve had ZigBee repeaters. Had to remove them to keep the sensors paired.

However, I’m having issues pairing the Aqara contact sensors. They just will not pair up. They pair almost immediately with ST, but refuses with Hubitat for some reason. I’m not sure if these have different firmware than the Aqara contact sensors that I’ve already paired, but they are a newer purchased set.

I had the same issues with with repeaters. I assumed, since there is so much wifi congestion in my apartment building, forcing the Aqaras to route through Iris plugs would give me a better chance at keeping mine connected. Not so. Direct pairing with the hub seems to be the way to go.

As for your new Aqara contacts, @veeceeoh was helping me with mine yesterday and we found a small issue with his driver, so first, make sure you have the most current one installed. Second, he mentioned he has heard of newer ones being sold through Ali Express that have different firmware. I would reach out to him if you still have issues pairing after following the instructions here.

Ya I really like how small they are. Are you having any luck? I have 12 of them and they all stayed on my ST hub once I unplugged all my zigbee repeater devices and they paired directly to the hub. Tried the same with Hubitat but no dice. Even with only one motion sensor attached to the hub with no other zigbee devices it dropped off.

How far from the hub is the furthers motion sensor for you?

I keep reading this thread and waiting for my Aqara leak sensors and button to drop. They just don’t. However, my furthest device is only 12 linear feet away in the basement. I don’t have any repeaters, unless the leakSmart valve is acting as one. It might be, I don’t really know.

So what I glean from all this is, I should stick to Aqara, and keep’m close to the hub. Too bad. I too would really like to “like” their motion sensors, but they seem to be more trouble than the monetary savings and compact size is worth

I have 2 Aqara motion sensors, and they have not dropped their connection with my Hubitat at all. Based on that, I got two more which just arrived a couple days ago.

I also have a dozen contact sensors, half of the "original" Xiaomi model, and half of the Aqara model. I've not had any problems with pairing either of them to my Hubitat.

However, a couple of weeks ago, I started having issues with pairing three different models of Xiaomi buttons that I previously was able to pair to my Hubitat. I tried changing the Zigbee channel, turning off my WiFi router's 2.4GHz radio and my SmartThings hub, and none of those things helped. Finally I decided to reset my Zigbee stick, which of course removes all Zigbee devices from the mesh, but leaves them all intact in the Hubitat's device list, so they just need to be re-joined (by repeating the same steps as pairing, but you won't see the device appear in the "Discover Devices" page.)

After resetting the Zigbee stick, all of my Xiaomi buttons paired easily again. I reported it to the Hubitat folks, but they aren't sure why the devices started refusing to pair and only a Zigbee stick reset resolved the issue. Either way, you may want to consider resetting the Zigbee stick as a last resort.

Just to check, though, when you say that the Aqara contact sensors refuse to pair with your Hubitat hub, does that mean you never see a Zigbee ID appear while in the "Discover Devices" page of the Hubitat?

Well, it was actually a big issue, because the code that handled open/close messages was not working.

It's important to understand that the device driver does not actually have any effect on the initial pairing process with Zigbee devices, and in the case of Xiaomi devices, it has zero effect on keeping them connected as well. All the device driver does is act as an "interpreter" of messages received from the device, and (if applicable) send commands to the device. Some of those commands may include the configuration of the device after it's paired or to set up how often it sends reports or check in messages. However, Xiaomi devices ignore all reporting configuration commands, and instead send reports only when there is a change, and the regular check-in message (at either 50 or 60 minute intervals, as I've previously mentioned).

I never said there may be a new firmware for a possible new version of the Aqara contact sensors, but since they are relatively simple devices, if there was any change to how they pair with a hub, there's nothing I can do with the device driver code to help with that. Honestly the only change I would expect with a new revision of the Aqara model would be to add temperature reporting and/or switch to an improved magnetic activated contact sensor.

Really, all of the Xiaomi sensors are known not to pair as easily as other Zigbee devices, both with the SmartThings and Hubitat hubs, and it can take repeated attempts.

Since I only have Aqara motion sensors, I have no experience with the "original" Xiaomi model, but it seems really strange that even without any repeaters, it still won't stay connected. This makes me wonder if the end device timeout setting from your PEQ outlets somehow propagates back to the Hubitat hub. Perhaps since you are currently doing testing, trying a reset of the Zigbee stick may be worth a shot.

Just to be clear - I am not advocating for everyone to reset their Zigbee stick as soon as they start having issues with pairing Xiaomi devices or keeping them connected! It was most definitely a last resort measure for me, and just happened to clear up my pairing issues.

1 Like

Mine area all the Aqara models.

So the problematic sensor that drops off the most is definitely the furthest from the hub. Brought the hub closer and its been connected for over 2 hours now. I’m guessing I need to find a repeater that works well with these, as the PEQ outlets I have aren’t doing the job. Actually now that I think about it, some of my other Aqara motion sensors were close to the hub but dropped off. Only explanation is that they paired to a close by PEQ outlet.

I’ve tried reseting the zigbee stick also.

How far from the hub is the furthers motion sensor for you?

The furthest sensor is probably around 30 feet, through multiple walls. But I also have other Aqara devices that are about 20 feet past that, and no dropping.

One condition that I had where the motion sensor would drop off is if there's metal between the sensor and the hub. I had one sensor mounted near a closet that had a metal frame, and after pairing it, if I put it at that location, it would drop off.

I will say that in general, it does seems that the Aqara motion sensor is more finicky to staying connected compared to the contact sensors or buttons. Once it's paired and reporting, however, it seems to be doing well.

Not sure if you've tried this, but you could do what I did: pair a sensor, leave it close to the hub for a few days and see if it drops. If it has stayed paired and motion registers, then move it to your final location and then monitor. If it drops afterwards, then there's probably an environmental issue at your location.

After resetting the Zigbee stick, all of my Xiaomi buttons paired easily again. I reported it to the Hubitat folks, but they aren’t sure why the devices started refusing to pair and only a Zigbee stick reset resolved the issue. Either way, you may want to consider resetting the Zigbee stick as a last resort .

Just to check, though, when you say that the Aqara contact sensors refuse to pair with your Hubitat hub, does that mean you never see a Zigbee ID appear while in the “Discover Devices” page of the Hubitat?

I was hoping to avoid doing that, but I may have to, at least try it.

When I say it refuses to pair, there's no log entry, the device doesn't ever show the connected signals, etc. But devices that have paired with the hub before, can drop off and then re-pair.

On a different note, I wish the UI would show a better indicator for when it is actually in pairing mode than the discovery page. It's not clear if the Hubitat is in discovery or not, unlike ST, where you cannot technically be in another part of the app simultaneously. Sometimes I'll have the device page open and the discovery page open simultaneously, or discovery open on my phone and desktop. If I switch out of discovery page, not sure if that cancels for all. But this is something for the Hubitat devs to deal with.

I've tried a few different ZigBee repeaters and have found they do not work with the Xiaomi's. I've tried Sylvania (the "a" variant), GE ZigBee wall switch, and SmartThings ZigBee outlet. The Xiaomi's paired fine, but then never pinged afterwards. So I got rid of all my ZigBee repeaters and only have either Xiaomi's or Z-Wave devices.

I have gotten into the habit of opening up additional browser tabs / windows with the main Hubitat Logging page and also the Zigbee Logging page before I attempt to pair any Zigbee devices.

The very first sign that pairing has initiated is to see entries in the Zigbee logging page and also the device's Zigbee ID appear in the "Discover Devices" page. Those first one or two Zigbee log entries won't have any device name associated with them. Then, if the pairing process completes, the device will appear ready to be renamed in the "Discover Devices" page along with the pairing details information, and there should be entries in the normal logging page if the device driver outputs messages on pairing and configuration. All of the current versions of the Xiaomi devices will output a few messages after pairing is successful.

However, a few time, I've seen with some of my Xiaomi devices I saw the Hubitat only get as far as displaying the Zigbee ID, but didn't complete the pairing process. In most cases I had to reattempt pairing, but a few times I have been able to add the device manually by clicking add "virtual" device, and entering in the Zigbee ID and DNI (device network ID, which can be found in the Zigbee log).

I would have to guess that all of those repeater devices have an end device timeout of less than 50 minutes, and so when they check in after the timeout period and the repeater sends a leave and rejoin request, the Xiaomi device(s) doesn't rejoin.

Since there is no way (that I'm aware of) to check what the end device timeout is for any repeater device, it's a total crap shoot for any untested device. With that in mind, I'm going to edit my starting post to add a list of Zigbee repeaters that seem to work / not work with Xiaomi devices.

As I've mentioned, I got an XBee so that I could look at the mapping of my Zigbee mesh, but as it's also capable of being a router/repeater itself, and its end device timeout can be changed, I plan on testing it as a suitable repeater to use with Xiaomi devices. They are sold as a hobbyist / development device though, so if you want it to look "pretty", some kind of case or box would be needed. But first let's see if it will work with Xioami devices...

I also open both zigbee and hub logs, but I don't even get to that with these specific devices. I was hoping it would get something so I can pair it manually, but nothing shows up after several minutes of trying.

I was also contemplating getting the XBee as I saw your post about it. But at this point, I don't really need a repeater as I'm splitting the ZigBee devices between the Hubitat and ST. I did need it when I only had ST and ran into the 32 device limit. If I run into the device limit again, then I'll jerry-rig an XBee setup.

This is so similar to the troubles I was having pairing my Xiaomi buttons (and also a Securifi Peanut Plug - forgot to mention previously). They'd pair almost immediately with my ST hub, and just nothing with the Hubitat. I must have tried over 50 times over the span of a week.

I reset the Zigbee stick, and bam, they paired just fine.

Important note when resetting the zigbee stick: The Zigbee channel will probably be changed to the channel that the USB stick's Zigbee radio sees as having the least interference. Not a majorly big problem because everything needs to be re-joined, but in my case, I had already turned off my router's 2.4GHz WiFi radio and powered down my ST hub, so the channel it chose wasn't actually appropriate for my particular environment.

So after moving the location of my hub I have paired the 2 furthest sensors and they have both stayed connected for 2days without dropping. I’ll try and add the other 10 aqara motions tonight.

So I had an issue adding some of my devices as they just didn't want to pair. I changed the channel to 26 then attempted to add the furthest devices again and I was having issues. Then I saw there was a recent hub update and it stated that the following:

  • Increased Zigbee transmission power

After the update I was able to get all 12 motion devices added on channel 26 without further moving the hub. This gave me good results for 1 day so I decided to add the rest of my non Xiaomi devices that range from Visonic and Peq contact sensors, Peq moisture sensors, ST outlets etc. This has been ok so far for 24 hours as well totalling about 40 zigbee devices...

I'm using this app that I copied over from ST to see if devices report back within a certain time so I know if they are still connected:

So far it seems that the latest hub update has improved things for me.

1 Like

Ah, that sounds promising, I have quite a few devices that just don't want to pair at the moment. I'll apply the latest update tomorrow and try again. Thanks for the heads up.

So as of yesterday I am 3 weeks into running on channel 20 after my Zigbee stick reset, with 30 devices still connected, 21 of which are Xiaomi devices. Besides those, there are also 2 Bosch PIR sensors, and 6 Sengled bulbs, 4 of which are connected through my Securifi Peanut Plug.

I’m ready to move more Sengled bulbs over from my ST hub, so I finally did some testing of Xiaomi devices connecting via the Peanut Plug, and also via my XBee S2 module. During all these tests, I used my XBee S2 module to view my Hubitat’s Zigbee mesh routing map so I could confirm which devices were connecting through a router (repeater).

My preliminary tests seem to indicate the Peanut Plug won’t work as a repeater for Xiaomi devices, most likely because it has a device time out which is shorter than 50 minutes. I came to this conclusion after 3 attempts to pair / rejoin two each of “original” and Aqara devices. In all cases, their connection was dropped within 50-60 minutes after pairing/rejoining.

However, the XBee is showing great promise as a compatible repeater! I currently have 6 Xiaomi devices connected via my XBee, 4 of which have been connected for 24 hours and regularly checking in, and 3 of which were newly paired via the XBee (i.e., I removed them from my Hubitat’s device list before pairing).

It’s important to note that I have set the XBee’s device time out settings to well over 2 hours, so that is probably a good reason for the success I’m witnessing. I am so encouraged by this that I am going to purchase another couple of XBee modules to strategically place around my (smallish) home.