之前搭建了个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
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
MiPlugBaseWithUSB
MiIntelligencePinboard
MiQingPinboard
MiQingPinboardWithUSB