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

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)

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.

[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

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:

[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

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

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.

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.

As far as I know, there is no way to disable the repeater function of any ZigBee repeater devices on a SmartThings network.

To avoid any issues when power is cut off from repeating bulbs, I only have Sengled bulbs, which don’t have a repeater function.

So the multiple open/close message problem is solved? I am still working on a way to avoid that in the device handler, but it’s really difficult to test since my door/window sensors don’t have that behavior.

Just note that from what @Tiago_Goncalves said above, if the power is cut off to Trådfri bulbs, then any Xiaomi / Aqara devices connecting through them will go offline.

Yes, it is solved. I guess only way to test it would be taking one sensor far away enough from hub and see if that makes it.

Usually cut off for example in my home means that hub and repeaters are all off. So it doesn’t really matter if sensor is connected to hub or repeater. They all should be back online when cut off is over. Well… if cut off takes many hours then it might be issue for xiaomi sensors.

For some reason in few hour cut offs I have noticed that some of Ikea trådfri bulbs seems to be “unavailable” according ST app. When pressing “turn on” in application bulb turns on and “unavailable” status disappears. At the same time xiaomi sensors have not reported any activity or battery status to st hub but It usually start after Ikea bulb “unavailable” disappears and status in normal. It feels like xiaomi are trying to send information to ikea repeater but ikea has some problems and have to be refreshed. Have anyone else noticed this?
In short cut offs they all seems to usually come back online without problems. Especially now when I removed those residual-current relays from my system.

As veeceeoh noted, I don’t think it’s possible to disable the “repeating”/routing functionality of a bulb. That is likely something that would have to be done in firmware. I see you mentioned Xiaomi devices were the (only?) ones you were having problems with. In my experience, Xiaomi devices are reluctant to change routes–if I pair mine through the hub, they try to stay paired to the hub (probably why most people recommended pairing them this way initially). If I pair them through a specific repeater (something you can’t force but can encourage–and verify with XCTU), they tend to stay routing through that one. Some people have noticed that they do change routes, but I’ve never noticed any of my Xiaomi devices do that (may depend on chance, your Xiaomi devices, or your routers). This is in contrast to regular ZHA devices, which will change routes if they can’t find their router (or the hub/coordinator).

So, if my observations are also correct for your network, one way you can avoid this problem is not pairing Xiaomi devices through Trådfri bulbs that you think you’re going to turn off. Hopefully you have other repeaters that work well in this case (or slots left on the hub). The other solution, of course, is just to not turn them off. :slight_smile:

I was counting of the “reluctance” to change routes because I normally pair it near the hub and let it there for some hours. in Zigbee I only have tradfri and xiaomi.
This weekend I had the brilliant idea to switch off my 3 tradfri bulbs and half of my sensor went down. some of them reconnect in the next interaction others I had to do the manual catchall method to reconnect (older versions mainly).

Just as an update, bought an ikea tradfri outlet that stays always on and until now (2weeks) no more dropped sensors.
AS a curiosity, I bought to the button that comes with the outlet, but doesn’t have a DH.

So I have it as a thing, but when I press the on/off button the smartthings assumes that is xiaomi outlet (maybe due to parseReportAttributeMessage) and turn on or off my xiaomi outlet accordly without any configuration done.

The Trådfri control button only works with the outlet. It can’t be used as an independent button to control other devices. This is explained in the “Try to create Device Handler…” thread you linked to.

As long as power is supplied to the Trådfri Outlet, it will provide the ZigBee Repeater function. You can still use it to switch on/off something that is plugged into it.

I have several Xiaomi sensors working w/o any issues… I have noticed that there are two DTH for the door/window sensors in bspranger github thread. One appears to have a battery tweek.

Question… Do I need to use both DTH on the Xiaomi Door/Window sensors?

Thanks guys for great work…

You can only use one DTH for any device.

The bspranger repository has a DTH for the Xiaomi Door/Window sensor and a DTH for the Aqara Door/Window sensor.

If you’re using Xiaomi Door/Window sensors, you want the DTH located here.

The battery “tweak” was just a change to the text of the log output, nothing about the way the battery percentage is calculated, etc.

I’m having an issue with one of my two Xiaomi Zigbee sockets. 1st one, perfetly work and locted around 12m from the hub. 2nd one is after the 1st one around 5m . 2nd one perfectly work when it is next to hub, but not communicating when it is in its place. I suspect the 2nd one is routed directly to the hub which is too far. Is there a way to change to routing of Zigbee network ? Can I force my 2nd socket to route its data via my 1st socket ? suggestions ? Hub V2.

1 Like

There is no way to control the ZigBee routing of the majority of consumer ZigBee smart home devices, including Xiaomi / Aqara devices. A ZigBee mesh network allows devices to decide their routing based on signal strength, number of hops, etc. The routing can even change after a device has been paired, multiple times, especially if it has been moved after being paired.

However, from my own experience and reports from users, Xiaomi / Aqara devices are stubborn to change their routing, so you could try re-pairing your 2nd Xiaomi socket even further than 12m from your hub, but near the 1st socket, with the hopes that the 2nd socket will route via the 1st instead of directly to the hub. Then quickly unplug the 2nd socket, and re-plug it into the location where you want to use it.

The only problem with this and any other solution to try to “trick” devices into a certain routing path is that there are no tools to discover the routing besides using an XBee ZigBee module.This thread focuses the use of XBee modules as routers to improve a mesh network, but there’s also discussion about their use in displaying a map of all devices on a ZigBee network.