[OBSOLETE] Original & Aqara Xiaomi Zigbee Sensors (contact, temp, motion, button, outlet, leak, etc)

Yes, I’ve posted elsewhere about the reed switch as the main component of Xiaomi / Aqara door/window sensors, as a response to some users reporting issues with the contact sensors sending multiple repeated open or closed messages. What I had found is that reed switches react differently depending on the orientation and direction of travel of the activating magnet.

But it would come as no surprise if the low-cost reed switch used in Xiaomi / Aqara sensors can also get damaged during shipping.



Yes, I have considered it, but without spending lots and lots of time recording all ZigBee network traffic data using a ZigBee sniffer device and then spending more time examining it, there isn’t any way to prove or disprove that the hub is not decoding all messages received from Xiaomi / Aqara devices.

This becomes even more complicated if there are repeaters on the network because they will hold/cache messages from the hub to end devices, waiting until battery-powered “sleepy” devices wake up before passing on those messages. Xiaomi / Aqara devices check in far less frequently than other battery-powered ZigBee devices, so it’s totally possible that messages get dropped.

In my own testing, I have seen certain “unfriendly” repeater devices, such as a Securifi Peanut Plug, drop only some messages going from a Xiaomi / Aqara device to the hub. So my educated guess about a lot of the weird connection issues and lack of responsiveness that people have with Xiaomi / Aqara devices is because of repeater devices on the network.

I doubt the code has been changed. All firmware releases include release notes and it would state that there was a change to the ZigBee stack.

The issues you describe do sound just like what happens when a Xiaomi / Aqara device decides to connect via an “unfriendly” repeater.

Are you using an XBee or ZigBee sniffer device to confirm this fact?

Only the newest version of the Samsung Smart Outlet has been reported to work with Xiaomi / Aqara devices, and then Osram outlets / bulbs are not going to allow Xiaomi / Aqara devices to remain connected.

Just because everything works fine for a long time doesn’t mean that Xiaomi / Aqara devices won’t decide to change their connection to an “unfriendly” repeater. All that is needed is some kind of change to the network signals between devices. Then, it also possible that a Xiaomi / Aqara device that drops off the network has trouble being repaired in its location because it’s still trying to connect via that same “unfriendly” repeater. But there’s no way to verify all of this without the use of a ZigBee sniffer recording network traffic the entire time.

However, moving a Xiaomi / Aqara device near the hub just to get it to pair is not a good idea, because if it will be permanently located far from the hub, it really should establish its connection via a (“friendly”) repeater from the start. Pairing ZigBee devices in their intended installation location is just best practice.

Keep in mind that adding “friendly” repeaters does not 100% guarantee your Xiaomi / Aqara devices won’t try to connect via an “unfriendly” one and then drop the connection.

I only have personal experience with the IKEA Tradfri Outlet, and it works just great with Xiaomi / Aqara devices. Other people have reported success with the IKEA Tradfri Signal repeater, but its signal is not as strong so it doesn’t help with as large of an area of the mesh network.

I recommend reading a thread I started for a different but in many ways similar hub platform, Hubitat, which discusses in great detail all things about keeping Xiaomi / Aqara devices connected:

Hi Guys,

I would like to quickly share my recent experience with Xiaomi vibration and motion sensor in terms of connection loss / drop off.
I struggled to stay connected because they are periodically stop working and showed unavailable in the app. I read a lot about problem caused by repeaters therefore I unplugged my samsung siren to see it has an influence or not.

As a result all sensors are connected and available since 3 weeks without any problem. So it seems the problem is solved by removing the siren.
I will place the siren to different location (far from hub than the sensors can be closer to the hub) and see what will happen.

Did you run into a same issue? Do you have any advice how to eliminate the problem? (without removing the siren)

Thanks

I don’t own a SmartThings Siren myself, but I am not at all surprised that Xiaomi / Aqara devices incompatible with it if it is a ZigBee repeater device. However, when I do a Google search, it appears this is a WiFi only product, only available in the EU.

Anyhow, really without investing in more equipment, the only 100% guaranteed way to eliminate an issue with Xiaomi / Aqara devices dropping their connection with “unfriendly” ZigBee repeater devices is to stop using those repeater devices.

You can try moving any “unfriendly” ZigBee repeater devices further from the hub than the Xiaomi / Aqara devices, but it’s still possible they may decide to try to route their connection via the “unfriendly” repeater, depending on a number of factors, including ZigBee radio signal strength.

