in Raspberry Pi

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.

Write a Comment

Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.

12 Comments

  1. thank you for the tutorial, I’m struggling with the config.json i was wondering if you could help me to this?
    i have installed yeelight plugin and it work flawlessly but i try to add more plugin and edited my config.json but nothing shows up, if you can throw some config.json with more than one plugin that’ll be very helpful to me.
    thank you

    • For example here:

      {
      "bridge": {
      "name": "Homebridge",
      "username": "AA:BB:CC:DD:EE:FF",
      "port": 55555,
      "pin": "111-22-333"
      },
      "description": "This is an example configuration file with one fake accessory and one fake platform.",
      "platforms": [
      {
      "platform" : "yeelight",
      "name" : "yeelight"
      },
      {
      "platform" : "Hs100"
      }
      ]
      }
  2. thank you for the tutorial, I’m struggling with the config.json i was wondering if you could help me to this?
    i have installed yeelight plugin and it work flawlessly but i try to add more plugin and edited my config.json but nothing shows up, if you can throw some config.json with more than one plugin that’ll be very helpful to me.
    thank you

    • For example here:

      {
      "bridge": {
      "name": "Homebridge",
      "username": "AA:BB:CC:DD:EE:FF",
      "port": 55555,
      "pin": "111-22-333"
      },
      "description": "This is an example configuration file with one fake accessory and one fake platform.",
      "platforms": [
      {
      "platform" : "yeelight",
      "name" : "yeelight"
      },
      {
      "platform" : "Hs100"
      }
      ]
      }
  3. thaknks for the info, I completed the setup but I wonder how can I make Homebridge starts when pi reboots? I was using it then I unplugged to put the pi in a safe place but when it started again iOS Home app couldnt connect devices until I shh the pi and run the homebridge command again!

  4. thaknks for the info, I completed the setup but I wonder how can I make Homebridge starts when pi reboots? I was using it then I unplugged to put the pi in a safe place but when it started again iOS Home app couldnt connect devices until I shh the pi and run the homebridge command again!

  5. Thank you for this nice tutorial. I have already installed the homebridge-aqara plugin and can see the motion- and door sensor in my Home App. On youtube, I have seen that you have also installed the small round wireless switch and the light stripes. Can you tell me which plugins do you use for this?

    • I’ve used Domoticz (it’s more complicated than a simple plugin for Homebridge), I’ve created virtual sensor that send command to the Gateway and the light stripes.

  6. Thank you for this nice tutorial. I have already installed the homebridge-aqara plugin and can see the motion- and door sensor in my Home App. On youtube, I have seen that you have also installed the small round wireless switch and the light stripes. Can you tell me which plugins do you use for this?

    • I’ve used Domoticz (it’s more complicated than a simple plugin for Homebridge), I’ve created virtual sensor that send command to the Gateway and the light stripes.