banner
半米牙

半米牙的笔记

分享技术、记录生活
email

Initialize HomeKit with Homebridge

Recently, I moved and needed a power strip. I bought a Xiaomi smart power strip, which I find very convenient to control with my phone. I saw that Apple has its own Home App to manage smart homes, so I wanted to try if Xiaomi's smart devices can be integrated into Apple's HomeKit. First, I need to set up a HomeKit server.

Installing Node.js and npm#

Node.js v10.x:

# Using Ubuntu
curl -sL https://deb.nodesource.com/setup_10.x | sudo -E bash -
sudo apt-get install -y nodejs

# Using Debian, as root
curl -sL https://deb.nodesource.com/setup_10.x | bash -
apt-get install -y nodejs

Installing compilation components#

sudo apt-get install libavahi-compat-libdnssd-dev
sudo apt-get install build-essential libtool

Installing HomeBridge#

sudo npm install -g --unsafe-perm homebridge

Adding HomeBridge configuration file#

Go to the directory:

cd ~/.homebridge/

Create the file:

vim config.json

Add:

{
    "bridge": {
        "name": "Homebridge",
        "username": "CC:22:3D:E3:CE:30",
        "port": 51826,
        "pin": "031-45-154"
    }
}

Save and exit:

wq!
Loading...
Ownership of this post data is guaranteed by blockchain and smart contracts to the creator alone.