Home Automation

Home Automation

Tips and Tricks for Home Automation

06 Dec 2020

Working with Xiaomi Sensors

Whether you’re using ZHA or Zigbee2MQTT, working with Xiaomi Sensors can be a bit difficult.

Why is it so hard?

There are two issues that cause Xiaomi Sensors to be potentially difficult to use.

First, the way they report data on the Zigbee network is not compatible with every Zigbee router. Depending on which other routing-capable devices you have in your network, Xiaomi sensors may pair initially, but then fail to stay connected. Unfortunately, we can’t turn off the routing features of most devices. So, in practice, this means not adding those devices to your Zigbee network at all. So, the only way to combat this is to ensure your network only has Xiaomi compatible routers on it.

If you still want to use some devices that make poor Xiaomi Sensor routers, my advice is to have two Zigbee networks: One for Xiaomi devices and Xiaomi compatible routers, and another for everything else.

The second issue is that Xiaomi Sensors don’t ever reroute. Once they’ve selected their path to the Controller, they stick with it. If that device goes offline, then the Xiaomi device is lost too. This means if you, for instance, a light bulb as a router and that light bulb gets turned off, your Xiaomi Sensors fall off the network too.

If you’re already using a separate network for Xiaomi Devices, then simply don’t add any devices to that network that might get turned off.

Pairing Trouble

If you’re using a CC2531 as a coordinator, range can be an issue. Adding additional CC2531 based routers can help extend your network range as well as the number of devices you can add to it. However, Xiaomi devices have another gotcha here.

A Xiaomi Sensor will always try to connect to the strongest router it can find. If your coordinator is full, but your routers still have room for more devices, Xiaomi sensors won’t figure this out on their own.

The easiest way to get around this is to bring the device you’re trying to pair as near to the router you want to pair it through as you can. Then start the pairing process. As mentioned before, once it’s connected, it’ll never reroute. So, once paired, you can move it to it’s final destination.

Use caution, however, when pairing in this way. If the router you’ve paired near is not actually accessible from the final installation location, the device will sometimes fail to update and may fall off the network entirely if link quality is too low.