I love products from Xiaomi. They have excellent build quality and they are relatively cheap, good quality and easily hackable. Many people know Xiaomi for their smartphones. However, in their home market in China they sell also smarthome components. As many of these systems they use a Xiaomi central hub that connects to and controls sensors (Motion, Temperature, Door, Switches…) and actuators (light bulbs, smartplugs, ….).

Right now, you can get a Xiaomi Motion Sensor for under $13.00 including free shipping over on GearBest. When you compare to other motion sensors, the price is really low and you can easily deck out your home with enough sensors to almost fully automate it. If you are like me, you prefer not to go through the Xiaomi Cloud and set up your own DIY automated house solution.

In this post, i will outline how you can connect a Xiaomi sensor without using the SmartThings hub via the zigbee protocol to a mqtt server. The steps pretty much work for all zigbee powered Xiaomi devices and the only difference is the device handlers used for the different sensors.

Thanks to Koen Kanters project, zigbee2mqtt, you could build a homemade zigbee to the mqtt bridge in order to be able to control the devices using any mqtt server like the mosquito and we can control, for example, everything from Home Assistant through mqtt.

Koen software project supported devices from a quite an extensive list, including devices from vendors like Xiaomi, Ikea, Philips, OSRAM and more.

I assume that you already have a Raspberry Pi with Home Assistant and at least one xiaomi sensors (Example: Xiaomi Passive Infrared Motion Detector).

This project uses parts that are available on Ali Express to make a zigbee hub. Which makes the hub of xiaomi, (also philips hue or ikea hub) unnecessary. Finally a solution to replace the 3 proprietary zigbee hubs

The devices that you need to buy (total under $20) are:

◾ CC2531 USB Adapter

◾CC Debugger as the CC2531 USB stick needs to be flashed with a custom firmware.

◾CC Adapter cable

DIY Xiaomi Gateway

The Zigbee2mqtt wiki provides you all the information needed to get up and running! Make sure you don’t skip sections if this is your first visit, as there might be important details in there for you.

After creating your new device you still have the process of pairing devices, configuring an MQTT server and connecting with Home Assistant, it is a process that does not extend here, but you can find it widely documented.

Integrations

Zigbee2mqtt integrates well with (almost) every home automation solution because it uses MQTT. However the following integrations are worth mentioning:

Home Assistant

Hassio: Using the official addon from danielwelch

Generic install or Hassbian: Using instructions here

Happy Automating!