banner
半米牙

半米牙的笔记

分享技术、记录生活
email

通过 Homebridge 向 HomeKit 添加米家智能插线板

之前搭建了个 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
加载中...
此文章数据所有权由区块链加密技术和智能合约保障仅归创作者所有。