跳转至

空气净化器

homebridge-mi-airpurifier

安装说明

1. 安装HomeBridge,可以参考 HomeBridge

2. 安装miio,可以参考 miio

3. 本插件适用于以下设备:

MiAirPurifier(小米空气净化器)

MiAirPurifier2(小米空气净化器2)

MiAirPurifierPro(小米空气净化器Pro)

MiAirPurifier2S(小米空气净化器2S)

MiAirPurifierMAX(米家空气净化器MAX)

4. 安装本插件。

4.1 命令如下:

sudo npm install -g homebridge-mi-airpurifier

4.2 示例:

pi@raspberrypi:~$ sudo npm install -g homebridge-mi-airpurifier
/usr/lib

mebridge-mi-airpurifier@0.1.3 
io@0.14.1 
 lk@1.1.3 
i-styles@2.2.1 
cape-string-regexp@1.0.5 
 s-ansi@2.0.0 
i-regex@2.1.1 
                            y
rts-color@2.0.0 

rts-color@2.0.0 

rts-color@2.0.0 

rts-color@2.0.0 

rts-color@2.0.0 

rts-color@2.0.0 
@2.0.0 
n       imist@1.2.0 
nimist@0.0.8 

5. 创建Config.json

5.1 在/home/pi/路径下新建.homebridge文件夹。

sudo mkdir .homebridge

5.2 在/home/pi/.homebridge/路径下创建config.json文件。

sudo nano .homebridge/config.json

5.3 进入nano编辑器,编辑config.json文件。

{
    "bridge": {
        "name": "airpurifier",
        "username": "xx:xx:xx:xx:xx:xx",
        "port": xxxxx,
        "pin": "xxx-xx-xxx"
    },
"platforms": [{
    "platform": "MiAirPurifierPlatform",
    "deviceCfgs": [{
        "type": "MiAirPurifier",
        "ip": "192.168.88.xx",
        "token": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
        "airPurifierDisable": false,
        "airPurifierName": "MiAirPurifier",
        "silentModeSwitchDisable": false,
        "silentModeSwitchName": "MiAirPurifier Silent Mode Switch",
        "buzzerSwitchDisable": true,
        "buzzerSwitchName": "MiAirPurifier Buzzer Switch",
        "ledBulbDisable": true,
        "ledBulbName": "MiAirPurifier LED Switch",
        "airQualityDisable": false,
        "airQualityName": "MiAirPurifier AirQuality"
    }, {
        "type": "MiAirPurifier2",
        "ip": "192.168.88.xx",
        "token": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
        "airPurifierDisable": false,
        "airPurifierName": "MiAirPurifier2",
        "silentModeSwitchDisable": false,
        "silentModeSwitchName": "MiAirPurifier2 Silent Mode Switch",
        "temperatureDisable": false,
        "temperatureName": "MiAirPurifier2 Temperature",
        "humidityDisable": false,
        "humidityName": "MiAirPurifier2 Humidity",
        "buzzerSwitchDisable": true,
        "buzzerSwitchName": "MiAirPurifier2 Buzzer Switch",
        "ledBulbDisable": true,
        "ledBulbName": "MiAirPurifier2 LED Switch",
        "airQualityDisable": false,
        "airQualityName": "MiAirPurifier2 AirQuality"
    }, {
        "type": "MiAirPurifierPro",
        "ip": "192.168.88.xx",
        "token": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
        "airPurifierDisable": false,
        "airPurifierName": "MiAirPurifierPro",
        "silentModeSwitchDisable": false,
        "silentModeSwitchName": "MiAirPurifierPro Silent Mode Switch",
        "temperatureDisable": false,
        "temperatureName": "MiAirPurifierPro Temperature",
        "humidityDisable": false,
        "humidityName": "MiAirPurifierPro Humidity",
        "buzzerSwitchDisable": true,
        "buzzerSwitchName": "MiAirPurifierPro Buzzer Switch",
        "ledBulbDisable": true,
        "ledBulbName": "MiAirPurifierPro LED Switch",
        "airQualityDisable": false,
        "airQualityName": "MiAirPurifierPro AirQuality"
    }, {
        "type": "MiAirPurifier2S",
        "ip": "192.168.88.xx",
        "token": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
        "airPurifierDisable": false,
        "airPurifierName": "MiAirPurifier2S",
        "silentModeSwitchDisable": false,
        "silentModeSwitchName": "MiAirPurifier2S Silent Mode Switch",
        "temperatureDisable": false,
        "temperatureName": "MiAirPurifier2S Temperature",
        "humidityDisable": false,
        "humidityName": "MiAirPurifier2S Humidity",
        "buzzerSwitchDisable": true,
        "buzzerSwitchName": "MiAirPurifier2S Buzzer Switch",
        "ledBulbDisable": true,
        "ledBulbName": "MiAirPurifier2S LED Switch",
        "airQualityDisable": false,
        "airQualityName": "MiAirPurifier2S AirQuality"
    }]
}]
}

5.4 config.json编辑说明

"username"

