SmartThings Community

Xiaomi Zigbee Door/Window Sensor, Motion Sensor, & Smart Button Device Type [beta]

(Fubka) #1192

Let us know if that works. Although these seem like high quality yet inexpensive devices, I am beginning to think that it is too good to be true.


Well I had and still have some other issues too with xiaomi sensors some time to time. They seem to be very picky if repeaters (trådfri bulbs) loses their power for couple of hours. When repeaters are powered off xiaomi sensors are offline as long as I manually reconnect them to ST. Reconnecting means bringing sensor near ST hub and start to search new things. Sensors are found and they are named straight like they were before so I just need to search them and save them again. Then after couple of minutes they work normally.

I’m not sure if this is right english word to describe it but I’m using so called residual-current relay (?) attached to outlet and trådfri bulbs are behind this relay. Every time when even small change in voltage happens relay cuts power from outlet for the safety reasons. If this happens at night then it means that there is no ikea repeaters to use for hours before I go and manually press reset in relay. This is not a big problem but it’s annoying when it happens. Relay cuts power maybe once in month (old house and winter time) but it’s always pain in the ass to take all six xiaomi sensors (behind ikea bulbs) away and pair them again.
But I have to say. Xiaomi sensors are cheap and most of the time they work great. It’s all about basically how much do you want to put money in sensors. If I pay more I get sensors which are supported and most likely works better that Xiaomi sensors. But I chose xiaomis because they are much cheaper… :slight_smile:

(Keith G) #1194

Yes, that seems to indicate either a problem with the network connection strength in that location or with the magnet alignment.

Also, I have read duplicate messages can be a symptom of problems with repeaters, again possibly because of network strength or repeaters that are incompatible with Xiaomi/Aqara products. But you said you are using Trådfri bulbs as repeaters, right? Are you using any other Zigbee devices that are repeaters?

Any interruption in the Zigbee network can lead to Xiaomi/Aqara devices dropping their connection. This is because they don’t follow the standard Zigbee protocol of rejoining the mesh when requested by the hub. That is also the reason for incompatibility with most Zigbee repeater devices, but in conjunction with Xiaomi/Aqara devices not checking in as often as the repeater devices expect.

Did your hub reboot or was there some interruption in the Zigbee network? Also, some kinds of other radio signals in the same frequency range can cause enough interference to disrupt the connections of Zigbee devices - including certain 2.4GHz WiFi channels, cordless phones, etc.

However, regardless of the reason, there is nothing that can be done to change the behavior of Xiaomi/Aqara devices not rejoining the network when requested. So the best way to handle this is to manually rejoin them.

To manually rejoin a Zigbee device, either do what @Jani explained:

or if that doesn’t work, follow the same steps as pairing (“Add a thing” in the mobile app and put the Xiaomi/Aqara device in pairing mode), but still make sure to leave the device in the hub’s device list.

As long as the entry for the device includes the ZigbeeId information:

then the hub should be able to match up the device being rejoined to that device entry. You won’t see it appear in the mobile app ready to rename as you will with a newly paired device, though. It will just be reconnected, and a new Device Network Id will be assigned to it.

(Fubka) #1195

Actually, my Roomba ran over the power strip switch that the ST v2 hub and WiFi router is plugged into. So that was likely what caused it. I thought the ST hub battery backup would prevent this but who knows? My WiFi is on channel 11 and Zigbee is on channel 14 so they should not interfere. However, I live in a city row home and the 2.4Ghz in very congested. I was able to reconnect 4/6 using the standard method so hopefully I can get the other two back on soon.

(Fubka) #1196

Interesting, so just have them close to the ST hub and use the add/search in the classic app without pressing the buttons on the ST devices? I didn’t know this was possible.

(Keith G) #1197

Note that this method may require a short-press of the reset button on Xiaomi/Aqara devices to “wake” them up to be seen by the hub.


Oh sorry guys. I do put them in pairing mode by keeping button pressed as long as blue led lights up.
Also I have to correct one other thing. I use trådfri bulbs as repeater with xiaomi sensors that are near my garage. These are the ones which loses their connection to ST hub in power cut situation and that’s because of relay I’m using in between.
Front door sensor which sends multiple opened or closed lines (this is btw only one from all my xiaomi sensors) does most likely have straight connection to hub because it is nearest. There’s 6 meters between front door sensor and hub. There’s 10m from hub to garage trådfri bulbs and other garage sensors. So there’s 16 meters from front door sensor to nearest trådfri bulb and there’s no other zigbee repeaters in my installation.

