banner
半米牙

半米牙的笔记

分享技术、记录生活
email

Add Mi Smart Power Strip to HomeKit via Homebridge

Previously, I set up a HomeKit server and haven't connected the Xiaomi smart power strip yet. Now I'm going to try to make the Xiaomi devices connect to Apple's HomeKit so that I can control the Xiaomi power strip using the Home app on my phone.

Install the homebridge-mi-outlet plugin#

sudo npm -g install homebridge-mi-outlet

Install the miio plugin#

sudo npm -g install miio

Use the miio plugin to discover the Xiaomi smart power strip#

miio discover

You will see Model info: zhimi.powerstrip.v2, which is the Xiaomi smart power strip. Take note of the following Address and Token:

Address: 192.168.xxx.xxx
Token: 21a98556732d471e2764cxxxxxxb1ee1

Modify the config.json file of HomeBridge#

Add the required platforms after the bridge node:

{
    "platforms": [{
        "platform": "MiOutletPlatform",
            "deviceCfgs": [{
                "type": "MiPlugBase",
                "ip": "xxx.xxx.xxx.xxx",
                "token": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
                "outletName": "Xiaomi Smart Plug Basic",
                "outletDisable": false,
                "temperatureName": "Xiaomi Smart Plug Basic Temperature",
                "temperatureDisable": false,
                "switchLEDName": "Xiaomi Smart Plug Basic LED Switch",
                "switchLEDDisable": false
            }, {
                "type": "MiPlugBaseWithUSB",
                "ip": "xxx.xxx.xxx.xxx",
                "token": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
                "outletName": "Xiaomi Smart Plug USB",
                "outletDisable": false,
                "temperatureName": "Xiaomi Smart Plug USB Temperature",
                "temperatureDisable": false,
                "switchUSBName": "Xiaomi Smart Plug USB LED Switch",
                "switchUSBDisable": false
            }, {
                "type": "MiIntelligencePinboard",
                "ip": "xxx.xxx.xxx.xxx",
                "token": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
                "outletName": "Xiaomi Smart Power Strip",
                "outletDisable": false,
                "temperatureName": "Xiaomi Smart Power Strip Temperature",
                "temperatureDisable": false,
                "switchLEDName": "Xiaomi Smart Power Strip LED Switch",
                "switchLEDDisable": false
            }, {
                "type": "MiQingPinboard",
                "ip": "xxx.xxx.xxx.xxx",
                "token": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
                "outletName": "Qingmi Smart Power Strip Five-hole Version",
                "outletDisable": false,
                "temperatureName": "Qingmi Smart Power Strip Five-hole Version Temperature",
                "temperatureDisable": false
            }, {
                "type": "MiQingPinboardWithUSB",
                "ip": "xxx.xxx.xxx.xxx",
                "token": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
                "outletName": "Qingmi Smart Power Strip USB Version",
                "outletDisable": false,
                "temperatureName": "Qingmi Smart Power Strip USB Version Temperature",
                "temperatureDisable": false
            }]
    }]
}

The type represents the hardware:

  • Xiaomi Smart Plug Basic: MiPlugBase
  • Xiaomi Smart Plug USB: MiPlugBaseWithUSB
  • Xiaomi Smart Power Strip: MiIntelligencePinboard
  • Qingmi Smart Power Strip Five-hole Version: MiQingPinboard
  • Qingmi Smart Power Strip USB Version: MiQingPinboardWithUSB
Loading...
Ownership of this post data is guaranteed by blockchain and smart contracts to the creator alone.