之前搭建了个 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