Xiaomi / Aqara ZigBee device drivers (possibly may no longer be maintained)

I have one of these motion sensors paired to my dev hub, there are no repeaters in this setup and the sensor is a foot from the hub.
It has not stayed on line for very long.
So this morning I fired up the sniffer after resetting the sensor. I'll leave the sniffer running until the sensor drops again, I can't make any solution oriented promises, but maybe this will shed some light on the situation here.

I noticed my bathroom sensor isn't giving motion updates but it is still giving battery updates. Seems odd the one would work but the other wouldn't.

Weird, I turned on debug message logging, and it started showing both debug and motion updates in the rt log.

Thanks, all the same as what I'm seeing with my cube. Still working on the device driver port, and it will take a little longer than with the others because spring is in full swing and it's too nice to be sitting at a computer for hours (when I'm not paid for it!)

Strange, since myself and others are having much better luck since the 698 update. If the end device timeout is longer than the 50 / 60 minute check-in cycle of the Xiaomi devices, then it will be interesting to see what else is going on.

It's also possible that your motion sensor didn't perform it's first check in. I've seen that happen a number of times in my testing - no battery report (an indicator of checking in) until 100 or 120 minutes after pairing.

You should also see motion active events (and the automatically generated motion inactive events) in the events list.

I have not seen this happen with any of my 3 Aqara Motion Sensors. I don't know whether it's related, but keep in mind that both types of motion sensors go into a test mode when paired or if the reset button is short-pressed. During test mode, which lasts about 1.5-2 hours, the hardware resets motion detection sensing 3-4 seconds after motion is detected instead of 60 seconds.

The default driver-generated motion inactive event is based on a runIn countdown timer (with a default of 61 seconds), which gets reset and restarted if there's a motion detected event before the countdown finishes. Due to that 61 second default, during Test mode, motion detected events are still logged every 3-5 seconds, but only after no motion has been detected for 60 seconds would you see a motion inactive event.

After the test mode finishes, then of course motion detected events can only happen at a minimum every 60 seconds.

1 Like

My cube shows source and target faces which I can use on Webcore:


I'm new to all of this and I am considering buying a Hubitat,

I have a ton to read but before I do I am wondering what exactly should I be buying from Xiaomi for a smart home?

Do I need the Xiaomi hub?

Anyone ever make a list of items they purchased for their smart home (Xiaomi)? I'd love to copy it!

You don't need the Xaomi hub. You can pair them directly with Hubitat once you install the community provided drivers. They are not fully compliant with the Zigbee spec, so your mileage may vary.

I strongly recommend you get your hub first, and then if you want to try Xiaomi devices, you should just purchase Aqara devices to "play" with and see how they work in your environment. They are somewhat of a pain to pair, and if you're too far from the hub, they will drop without a plug-in device to repeat the signal and strengthen your Zigbee mesh. I've had good success with them in a small house, but none of the devices are that far from the hub. If you have a larger home, and especially if your hub is not centralized in your home (it should be though, all your hubs and WiFi routers should be), then you're going to have better success if you just purchase a Sylvania Smart+ plug in advance to help strengthen the mesh for Xiaomi devices (but all Zigbee devices will benefit from it).

Read this thread so you are informed about what you're getting into with Xiaomi devices. TBH, you might not want to try the Xbee stuff in that thread initially, but it all depends on your experience.

Some of the Xiaomi Aqara devices are pretty darn solid performers, and so far I have not added a repeater, but don't be shocked if they don't stay connected and you have to re-pair them with the hub from time to time. Again, it's hard to know until you try, so don't go crazy and order a ton of them in the beginning. Also, as you're getting used to Hubitat, I would suggest you work with devices that are compliant with the Zigbee spec and Z-Wave Plus, otherwise you're going to think there's a problem with the hub radio and it's not fair to make that assumption with devices that were never intended to pair with it, but have been made to work thanks to the dedication of the community.

I'm running my hub's Zigbee on channel 13. This doesn't interfere with my WiFi or the Hue bridge near by, and I've had good success with the Xiaomi Aqara devices I own. There are different reports of different channels working better for other people. Some experimentation may be needed.

No Xiaomi device in my setup is more than 20 linear feet from the hub zigbee/zwave stick.
Here's what I have and how they have performed.

Xiaomi Aquara leak sensor: Installed Mar 09, 2018 - No drop-off
Xiaomi Aquara leak sensor: Installed Mar 23, 2018 - No drop-off
Xiaomi Aquara button: Installed Apr 11, 2018 - No drop-off
Xiaomi Aquara button: Installed May 7, 2018 - No drop-off
Xiaomi Aquara motion sensor: Installed June 13, 2018 - One drop-off after an extended hub shut-down due to downed power lines. Pressed pair button once and it came back online, So far it has not dropped again.
Xiaomi Aquara door/window sensor: Installed June 13, 2018 - Had to be reset and re-paired on June 20. No drop-off since
Xiaomi Aquara button: Installed June 17, 2018 - No drop-off

Good luck with the Xiaomi adventure. Enjoy your Hubitat hub. Take your time and as long as you remember it's still in development, you'll have a more satisfying time working with it as it quickly improves.


I wish I could say that I've shared your experience. :frowning:

I've had nothing but trouble with my Xiaomi sensors since migrating to Hubitat. Smartthings rarely dropped a sensor once they were properly paired and reporting battery for me.

With HE, I have had all of my Xiaomi devices to drop at once, and many frequently continue to drop or fail to respond.

I'm at the point now where I don't even bother resetting the sensors, but I'm too lazy to migrate them and their respective repeaters back to ST. So much for keeping it local.

Take a look at the zigbee channel as well. I did a reset of the zigbee stick and it set a new channel (23) I think based on what had the least interference with my wifi. It makes sense based on the channels my eero setup uses. Since then its been very stable and no drop offs.

1 Like

And still going strong! My door/window and motion sensor have been working like champs. I think @gavincampbell 's advice to reset you Zigbee stick and try to get a channel that doesn't interfere with you WiFi (or get interference from it) is probably going to help. If you're devices are far from the hub, you're going to need something that can repeat the signal. Look into either a Xbee or some Sylvania Smart+ (non A series) smart plugs.

Its been a number of weeks now and things are humming along nicely.

As you said, when I reset my Zigbee stick it put zigbee on channel 23 for me. My eero network runs on wifi channels 1 and 6 so the interference is very minimal with this setup.

I wrote a WebCoRE script to monitor all of my Xiaomi devices. Basically, every 30 minutes, it will check if they haven't check in at least once in the last 2 hours and it will send me a text to notify me of any 'dead' devices. They have all be checking in perfectly. I had one device drop off this weekend and stop reporting in, but I walked up to it, pressed the button and it was back in business. Its good to know when a device stops reporting in.

I've even seen not Xiaomi devices (such as my sengled bulbs) go inactive, but they eventually kick in themselves again too and they still respond if I send a command.



Thanks for the amazing work and putting together all these IDE's. it is a great help. However when i trying to add these IDE few of them are giving an errors. please see below;

Java.lang.RuntimeException: Metadata Error: Capability 'PushableButton' not found.

smoke detector:

Org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed: script_dth_metadata_e8a30903_596f_4f7c_a668_66e33d17d94e: 85: unable to resolve class hubitat.device.HubAction @ line 85, column 27. result = cmds?.collect {new hubitat.device.HubAction(it)} ^ 1 error

many thanks

A few guesses:

  1. Pardon my asking a silly question, but are you using Hubitat? If you're trying to use these with SmartThings, you will need to use a device type handler written for SmartThings instead.

  2. These should be added under the "Drivers Code" section. Maybe you're trying "Apps Code"? (Though the error messages don't really sound like it.)

  3. Maybe there's a copy-and-paste error? If you're getting them from GitHub, click the "Raw" button to see all the code as plain text, then do a "select all" and paste that into the IDE. This generally works better than trying to copy the code from the pretty, formatted box GitHub shows by default (though most links above I think already point to the raw code).

