Xiaomi Aqara temperature/humidity sensors. Do I need a gateway?

I just received a couple of these sensors. I have no idea if they are the “original” or newest version.

Do I also need a Xiaomi gateway, or can I use Smartthings to connect the devices?

They can be used with SmartThings directly, however there are a few things to be aware of:

  • You have to install a custom device handler (DTH).
    Please see this thread for information and links to the most up-to-date device handers. You want the device handler for the Aqara Temperature Humidity Sensor, based on your LightInTheBox.com link.

  • The older SmartThings “classic” mobile app should be used with Xiaomi / Aqara devices
    Devices that use custom device handlers are not yet officially supported for use with the new SmartThings Samsung Connect mobile app.

  • Most non-battery powered ZigBee devices aren’t “friendly” with Xiaomi / Aqara devices
    Most ZigBee devices that are mains-powered (plugged into a wall socket) also function as ZigBee “repeaters”, which is similar to the what WiFi extenders do. Unfortunately, because Xiaomi / Aqara devices use ZigBee in a non-standard way, they will be dropped off the network by the majority of repeaters. So you would want to check whether you have any mains-powered ZigBee devices. Please see this thread for more information, and also this post on the Hubitat Hub forums which lists ZigBee repeater devices which are known to be compatible.

If you find that you already have “incompatible” ZigBee repeater devices, or you are unable to use the SmartThings “classic” mobile app, then there is a SmartThings solution called Mi Connector that allows integration of devices connected directly to a Xiaomi Gateway.


With bspranger DH, is it possible to make some changes that it shows temperature in front page instead of humidity, or show both in new app?

Aqura temp sensor works fine in the new app with the custom DH.
I also have a smartthings smart plug and I dont have any issues with it either regarding the repeater function.

@ryvaenge change the following lines (124 & 125) to your desires to the file here:

        details(["temperature", "battery", "pressure", "humidity", "spacer", "lastcheckin", "spacer", "spacer", "batteryRuntime", "spacer"])

Thanks for your reply but I don`t understand. I tried to change places between “temperature” and “humidity” in the code, but no changes in new app.

Ahh the keyword is “new app”…

I’m not even sure that there are customizations allowed outside of some limited framework features — meaning my water sensor will have a single tile showing Wet/Dry — that’s all it will have not the extra tiles you re-arranged. All Groovy code will work though — just UI seems challenged in the new app. Most of the device code you see here will comply with SmartThings Classic not the new SmartThings. Just the old app will have all UI components.

The solution:

Edit metadata section in DH:

definition (name: “Xiaomi Aqara Temperature Humidity Sensor”, namespace: “bspranger”, author: “bspranger”, mnmn: “SmartThings”, vid: “SmartThings-smartthings-Xiaomi_Temperature_Humidity_Sensor”, ocfDeviceType: “oic.d.thermostat”)

That edited line will cause errors, because the double-quote marks were converted to open/close quote marks, and it’s missing the open curly bracket ({) at the end of the line.

Use this replacement text for the Aqara temp-humidity sensor DTH instead:

definition (name: "Xiaomi Aqara Temperature Humidity Sensor", namespace: "bspranger", author: "bspranger", mnmn: "SmartThings", vid: "SmartThings-smartthings-Xiaomi_Temperature_Humidity_Sensor", ocfDeviceType: "oic.d.thermostat") {

To update the DTH for the Xiaomi model, use this replacement text:

definition (name: "Xiaomi Temperature Humidity Sensor", namespace: "bspranger", author: "bspranger" mnmn: "SmartThings", vid: "SmartThings-smartthings-Xiaomi_Temperature_Humidity_Sensor", ocfDeviceType: "oic.d.thermostat") {

1 Like

I went into the IDE and changed the Type to “SmartSense Temp/Humidity Sensor” instead of the bspranger custom DH. The main tile now reports temperature instead of humidity in the new app.

Is there any danger of instability or damage if I continue using this DH?

Change it back to Xiaomi Temperature Humidity Sensor and it will work and report temperature in the main tile.

It seems that the trick is to change the device type to something else and then back to original to get it to refresh.

I’m still missing definition string for Aqara door/window sensor. I tried this;

definition (name: “Xiaomi Aqara Door/Window Sensor”, namespace: “bspranger”, author: “bspranger”, mnmn: “SmartThings”, vid: “generic-contact-4”, ocfDeviceType: “x.com.st.d.sensor.contact”) {

but it does not update the tile and the battery status is missing when clicking the tile.

1 Like

Just wanted to confirm that the sensor worked with both apps (classic and new) right out of the box.
Most certainly, the DH had to be installed first.

I had to fiddle with the pairing a bit though.
The post below was also helpful. Read all the way to

“Some additional information based on my experience and research.”

I made this change, saved and then published, closed the app on my phone and reopened it. but i still cannot see the effect, do I have to remove the device and re-add it?

could you please specify on which line and which type variable exactly that you changed to this value?

I didn’t modify the DTH. I used a similar compatible DTH called “SmartSense Temp/Humidity Sensor” in place of the bspranger custom DTH. Once I did that, the tile displayed temp and it stayed that way regardless of which DTH I use.

I use both when adding additional temp sensors. The bspranger DTH allows me to set the display as an integer and the SmartSense DTH allows local processing.

hmmm i tried messing around with the DH to make the temp appear as the default rather than just the humidity. eventually i just decided to revert back to the original as nothing i did ever seemed to have the desired affect. but then when i reverted every thing it actually works as expected now and it stayed like this too. so in theory just change whatever and then change it back again and it should display the temperature but note that it didn’t seem to work at first until i had been messing with it a lot

thanks it helped


An old thread but relevent to my issues. I’ve created the device handler from bspranger but am getting Zero degrees C and humidity zero as well. The battery percentage has now appeared and at 100 percent. Do i just need to wait for it to sort it’s self out or are any changes to the device handler needed?



I just had to wait for it to settle down. Temp and humidity now coming through in the app. The next issue is getting a Heiman z wave smoke sensor to add to devices. Happy days :slight_smile: