xChar
·6 years ago

之前搭建了个HomeKit服务器,还没有接入米家的插线板,现在试试能不能让米家设备接入苹果的HomeKit,用手机的Home软件就能控制米家插线板。

安装homebridge-mi-outlet插件

sudo npm -g install homebridge-mi-outlet

安装miio插件

sudo npm -g install miio

miio插件发现小米智能插线板

miio discover

可以看到Model info:zhimi.powerstrip.v2就是米家智能插线板,将下放的Address和Token记下来:

Address:192.168.xxx.xxx
Token:21a98556732d471e2764cxxxxxxb1ee1

修改HomeBridge的config.json文件

bridge节点后面添加所需的platforms

{
    "platforms": [{
        "platform": "MiOutletPlatform",
            "deviceCfgs": [{
                "type": "MiPlugBase",
                "ip": "xxx.xxx.xxx.xxx",
                "token": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
                "outletName": "米家智能插座基础版",
                "outletDisable": false,
                "temperatureName": "米家智能插座基础版温度",
                "temperatureDisable": false,
                "switchLEDName": "米家智能插座基础版指示灯开关",
                "switchLEDDisable": false
            }, {
                "type": "MiPlugBaseWithUSB",
                "ip": "xxx.xxx.xxx.xxx",
                "token": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
                "outletName": "米家智能插座USB版",
                "outletDisable": false,
                "temperatureName": "米家智能插座USB版温度",
                "temperatureDisable": false,
                "switchUSBName": "米家智能插座USB版指示灯开关",
                "switchUSBDisable": false
            }, {
                "type": "MiIntelligencePinboard",
                "ip": "xxx.xxx.xxx.xxx",
                "token": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
                "outletName": "米家智能插线板",
                "outletDisable": false,
                "temperatureName": "米家智能插线板温度",
                "temperatureDisable": false,
                "switchLEDName": "米家智能插线板指示灯开关",
                "switchLEDDisable": false
            }, {
                "type": "MiQingPinboard",
                "ip": "xxx.xxx.xxx.xxx",
                "token": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
                "outletName": "青米智能插线板五孔位版",
                "outletDisable": false,
                "temperatureName": "青米智能插线板五孔位版温度",
                "temperatureDisable": false
            }, {
                "type": "MiQingPinboardWithUSB",
                "ip": "xxx.xxx.xxx.xxx",
                "token": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
                "outletName": "青米智能插线板USB版",
                "outletDisable": false,
                "temperatureName": "青米智能插线板USB版温度",
                "temperatureDisable": false
            }]
    }]
}

其中type代表的硬件:

  • 米家智能插座基础版: MiPlugBase
  • 米家智能插座USB版: MiPlugBaseWithUSB
  • 米家智能插线板: MiIntelligencePinboard
  • 青米智能插线板五孔位版: MiQingPinboard
  • 青米智能插线板USB版: MiQingPinboardWithUSB
Loading comments...