(Fubka) #1199

Got it, so this would be a solid LED blink I believe?

(Keith G) #1200

For most Xiaomi / Aqara devices, short-pressing the reset button will show whether it’s still paired to the hub or not. As you press the button the LED will blink, but wait for about a second for it to light up again:

  • 1 long flash = Not connected
  • 2 or 3 short flashes = Still connected

Again, that’s for most Xiaomi/Aqara devices. One exception I can think of right at the moment are the Aqara Wireless Smart Wall switches - when a button is pressed, the LED will flash only once if the device is still connected.

(Fubka) #1201

Thanks, those are my observations too. It also sends current data value as well if it is connected.

Is there a limit to the number of Xiaomi devices you can have connected? I know Zigbee is 32 on v2 of ST hub. I have a total of 12 Xiaomi devices.

(Kenneth Eriksen) #1202

Yes - 32 is the limit for devices connected directly to the hub. But every time you add a repeater (compatible mains powered Zigbee device) and connect through that, this limit is “reset”…
In other words… You can connect 32 devices to each mains powered Zigbee device (hub/repeaters)

(Keith G) #1203

Well… Actually, the number of end devices that can be connected to a Zigbee repeater depends on how that device is set up. Many repeaters have a limit that is well under 32, often in the 12-16 range from what I’ve experienced and read.

But if you are using Xiaomi / Aqara devices, it’s very important that all of the Zigbee repeater-capable devices you are using are compatible.

1 Like

Hi, did you find any spare time to add this feature? :roll_eyes:
It’s not just one sensor that does this. I have been using Alexa to announce when door opens and half of them are doing it. Some little more that others.

(Tiago Gonçalves) #1205

[veeceeoh] for Xiaomi socket appear that the energy is displayed at Watt/hour instead of kWatt/hour like the unit displayed. two solution here or change the unit to Watt/hour or multiply by 0.001

    energy = Math.round(energy * 100) * 0.01
    resultMap = createEvent(name: "energy", value: energy, unit: 'kWh')

log.debug “Energy Meter: ${energy}kWh”

1 Like
(Keith G) #1206

Thanks for the report! I used the second solution, and I have made some other improvements to the Xiaomi Smart Plug device handler. Please find the announcement and link to the updated code here:

(Keith G) #1207

[REMINDER] All Xiaomi / Aqara wireless button users

Hub Firmware 25.26 has been released for SmartThings v2 & v3 Hubs

The new firmware includes changes that “break” some functionality in the previous device handlers, but also allows for much improved functionality.

In order to fix the issues and add improved functionality, I have updated all Xiaomi / Aqara Button device handlers (DTHs). All SmartThings v2 & v3 Hub users are encouraged update to the newest DTHs immediately.

Please see this post for all details and links to the updated DTHs.

The code of these updated and improved device handlers is open source and free.
But if it has helped you, a coffee / beer donation is always very much appreciated!
PayPal: 37544ab59e07a5c90719f07501453cae3ed7b043 Venmo: @KeithPG

(Tiago Gonçalves) #1208

Sorry, I explained wrongly, should be the entire variable energy multiplied by 0.001 not replace the 0.01 for 0.001.
so the correct way should be:

energy = Math.round(energy * 100) * 0.0001
energy = 0.001*Math.round(energy * 100) * 0.01

(Keith G) #1209

Ahhh, okay. I have updated the device handler again, with no version change. That line of code now reads:

energy = Math.round(energy * 100) * 0.0001

Please let me know if the updated DTH is working for you, thanks!


I remember I probably already mentioned results in some of my posts lately but here’s again if my message wasn’t clear :slight_smile:

Taking few trådfris out from Hue and pairing them to Smartthings near Xiaomi sensors helped for those double/triple open-close log lines. I was having problems with 3-4 open close sensors. Worst were my front door and back door sensors. Trådfri bulbs are quite near my xiaomi sensors and now I do not have any additional log lines. It’s just either open or close just one time. It also made possible to use xiaomi buttons as doorbells. Without additional trådfri repeaters that wouldn’t work at all.

(Tiago Gonçalves) #1211

There is a way to disable the zigbee repeater in tradfri bulb? because when I disconnect power from the bulb using the dumb switch some xiaomi sensors goes offline.