PS - Just to help with being clearer, IDE means "integrated development environment," a term we are perhaps too-nicely applying to the SmartThings web interface that allows you to upload custom code (device type handlers and SmartApps in SmartThings-speak) and also the similar Hubitat code editor that is accessible from its web interface uploading custom apps and drivers (as they are called on Hubitat). "IDE" is not the term for the code itself. I'm assuming you meant to say that you are trying to add a custom driver to Hubitat and that is when you encountered these errors. Let me know if that's wrong!

I am not able to reproduce your errors. The most recent releases of device driver code for the Mi Cube and Xiaomi Honeywell Smoke Sensor can be saved without error as Hubitat hub device drivers on my Hubitat Hub which is running the most recent hub firmware as of today.

My guess is the same as @bertabcd1234:

The SmartThings hub does not have the PushableButton capability, which is why I guess that you may be trying to save Hubitat device drivers as Device Handlers on a SmartThings hub.

Just received the Aqara xiaomi smart lightswitch QBKG03LM this light switch has two buttons and relays needs no neutral to switch and drectly replaces a UK light switch. The Hubitat hub sees it but, as know surprise, as a device. Time to play.

I'm just starting to migrate some devices from my smartthings hub to hubitat. I added the driver code for veeceeoh's Xiaomi Original Motion Sensor from this thread, and removed one of my xiaomi motion sensors from smartthings (removed device, held reset button on xiaomi til it flashed 3 times). I went to hubitat and started discover devices, and it showed up, but appears to be stuck on "initializing...". This is the first device I'm pairing natively to the hubitat (did hue already, but that's a LAN connection), and I'm not sure what's supposed to happen after that.

I remember having to manually set up the device in smartthings, with a piece of the uuid from the discovery, do I need to do the same in hubitat?

That's not a possible solution here, nor is it needed. Remove the battery for 30 seconds, then try pairing again. Xiaomi are sometimes a pain to pair and will get stuck at initializing. Just try again. Once paired they work well as long as you don't get too far from the hub. You'll need either a Sylvania Smart+ plug (not version A) or a Xbee if your Xiaomi devices are more that roughly 30 linear feet from the hub.

I had to hold the reset until the LED flashed three times .... the initialization usually starts then. Then I had to push the reset (and release) button about every two to three seconds to keep the initialization alive until the device completed discovery. Sometimes it took another 30 seconds to complete the discovery process.

1 Like

I usually hold for 10 seconds, which is probably the time is takes for the LED to flash three times as @Matthew says he does. I've had mixed results with the tapping every 2 or 3 seconds, but I still do it. :wink:

This is a long thread, but you'll find some good suggestions here (and a bit of a detour onto Xbee for a while) that should help. As you probably know, they're not using standard Zigbee protocol and so they can be a pain to get paired. One paired, you just need to keep their signal strong and they'll continue to work like champs. Very happy with all my Xiaomi devices on Hubitat.

What exactly does the Lux Value Offset do? Will it make it more sensitive?

Never used it myself but I'm assuming if you have a very accurate device to measure lux, you can then put an offset in to give a identical reading.
Lux measuring device = 100.
Aqara device = 110.
Put in - 10 as an offset and it now reads 100.
Only guessing here and I don't know what will happen when lux reaches 0.
It makes more sense for temperature or humidity readings. Not sure it's really necessary for lux reading.

Download the Hubitat app