之前、HomeKit サーバーを構築しましたが、まだ Xiaomi のプラグを接続していません。今度は Xiaomi のデバイスを Apple の HomeKit に接続できるか試してみます。スマートフォンの Home アプリで Xiaomi のプラグを制御できます。
homebridge-mi-outletプラグインのインストール#
sudo npm -g install homebridge-mi-outlet
miioプラグインのインストール#
sudo npm -g install miio
miioプラグインを使用して Xiaomi のスマートプラグを検出#
miio discover
Model info:zhimi.powerstrip.v2と表示されるは Xiaomi のスマートプラグです。下記の 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