[Release] Xiaomi device drivers



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.


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.


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.


It does not change the sensor's sensitivity, but rather adds the user-entered offset to the value reported by the sensor. @bobgodbold's explanation is correct.


Ok thanks for explaining for that!


Thanks @veeceeoh, step 9 allowed me to add a couple of different types of Xiaomi devices that wouldn't finish Initializing.


I have added few Xiaomi devices/sensors and most of them have worked fine. However, I do not know how will I use the cube and LIght switch. Could someone provide some instructions.


Any DH out there for the xiaomi wall plug?


@Smartsmartsmart reported over here that the SmartThings DTH code worked for him (but without the energy usage capability).

I am currently working on a SmartThings DTH for the new Xiaomi Aqara Vibration Sensor (which will in turn lead to one for Hubitat), but after that I'll see about adapting the SmartThings ZigBee outlet DTH to make a Hubitat-specific device driver. I just won't be able to test it myself.


I knew eventually you would get to it. I just got 4 of them this week. Let me know when your ready to test. I made my own driver (based off the smartthings driver) but prefer to you use what you guys come out with as its a "supported" driver.