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

If you turned off your repeaters during pairing, and then powered them on afterwards, it’s quite likely that the Xiaomi sensors dropped their network connections because 1) they were connected through one of your repeaters or 2) they weren’t connected through a repeater and the mesh network signal strength was too weak due to distance from the hub.

You could try pairing them at a close distance to the hub, wait until the first battery report comes in (which means they made it past the hub’s end device timeout period), and then move them to their intended location, and hope they change over to being connected through a repeater. But if the repeater has an end device timeout shorter than 50 minutes then the Xioami sensors’ connections would be dropped anyhow.

Without a device like an XBee Zigbee module to map your Zigbee network routing, it’s not very easy to know whether Zigbee end devices (like any Xiaomi sensors) are connected through a repeater and what their signal strength is.

Interestingly, it appears that using an XBee module as a repeater is the only solution that works well with Xiaomi devices, if you set the XBee’s end device timeout (known as Child Poll Timeout on an XBee) to be longer than an hour. See this thread for more information:

1 Like

@veeceeoh and @ArstenA
I’ve made little changes to the Xiaomi Zigbee Outlet DH to include the date/time format options on preferences and to use the HUB current time zone if location is configured to display the “Last Update” status. This code was adapted from the Aqara Motion Sensor DH.

What is the best way to send you my code version to insert this changes in the “Production” repository and made this available to everybody?

I’ve try’d the “Commit Changes” option but received an error back.

If you have a GitHub account, then you could create a Pull Request that either @ArstenA or I can merge into the Zigbee Outlet DH code so it’s available to everyone. Here are the steps to do that:

  1. Navigate to the GitHub page of the repository where you’re viewing the code, here.

  2. Click the pencil icon to edit the code:

  3. Make your edits to the code.

  4. When finished making edits, scroll to the bottom of the page, and enter in details about the changes:

  5. Make sure to select “Create a new branch for this commit and start a pull request”, and give the new branch a name (as seen above).

  6. Click the “Propose file change” button which will take you to an “Open a pull request” page:

  7. If everything looks good, click the “Create pull request” button.

Ok, just created a Pull Request for the Outlet DH.
About the Aqara Motion Sensor, seems to me that the illuminance attribute is just updated when a motion is detected, that is right? So, if i want to set an action like turn on a outlet when illuminance is bellow “X” this will not work if i don’t have any motion detected?
Second question: what is the illuminance value that you guys use to define if a light or lamp must be turned on?

Great, I’ll have a look, and then merge it into the master code for the outlet DH. Much appreciated!

EDIT: Changes looked great, so it’s now part of the code. I’m curious whether the temperature reporting seems to work correctly - because I could lift code from one of the Temp/Humidity sensor DHs to improve it. Just the only way to test is to ask you to try it out, though. :slightly_smiling_face:

That is just the way the hardware works. An illuminance message is only sent when motion is detected, and in my testing the illuminance message is usually sent before the motion detected message, but not every time. So the problem here would be that if you use the motion detection message as a trigger for an outlet, but only if illuminance is greater than X, it may not work if the motion detected message arrives before the illuminance message.

I don’t use WebCoRE much, but I suppose a piston could be created get around that problem by handling either situation: 1) turn on the outlet if theres a change in motion -and- if Illuminance is over X, or 2) turn on the outlet if there’s a change of illuminance to over X, and motion is active.

This is highly dependent on personal preference, and every room can have a different range of possible lux values. Normal acceptable room lighting levels range from 20 to 750 from my research, but it really depends on use.

Just keep in mind that the sensor itself doesn’t provide readings over 1000 or 1200 lux (depending on revision), which is the equivalent to outdoor daylight with overcast sky.

Hi Everyone.
I bought two original XIaomi Door/window sensor and installed the DH using github. I paired up both, no problem, worked like a charm so I installed both on doors already and tested.

The following day after waking up, both sensor became unavailable…Does any one run into the same issue? I have definitely tested sensors at locations and both worked. I also saw the blue led blinks when two pieces get close so I do not think it is an battery issue.

I mean, I can repair both sensors and try the whole thing again, but still would like to know if this is a known issue and there is a solution already



