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
載入中......
此文章數據所有權由區塊鏈加密技術和智能合約保障僅歸創作者所有。