必须大写,由大写字母或数字组成的类似于mac地址的一组十六进制数(如果多开,每个插件请不要完全一样);

"port"

端口号,5位数字(如果多开,每个插件请不要完全一样);

"pin"

HomeKit设备代码,类似于000-00-000的三组纯数字(每个插件请不要完全一样);

"type"

请参考 3. 本插件适用于以下设备 并根据你的设备型号来选择类型天蝎;

"ip"

你的空气净化器的IP地址,请在路由器或其它设备中查看;

"token"

请参考本站 获取设备的token值 进行获取。

5.5 保存json并退出

编辑完毕,同时按下 Ctrl+O ,点击 回车 保存,再同时按下 Ctrl+X 退出nano编辑器,返回pi@raspberrypi:~$界面。

6. 启动HomeBridge

6.1 命令如下:

homebridge -D

6.2 启动成功示意:

*** WARNING *** The program 'nodejs' uses the Apple Bonjour compatibility layer of Avahi.
*** WARNING *** Please fix your application to use the native API of Avahi!
*** WARNING *** For more information see <http://0pointer.de/avahi-compat?s=libdns_sd&e=nodejs>
*** WARNING *** The program 'nodejs' called 'DNSServiceRegister()' which is not supported (or only supported partially) in the Apple Bonjour compatibility layer of Avahi.
*** WARNING *** Please fix your application to use the native API of Avahi!
*** WARNING *** For more information see <http://0pointer.de/avahi-compat?s=libdns_sd&e=nodejs&f=DNSServiceRegister>
[11/14/2018, 9:41:20 AM] Loaded plugin: homebridge-mi-airpurifier
[11/14/2018, 9:41:20 AM] Registering platform 'homebridge-mi-airpurifier.MiAirPurifierPlatform'
[11/14/2018, 9:41:20 AM] ---
[11/14/2018, 9:41:21 AM] Loaded plugin: homebridge-mi-camera
[11/14/2018, 9:41:21 AM] Registering accessory 'homebridge-mi-camera.MiCamera'
[11/14/2018, 9:41:21 AM] ---
[11/14/2018, 9:41:21 AM] Loaded config.json with 0 accessories and 1 platforms.
[11/14/2018, 9:41:21 AM] ---
[11/14/2018, 9:41:21 AM] Loading 1 platforms...
[11/14/2018, 9:41:21 AM] [MiAirPurifierPlatform] Initializing MiAirPurifierPlatform platform...
[11/14/2018, 9:41:21 AM] [MiAirPurifierPlatform] [MiAirPurifierPlatform][INFO]*******************************************************************
[11/14/2018, 9:41:21 AM] [MiAirPurifierPlatform] [MiAirPurifierPlatform][INFO]          MiAirPurifierPlatform v0.1.3 By YinHang
[11/14/2018, 9:41:21 AM] [MiAirPurifierPlatform] [MiAirPurifierPlatform][INFO]  GitHub: https://github.com/YinHangCode/homebridge-mi-airpurifier 
[11/14/2018, 9:41:21 AM] [MiAirPurifierPlatform] [MiAirPurifierPlatform][INFO]                                              QQ Group: 107927710  
[11/14/2018, 9:41:21 AM] [MiAirPurifierPlatform] [MiAirPurifierPlatform][INFO]*******************************************************************
[11/14/2018, 9:41:21 AM] [MiAirPurifierPlatform] [MiAirPurifierPlatform][INFO]start success...
[11/14/2018, 9:41:21 AM] [MiAirPurifierPlatform] [MiAirPurifierPlatform][DEBUG]Initializing MiAirPurifier2S device: 192.168.199.194, accessories size: 4
[11/14/2018, 9:41:21 AM] [MiAirPurifierPlatform] [MiAirPurifierPlatform][INFO]device size: 1, accessories size: 4
[11/14/2018, 9:41:21 AM] [MiAirPurifierPlatform] Initializing platform accessory 'MiAirPurifier2S'...
HAP Warning: Characteristic 000000AC-0000-1000-8000-0026BB765291 not in required or optional characteristics for service 000000BB-0000-1000-8000-0026BB765291. Adding anyway.
[11/14/2018, 9:41:21 AM] [MiAirPurifierPlatform] Initializing platform accessory 'MiAirPurifier2S Temperature'...
[11/14/2018, 9:41:21 AM] [MiAirPurifierPlatform] Initializing platform accessory 'MiAirPurifier2S Humidity'...
[11/14/2018, 9:41:21 AM] [MiAirPurifierPlatform] Initializing platform accessory 'MiAirPurifier2S AirQuality'...
Load homebridge-mi-airpurifier.MiAirPurifierPlatform
Scan this code with your HomeKit App on your iOS device to pair with Homebridge:


     000-00-010   

7. HomeKit添加设备

7.1 打开iPhone或者iPad中的家庭app;

7.2 点击右上角的 + 添加,添加配件;

7.3 点击“没有代码或无法扫描?”;

7.4 点击“输入代码”,并输入pin码;

7.5 设备添加成功。