Yes, this is a known issue, but doesn’t normally happen if you have a v2 SmartThings hub. For people with Samsung Connect or SmartThings Link for NVIDIA Shield TV, Xiaomi devices drop their connection within 1-2 hours, and there is no solution.

Which type of hub do you have?

Hi Keith
I have a US v2, below is from the ST dev account

Hardware Version Hub v2 US

Firmware Version 000.021.00013

in this case, what should I do? is there a way to tackle this problem?

thank you

Temperature reporting isn’t working. Seems to get updated only when manual refresh command is sent and is reporting a temperature 5 celsius degrees lower it should. I can have a look at this or test if you want.
Other thing that i notice is that the checkin event behavior is odd. I receive 3 or 4 events when turning on or off the outlet. Also in the last days, sometimes the outlet starts to send lots of checkin events (friday it started to send one every 16 seconds) and then suddenly stoped send events until i turned off the outlet 2 days after in the sunday.

I think I may be able to help, but I’ve been very distracted by the failure of the boot drive of my main home computer.

I will PM when I’ve got it back up and running.

Apparently a U.S. Smart Plug is coming, no idea if it will be WiFi or ZigBee based. Will be interesting to see if they bring all of their ZigBee sensors / buttons / etc. stateside, and if so what the pricing will be like.


Has anyone on here managed to get Xiaomi’s curtain motor working?
I saw several threads stating it worked, so I went ahead and purchased it.
Have tried several different device handlers and have not been able to make it work.
If anyone has any ideas, I’d be grateful.

So far the only specific models announced for US distribution are from the Mi WiFi line. No zigbee.

Turn any product into a smart device with Mi Smart Plug. This smart Wi-Fi plug…

Well, my Aqara Motion Sensor Worked without problems for some days before get unavailable for the first time. I paired the device again close to the hub, it start working again so i put it back to the original place. After a couple hours it became unavailable for the second time. So i put the sensor close to the hub and it starts to respond again without a repair. Left the device in that place for 2 days, i think, and then it become unavailable for the third time. One thing i can notice is that before it becomes unavailable for the first time, the xiaomi outlet was on all the time in a place between the sensor and the hub, then it was turned off and the sensor starts to fail. May be just a coincidence?

Probably not a coincidence.

The Xiaomi outlet can act as a Zigbee repeater, meaning it allows end devices (like your Motion Sensor) connect to it, and it passes all messages from the end device to the hub and vice-versa.

The problem is that Xiaomi outlets may not work well as a repeater to a SmartThings hub. There are so few people with them that there’s not enough information to be sure.

Unfortunately, after pairing a Zigbee end device, there’s no way to tell in SmartThings if it’s connected to a Zigbee repeating device without using 3rd party hardware (such as an XBee module) to map out a Zigbee mesh network.

More problem with Xiaomi Original Door/ Window Sensor…

5 days ago I posted here for xiaomi dropping connection and someone kindly notified that could be a wifi interfering (thank you again).

I repaired my two door sensors and 1 motion sensor since 5 days ago. I have changed my wifi router channel to 1 (and zigbee channel I found is 9, so no over lapping )

After couple of days, one door sensor dropped. The door sensor is about 30 ft from the hub and is hiding behind the blinds.

The other door sensor and motion sensor, both are much closer to the hub and have no object blocking signals, are still operating.

So at this time I have to make the conclusion that either zigbee devices have limited range, or more prone to signal blocking, or get interfered by wifi in neighboring house hold.

Anyone had similar situation before?

All of these things can be true, because Zigbee is a low-powered radio networking standard, and operates across the same bandwidth range as 2.4Ghz WiFi.

Besides changing your WiFi and/or Zigbee channel, the best way to avoid distance / interference issues is to use mains-powered Zigbee devices that can function as Zigbee repeaters.

If using Xiaomi devices, the only Zigbee repeater that I know of people having success with (including me) is an XBee module. I would recommend searching the forums here for “XBee” and also especially having a read through this thread:

Thank you Keith.

Its fortunate to have a great community member like you



I have Xiaomi Aqara curtain motor working with Smartthings hub using Xiaomi Zigbee Outlet device handler. You need to change type of the device to this after pairing.

I actually got it working. Had to re-add the device using the old app.