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

As you discovered, the battery percentage isn’t shown immediately when a Xiaomi device is paired.

This is completely normal, because the SmartThings hub doesn’t catch the very first battery voltage report message during the pairing process. After that first message, the battery voltage is only reported when the device sends a regular “check in” message to the hub,

For “original” Xiaomi devices the first check in message is sent 60 minutes after pairing (and every 60 minutes after that), and for Aqara devices, it is sent 50 minutes after pairing (and every 50 minutes after that).

@veeceeoh - you’re a legend!

Now that’s out the way. I tend to pop in and out of this thread over time, and I’ve just been through about 250 posts. Cracking work you’ve been doing.

One bit of feedback if I may. It’s very hard to spot your Update posts in amongst the noise. It would be great if you can use post 1 has a pseudo change log, so that an infrequent user can just check up on post 1 to get the latest on all your hard work.

Thanks again, and looking forward to reading you knock down yet more challenges in getting these great little cheap devices perfectly supported.

1 Like

Thanks, but let’s give credit where credit is due. @ArstenA started and hosted the updated set of Xiaomi device handlers and did a lot of work to improve them. Major contributions have been made by @tmleafs, @AlecM, @foz333, @GnoStiC, & @ronvandegraff, and then loads of input and testing by numerous others on this thread. And of course all the work done by @a4refillpad and many others before @ArstenA started working on them. So these are truly community-created device handlers!

I wish I could help here, but since @ArstenA started this thread, I can’t make any edits to the opening post. I suppose I could start a new thread, but that would seem redundant to this thread. Maybe a most recent change log could be maintained on GitHub with a link given in the top post…

1 Like

Guys, thanks for the excellent work!
Just received a Motion sensor, Door/Window Sensor and Zigbee Outlet.
After DH published, DWS and MS was automatically detected and paired in the first attempt. Outlet was identified as a thing and i had to manually edit the device to the right DH in IDE. After that all devices are working until now.

I recently re-paired a few devices (aqara window sensors and motion sensors) making sure to leave all ZB repeaters off, but their intended locations are quite far from the hub. Some have stayed, some have dropped. Looking at this, should I maybe have waited ~50 mins for a battery checkin first? Would that have helped, or does the ‘sleepiness’ of these devices simply mean they’re not going to work reliably over repeaters even after sucessful pairing?

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

Thanks

Lewis

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.

3 Likes

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.