How to make Xiaomi gateway compatible with HomeKit

This is very simple and there are a lot of way to do so. You need:

– Raspberry Pi (3 or Zero it’s the same, you just need to install Raspbian)
Xiaomi gateway (of course)
– iPhone or iPad (well it’s the purpose)

First of all, connect ssh to it with:

ssh pi@raspberrypi.local

Then do the update and install the dependence:

sudo apt update
sudo apt upgrade
sudo apt install libavahi-compat-libdnssd-dev

Now install homebridge:

npm install -g homebridge

And then the plugin:

npm install -g homebridge-aqara

Ok now it’s ready, open the app Mi Home and enable the developer mode (save your username and password). Edit this file with:

sudo nano ~/.homebridge/config.json

And paste (with your sid and password):

 "platforms": [
   "platform": "AqaraPlatform",
   "sid": ["6409802da3b3"],
   "password": ["02i44k56zrgg578b"]

That’s it! Run homebridge from the terminal and go to the Home app from your iPhone, add Homebridge (with the password that the terminal shows you few second ago).

If you have any questions, feel free to ask in the comment’s section.

How to install Raspbian

It’s so easy nnowadays that you can even image how difficult was (for the noobs, the pro are already pro).

Go here and download the last version of NOOBS: and when it’s finished, unzip the archive.

Than insert the microSD (or SD if you have a old one) in your computer, format in FAT32 and rename it just BOOT (all capital).

Now copy and paste all the folder and file that was in the zip archive… and it’s done! You can safely remove the memory and insert into your Raspberry Pi.

Follow the instruction at screen and you are ready to go!