Have a look at the post right above yours for more information, and a link to a thread I maintain for a similar hub platform, Hubitat Elevation, which goes into great detail about pairing and keep Xiaomi / Aqara devices connected.

But again, can you please confirm whether this SmartThings Siren is in fact a ZigBee device?

Is it possible to use both buttons on the 2 button wall switch?

Tossing this out here. I’ve had NO luck with Tradfri. My Aqara will drop within a few hours. Guaranteed. Luckily my hub can hit almost every place I need an Aqara.

I unplug my smartthings branded plug along with a few tradfri plugs. Then I pair the devices no problem. THEN I plug my repeaters back in. So far that’s kept my Aqara from dropping. Pairing ontop of the hub didn’t prove to be foolproof as they would still occasionally decide to pair to a repeater and I wouldn’t know until I saw it offline later.

Which one, the Wireless (battery powered) or Wired (in-wall powered) Aqara 2 button switch?



Which model of SmartThings plug? Only the newest one from 2018 has been reported to repeat Xiaomi / Aqara devices without dropping them. So if you have an older SmartThings plug that could be the problem right there.

Right. And tradfri is supposed to work. But even with the ST unplugged and only tradfri plugged in, they aren’t repeating for me. I have to remove every single tradfri and the one ST plug. Once paired that way, insuring directly to the hub, they’ve remained online for weeks.

I see. Well you are the first person to report Tradfri Outlets appearing to not work well with Xiaomi / Aqara devices.

Without the use of an XBee to look at the ZigBee routing map and/or a ZigBee sniffer to see what’s happening in more detail, there really isn’t much troubleshooting to be done besides what you’ve explained (pairing the Xiaomi / Aqara devices first, and then pairing the repeaters - which isn’t guaranteed to be a permanent solution.)

Thank you for reporting this.

Hi @veeceeoh, I am quite new with ST and do not have much understanding on developing device handler. But I was wondering since the Aqara Wireless Light Switch WXKG02LMI DTH does not work for the new ST app, do you think it is possible to use the Aqara Wired Switch QBKG12LM approach?

In short, have it automatically create 2 child switch

  • Main: Allow us to set automation for Both button Press/Double/Hold. It also has the battery level and other information.
  • Child: Main will create 2 child, one for left, one for right. This allow us to set the automation for individual left and right button Press/Double/Hold.

I have tried to do up a MVP but due to my lack of knowledge on how to develop DTH, I am unable to get it to work. The following post which you have provide help to has a DTH that implemented the Main-Child approach.

Maybe, but at the moment I am very very busy so I am not sure when I will have time to try this approach.

I won’t lie, though. I really really dislike the new Samsung Connect mobile app because of all of the functionality that is missing, and also because developer documentation on how to correctly write device handlers for the new app is still not available.

No worries! I will spend some more time figuring out. If I ever get it to work, I will share it here. Thanks for the prompt reply!

I totally agree with you, they are taking too long adding functionality to the new ST app plus there is barely any documentation.

hi, let me ask you, i have been trying to get my new Aqara sensor to activate my bathroom sensor, but I think it reads moisture every hour, so its not practicle.how did you change the frequency of the readings to say every 5 minutes? Also how do you change the defualt parameters on a sensor and put in new code. thank you ahead of time for helping me out.

Both the Xiaomi & Aqara Temp-Humidity sensors only send reports when there is a change in temperature or humidity and the reports are not based on time intervals. This behavior cannot be adjusted or changed at all.

I am a contributor to and currently maintain all of the GitHub/bspranger/Xiaomi device handlers. What parameter would you like to change?

Bought one Aqara temp/humidity sensor a week ago. Loaded the DTH in the ST IDE. First pairing attempt, I had a smartthings outlet plugged in, but it paired up and the battery showed after a few minutes, but about an hour later it went offline. Removed it and added it again, this time I unplugged the smartthings outlet, it paired but the battery never showed and it went offline in about an hour. Tried one more time, plugged the smartthings plug back in, paired it, battery showed and it’s been online ever since. One week and counting working good.

Decided to buy 3 more to replace open close sensors I’m using for temperature only. Received the next 3 and started to get them paired. Over the course of 2 days, I tried multiple sensors and couldn’t get any to report the battery and stay online. I started counting how many attempts. I tried 52 times using two different sensors, did it exactly the same way as I first that’s still working and nothing. Tried it everyway that has been described in this thread, did all the tricks, no good. I even placed the newer sensor right next to the working one, still goes offline. Twice I got the battery to show, but it went offline minutes later. After 50+ attempts I give up.

Why one paired, reports the battery, and has been working fine for a week and the others won’t pair correctly makes no sense to me. I also don’t understand how on one makes a temp/humidity only sensor for smartthings. Why does Samsung not have one? If anyone knows of another temp/humidity only sensor that works with ST please let me know. Thanks.

HI keith,

Thank you for getting back to me. I wanted to mess around with the parameters of my Aqara Temp Humidity; I thought that it “took a reading” every hour, so it is not working well as a trigger for the bathroom fan (should be every 5 minutes). My goal is to have the sensor work in conjunction with a smart switch to replace the use of a regular “humidity sensing switch.” How would you go about doing something like this? Is there another sensor you would recommend?

Also I am new to the community, I love to be able to contribute, but have not been able to understand on a practical sense where I would access the sensor parameters and change them (using code) and apply the code to my particular triggers. In particular, I like to be able to use “and” and “if and if, else” statements to control lights. For example, in my bathroom, if it is a certain time (7 am to 10 pm) when I hit the switch, I want the light to be white, but if it is past 10 pm, I like my motion sensor to act as a trigger to activate my light and have them be red (acting as a night light). If I press the switch, I like it to turn white again. The light should only last 30 minutes after the motion sensor stop sensing motion or is press. I don’t know where to get started, where do I go to access my sensor and lights and modify the existing code, and where do I create the new code (the platform). I use the new smartthings hub (not the classic). If you have any good videos you recommend, I would truly appreciate it,or if you can give me a tutorial I would appreciate it. I value your time, so if I can compensate you somehow I would be more than happy to do that, the idea is to learn. I am pretty good with logic statements, I just have to understand the system a little. Thank you.

Well the since the Xiaomi / Aqara sensors send reports based on changes in temperature or humidity it is still possible to use them as part of an automated bathroom vent fan setup. I haven’t done this myself, but I have read of other people doing this.

Regardless of whether you use a Xiaomi / Aqara sensor or another humidity sensor, you will need to either set up an already included SmartApp or install a community-created one for the automation side of the equation. For this use case, I’d look at the choices available in the Marketplace section of the SmartThings Classic mobile app, in the SmartApps tab, perhaps under the Climate Control heading. There’s a SmartApp called Humidity Alert! which might do the trick:

As for other temperature / humidity sensors which may report based on a time interval, there are so many choices available at a wide variety of prices I’m afraid I cannot give a recommendation here. Perhaps search the SmartThings Community Forums here for a thread in which someone has asked for the same recommendation?

Hopefully you won’t ever have to modify code, because what you are looking for are SmartApps to help you create automations. The Device Handler (or “DTH” or “DH”) code for Xiaomi / Aqara devices that are linked to in this thread are just simply for making the devices accessible to SmartThings to use in conjunction with SmartApps. Thing of Device Handlers as device drivers that you need to install on your computer in order for it to recognize those devices when you plug them in, and SmartApps as the Applications that allow you to do things with the devices.

As for information on where yo get started, there is A LOT available on this community forum, so it can be overwhelming. Here are a a couple suggestions to get you going:

and also:

Title3

1 Like

This might also be of interest:

How to Get Started Creating Complex Rules in SmartThings

1 Like

If you want to do any kind of “programming” , I highly recommend using Webcore.
It’s super easy to create apps (they are called Pistons) that can do just about anything.
I switched to Webcore to control all my smart devices.

Hi @veeceeoh
(long time, no see :smiley:)

I actually tried the Xiaomi-Aqara humidity sensor (model: lumi.weather) with this SmartApp, but i can’t get it to trigger anything (tried with a Aqara relay and a virtual switch…
It is as if the SmartApp can’t read the info from the sensor… Could it be a integer/decimal issue with the readings from the sensor…? The DH shows only non-decimal numbers in the ST app (V2).

Here’s my Piston if someone wants to have a staring point.
Keeps the house at intHouseHumidity during the winter months when the doors and windows are closed and pops the fan on for 5 minutes whenever a poop is immenent!

1 Like