homebridge plugin for XiaoMi Aqara plugin.
小米/绿米网关的HomeBridge插件。
Thanks fornfarina(the author of homebridge),snOOrz(the author of homebridge-aqara),licuhui,攀旺智能,magaHH,isundaylee,ileler,myriky,Runc2333,yangliu,wonderfullay,BrianHenryIE,all other developer and testers.
感谢nfarina(homebridge的作者),snOOrz(homebridge-aqara的作者),licuhui,攀旺智能,magaHH,isundaylee,ileler,myriky,Runc2333,yangliu,wonderfullay,BrianHenryIE,以及每一位开发者和测试者.
Note: I have only a part of these devices, so some devices don't have tested. If you find bugs, please submit them to issues or QQ Group: 107927710.
注意: 我只有一部分设备, 所以一些设备没有得到充分的测试。 如果你发现Bug,请提交到 issues 或 QQ群: 107927710。
Note: According to aqara local network protocol use UDP port 9898, please notice the relevant configuration of firewall.
注意: 绿米的局域网协议使用的是UDP的9898端口,请配置好防火墙的相关配置。
Note: 0.5.x update to 0.6.x must be clear register accessories and update configuration file content.
注意: 0.5.x版本升级到0.6.x版本必须清空注册设备信息并且更新配置文件内容.
Note: About AcPartner, This project only provides gateway functionality. If you want the use air conditioning function, please refer to the project for homebridge-mi-acPartner.
注意: 有关空调伴侣,这个项目只提供网关的功能,如果你需要使用空调的功能,请参考项目homebridge-mi-acPartner。
Device Name 设备名称 |
Protocol Model Value 协议Model值 |
|
---|---|---|
1 | Gateway(网关) | gateway gateway.v3 |
2 | ContactSensor(门磁感应) | magnet sensor_magnet |
3 | MotionSensor(人体感应) | motion |
4 | Button(按钮) | switch sensor_switch |
5 | TemperatureAndHumiditySensor(温度湿度传感器) | sensor_ht |
6 | SingleSwitch(单按钮墙壁开关) | ctrl_neutral1 |
7 | DuplexSwitch(双按钮墙壁开关) | ctrl_neutral2 |
8 | SingleSwitchLN(单按钮墙壁开关零火版) | ctrl_ln1 ctrl_ln1.aq1 |
9 | DuplexSwitchLN(双按钮墙壁开关零火版) | ctrl_ln2 ctrl_ln2.aq1 |
10 | SingleButton86(86型无线单按钮开关) | 86sw1 sensor_86sw1.aq1 sensor_86sw1 |
11 | DuplexButton86(86型无线双按钮开关) | 86sw2 sensor_86sw2.aq1 sensor_86sw2 |
12 | PlugBase(插座) | plug |
13 | PlugBase86(86型墙壁插座) | 86plug ctrl_86plug ctrl_86plug.aq1 |
14 | MagicSquare(魔方) | cube sensor_cube sensor_cube.aqgl01 |
15 | SmokeDetector(烟雾报警器) | smoke sensor_smoke |
16 | NatgasDetector(天然气报警器) | natgas sensor_natgas |
17 | ElectricCurtain(电动窗帘) | curtain |
18 | ContactSensor2(门磁感应第二代) | sensor_magnet.aq2 |
19 | MotionSensor2(人体感应第二代) | sensor_motion.aq2 |
20 | Button2(按钮第二代) | sensor_switch.aq2 remote.b1acn01 |
21 | TemperatureAndHumiditySensor2(温度湿度传感器第二代) | weather.v1 weather |
22 | WaterDetector(水浸传感器) | sensor_wleak.aq1 |
23 | Lock(门锁) | lock.aq1 |
24 | AcPartner(空调伴侣升级版) | acpartner.v3 |
25 | Button3(按钮第二代升级版) | sensor_switch.aq3 |
26 | DuplexButton862(86型无线双按钮开关升级版) | remote.b286acn01 |
27 | VibrationSensor(动静贴) | vibration |
28 | ElectricCurtainBattery(电动窗帘锂电池版) | curtain.hagl04 |
npm install -g homebridge-mi-aqara
Name 名称 |
Required 是否必填 |
Value Type 值的数据类型 |
Description 功能描述 |
Value Example 参考值 |
|
---|---|---|---|---|---|
1 | platform | True 是 |
String 字符串 |
It must be 'MiAqaraPlatform' 必须写'MiAqaraPlatform' |
|
2 | gateways | True 是 |
Object 对象 |
set gateway information. 网关的信息 |
{ "6409802da3b3": "02i44k56zrgg578b" } |
3 | bindAddress | False 否 |
String 字符串 |
specified network. 指定工作网络 |
"10.0.1.1" |
4 | sendWhoisCmdInterval | False 否 |
Integer 整型 |
set send whois cmd interval. 设置多久自动发送一次whois命令 |
3600000 |
5 | autoRemoveAccessoryInterval | False 否 |
Integer 整型 |
set auto remove accessory interval. 指定自动删除配件检测间隔时间 |
3600000 |
6 | defaultValue | False 否 |
Object 对象 |
set device default value. 默认值的配置 |
|
7 | manage | False 否 |
Object 对象 |
open manage and manage configs. 管理页面的配置 |
{ "port": 11128, "password": "107927710" } |
8 | mqtt | False 否 |
Object 对象 |
open mqtt and mqtt configs. mqtt相关配置 |
{ "username": "mqtt", "password": "107927710" } |
For more information about config, Please refer to file sampleConfig.json
.
有关配置,可以参考配置文件 sampleConfig.json
。
Open aqara gateway's settings, enable local network protocol.
在网关的设置页面,打开 局域网控制协议。
Please follow the steps in this thread: http://wiki.yinhh.com/Wiki.jsp?page=Homebridge-mi-aqara or http://bbs.xiaomi.cn/t-13198850. It's in Chinese so you might need a translator to read it.
可以参考如下教程:http://wiki.yinhh.com/Wiki.jsp?page=Homebridge-mi-aqara 或 http://bbs.xiaomi.cn/t-13198850
On iPhone:
步骤可参考:
(…)
Settings button(…)
按钮About
关于
LAN Communication Protocol
局域网通信协议
LAN Communication Protocol
switch to onPassword
密码
旁边的字母数字代码OK
OK
Gateway Information
网关信息
mac=
mac=
上的MAC地址To control the devices, put gateway's MAC address (lower case without colon) and password (keep original and case sensitive) to ~/.homebridge/config.json.
将网关的mac地址(小写字母 去掉冒号)和密码(保持原始 区分大小写)写入到配置文件 ~/.homebridge/config.json。
Warning: gateway's MAC address (lower case without colon) and password (keep original and case sensitive).
警告: 网关的MAC地址 (全部小写 去掉冒号) 密码 (保持原始 区分大小写) 。
Warning: gateway's MAC address (lower case without colon) and password (keep original and case sensitive).
警告: 网关的MAC地址 (全部小写 去掉冒号) 密码 (保持原始 区分大小写) 。
Warning: gateway's MAC address (lower case without colon) and password (keep original and case sensitive).
警告: 网关的MAC地址 (全部小写 去掉冒号) 密码 (保持原始 区分大小写) 。
Important things are to be repeated for 3 times.
重要的事情说三遍。
{
"platforms": [{
"platform": "MiAqaraPlatform",
"gateways": {
"6409802da3b3": "02i44k56zrgg578b"
}
}]
}
If you have more than one gateways, fill them in right order, like below:
如果你有多个网关,可以这样填写:
{
"platforms": [{
"platform": "MiAqaraPlatform",
"gateways": {
"6409802da3b3": "02i44k56zrgg578b",
"f0b4299a5b2b": "2F92E7DA90C66B86",
"f0b4299a77dd": "syu3oasva3uqd5qd"
}
}]
}
Here is a way to search for gateways instead of multicast, because of some friends do not respond to information from gateway in their network environment.
有一些朋友的网络环境有一些问题,无法正常使用组播,这里提供一种配置方式来替代通过组播的方式寻找网关。
That is to say, we can config the IP address of the gateway to replace search gateway by multicast.
也就是说,可以通过配置网关的IP来替换通过组播的方式寻找网关。
{
"platforms": [{
"platform": "MiAqaraPlatform",
"gateways": {
"6409802da3b3": {
"password": "02i44k56zrgg578b",
"ip": "10.3.3.1"
},
"f0b4299a5b2b": {
"password": "2F92E7DA90C66B86",
"ip": "10.3.3.2"
},
"f0b4299a77dd": {
"password": "syu3oasva3uqd5qd",
"ip": "10.3.3.3"
}
}
}]
}
It can also be mixed config, but without full configuration of ip, multicast packets will still be sent to search for other gateways which do not config ip.
也可以混合配置,不过只要有一个网关没有配置IP,程序就会发送组播信息来寻找未配置IP的网关。若所有网关全部配置了IP,则程序不发送组播包寻找网关。
{
"platforms": [{
"platform": "MiAqaraPlatform",
"gateways": {
"6409802da3b3": "02i44k56zrgg578b",
"f0b4299a5b2b": {
"password": "2F92E7DA90C66B86",
"ip": "10.3.3.2"
},
"f0b4299a77dd": {
"password": "syu3oasva3uqd5qd",
"ip": "10.3.3.3"
}
}
}]
}
If your device(which running homebridge) has multiple network, please add the bindAddress configuration item to decide to listen which network, like below:
如果你运行HomeBridge的设备有多块网卡并且在多个网络中,可以通过这个配置来指定使用哪一个网络,配置如下:
{
"platforms": [{
"platform": "MiAqaraPlatform",
"bindAddress": "10.0.1.1",
"gateways": {
"6409802da3b3": "02i44k56zrgg578b",
"f0b4299a5b2b": "2F92E7DA90C66B86",
"f0b4299a77dd": "syu3oasva3uqd5qd"
}
}]
}
If this configuration item is not to configure, it will be send whois command every hour by default.
如果该配置项不填写,默认情况下,每小时发送一次。
If your network has some problems and you can't receive the heartbeat packet, you can use send whois command to replace the heartbeat function. If you use it in this way, you can set the value of the configuration item to 5 seconds, that is 5000. example:
如果你的网络有一些问题,无法收到心跳包,那么你可以使用发送a来替代心跳功能,如果这样使用,可以将配置项的值设为5秒,即5000,例子如下:
{
"platforms": [{
"platform": "MiAqaraPlatform",
"bindAddress": "10.0.1.1",
"sendWhoisCmdInterval": 5000,
"gateways": {
"6409802da3b3": "02i44k56zrgg578b",
"f0b4299a5b2b": "2F92E7DA90C66B86",
"f0b4299a77dd": "syu3oasva3uqd5qd"
}
}]
}
If you want the plugin to help you automatically delete devices that have not received heartbeat for a long time, you can configure this item. The value is how often to detect. If you don't need to automatically delete accessories, you can not configure this configuration.
如果你希望插件帮你自动删除长时间收不到心跳的设备,则可以配置此项目,该值为多久检测一次。如果不需要自动删除配件功能,可以不配置此配置。
note: long time is defined as: no heartbeat received in more than 7 days.
注:长时间的定义为:超过7天未收到心跳。
{
"platforms": [{
"platform": "MiAqaraPlatform",
"bindAddress": "10.0.1.1",
"autoRemoveAccessoryInterval": 3600000,
"gateways": {
"6409802da3b3": "02i44k56zrgg578b",
"f0b4299a5b2b": "2F92E7DA90C66B86",
"f0b4299a77dd": "syu3oasva3uqd5qd"
}
}]
}
If you want to specify the default value, such as specify the name of the accessory, hide the accessory, any other configs. You can add a defaultValue mapping table to your config.json.
如果你想要指定默认值,比如配件的名字,是否隐藏配件以及其他一些配置,你可以在你的配置文件config.json中增加defaultValue配置项。The config supported are as follows:
这个配置支持如下功能:
Name 名称 |
Value Type 数据类型 |
Description 描述 |
Default Value 默认值 |
Recommended Value 建议值 |
Value Example 值举例 |
|
---|---|---|---|---|---|---|
1 | name | String 字符串 |
set accessory name. 名字 |
DeviceAccessoryType_device SID last four bits 设备配件类型_设备SID的后四位 |
"living room temperature" "卧室的温度" |
|
2 | serviceType | String 字符串 |
set accessory type for Switch or Lightbulb. 设置配件类型是开关或者灯。 Currently only supported: SingleSwitch, DuplexSwitch, SingleSwitchLN, DuplexSwitchLN. 当前只支持如下设备:单火线单键墙壁开关,单火线双键墙壁开关,零火单键墙壁开关,零火双键墙壁开关。 |
"Switch" | "Switch" | "Lightbulb" |
3 | disable | Boolean 布尔 |
disable accessory 隐藏设备 |
false | the accessories that do not need to be set to true, such as virtual press. 如果配件不需要时设置为true,如一些设备的虚拟按键。 |
true |
4 | syncValue | Boolean 布尔 |
accessory will synchronization value when homebridge call the get function, if it's true. 如果设为true,配件会在HomeBridge每次调用get方法时同步一次值。 |
false | fasle | false |
5 | ignoreWriteResult | Boolean 布尔 |
if set to true, the result of control is not detected. 如果设为true,则忽略控制结果检测。 |
true | If your network is awful, it's recommended to be set true. 如果网络环境不是很好,建议设为true |
false |
6 | disableNoResponse | Boolean 布尔 |
use jump back the last value to replace show NoResponse, you can set it true. 如果设为true,当设备未响应时配件通过自动跳回上一个值的方式来替代显示未响应 |
false | false | true |
The rules are as follows:
配置规则如下:
{
"platforms": [{
"platform": "MiAqaraPlatform",
"gateways": {
"6409802da3b3": "02i44k56zrgg578b",
"f0b4299a5b2b": "2F92E7DA90C66B86",
"f0b4299a77dd": "syu3oasva3uqd5qd"
},
"defaultValue": {
"device1 sid": {
"DeviceAccessoryType1": {
"config1": "config1 value"
}
},
"device2 sid": {
"DeviceAccessoryType1": {
"config1": "config1 value"
"config2": "config2 value"
},
"DeviceAccessoryType2": {
"config1": "config1 value"
}
}
}
}]
}
examples:
例子:
{
"platforms": [{
"platform": "MiAqaraPlatform",
"gateways": {
"6409802da3b3": "02i44k56zrgg578b",
"f0b4299a5b2b": "2F92E7DA90C66B86",
"f0b4299a77dd": "syu3oasva3uqd5qd"
},
"defaultValue": {
"158d0001000001": {
"ContactSensor_ContactSensor": {
"name": "entrance door"
}
},
"158d0001000002": {
"MotionSensor2_MotionSensor": {
"name": "study room motion sensor"
},
"MotionSensor2_LightSensor": {
"name": "study room light sensor"
}
}
}
}]
}
The rules of A DeviceAccessoryType:
设备配件类型的规则如下:
DeviceName_HomeBridgeAccessoryType(_ExtraMessage)
设备名称_HomeBridge的配件类型(_附加信息)
detail:
具体如下:
Device Name 设备名称 |
DeviceAccessoryType 设备包含的设备配件类型 |
|
---|---|---|
1 | Gateway(网关) | Gateway_Lightbulb Gateway_LightSensor Gateway_Switch_JoinPermission |
2 | ContactSensor(门磁感应) | ContactSensor_ContactSensor |
3 | MotionSensor(人体感应) | MotionSensor_MotionSensor |
4 | Button(按钮) | Button_StatelessProgrammableSwitch Button_Switch_VirtualSinglePress Button_Switch_VirtualDoublePress |
5 | TemperatureAndHumiditySensor(温度湿度传感器) | TemperatureAndHumiditySensor_TemperatureSensor TemperatureAndHumiditySensor_HumiditySensor |
6 | SingleSwitch(单按钮墙壁开关) | SingleSwitch_Switch |
7 | DuplexSwitch(双按钮墙壁开关) | DuplexSwitch_Switch_Left DuplexSwitch_Switch_Right |
8 | SingleSwitchLN(单按钮墙壁开关零火版) | SingleSwitchLN_Switch |
9 | DuplexSwitchLN(双按钮墙壁开关零火版) | DuplexSwitchLN_Switch_Left DuplexSwitchLN_Switch_Right |
10 | SingleButton86(86型无线单按钮开关) | SingleButton86_StatelessProgrammableSwitch SingleButton86_Switch_VirtualSinglePress |
11 | DuplexButton86(86型无线双按钮开关) | DuplexButton86_StatelessProgrammableSwitch_Left DuplexButton86_Switch_VirtualSinglePress_Left DuplexButton86_StatelessProgrammableSwitch_Right DuplexButton86_Switch_VirtualSinglePress_Right DuplexButton86_StatelessProgrammableSwitch_Both DuplexButton86_Switch_VirtualSinglePress_Both |
12 | PlugBase(插座) | PlugBase_Outlet |
13 | PlugBase86(86型墙壁插座) | PlugBase86_Outlet |
14 | MagicSquare(魔方) | MagicSquare_StatelessProgrammableSwitch_Flip90 MagicSquare_StatelessProgrammableSwitch_Flip180 MagicSquare_StatelessProgrammableSwitch_Move MagicSquare_StatelessProgrammableSwitch_TapTwice MagicSquare_StatelessProgrammableSwitch_ShakeAir MagicSquare_StatelessProgrammableSwitch_Rotate MagicSquare_Switch_VirtualFlip90 MagicSquare_Switch_VirtualFlip180 MagicSquare_Switch_VirtualMove MagicSquare_Switch_VirtualTapTwice MagicSquare_Switch_VirtualShakeAir |
15 | SmokeDetector(烟雾报警器) | SmokeDetector_SmokeSensor |
16 | NatgasDetector(天然气报警器) | NatgasDetector_SmokeSensor |
17 | ElectricCurtain(电动窗帘) | ElectricCurtain_WindowCovering |
18 | ContactSensor2(门磁感应第二代) | ContactSensor2_ContactSensor |
19 | MotionSensor2(人体感应第二代) | MotionSensor2_MotionSensor MotionSensor2_LightSensor |
20 | Button2(按钮第二代) | Button2_StatelessProgrammableSwitch Button2_Switch_VirtualSinglePress Button2_Switch_VirtualDoublePress |
21 | TemperatureAndHumiditySensor2(温度湿度传感器第二代) | TemperatureAndHumiditySensor2_TemperatureSensor TemperatureAndHumiditySensor2_HumiditySensor |
22 | WaterDetector(水浸传感器) | WaterDetector_LeakSensor |
23 | Lock(门锁) | Lock_MotionSensor Lock_MotionSensor_{UserID} |
24 | AcPartner(空调伴侣升级版) | AcPartner_LightSensor AcPartner_Switch_JoinPermission |
25 | Button3(按钮第二代升级版) | Button3_StatelessProgrammableSwitch Button3_StatelessProgrammableSwitch_Shake Button3_Switch_VirtualSinglePress Button3_Switch_VirtualDoublePress Button3_Switch_VirtualShare |
26 | DuplexButton862(86型无线双按钮开关升级版) | DuplexButton862_StatelessProgrammableSwitch_Left DuplexButton862_Switch_VirtualSinglePress_Left DuplexButton862_Switch_VirtualDoublePress_Left DuplexButton862_StatelessProgrammableSwitch_Right DuplexButton862_Switch_VirtualSinglePress_Right DuplexButton862_Switch_VirtualDoublePress_Right DuplexButton862_StatelessProgrammableSwitch_Both DuplexButton862_Switch_VirtualSinglePress_Both |
27 | VibrationSensor(动静贴) | VibrationSensor_MotionSensor_Vibrate VibrationSensor_MotionSensor_Tilt VibrationSensor_MotionSensor_FreeFall |
28 | ElectricCurtainBattery(电动窗帘锂电池版) | ElectricCurtainBattery_WindowCovering |
About Global:
有关全局配置方式:
Some similar configurations and repeated multiple copies are boring things. So I provided a global writing method.
一些类似的配置和重复的多次拷贝是件比较烦的事情,所以我提供了一个全局的功能:
The following two methods of writing are equivalent:
下面两段配置的效果是等同的:
....
"158d0001000008": {
"DuplexSwitch_Switch_Left": {
"name": "master bedroom room light",
"serviceType": "Lightbulb"
},
"DuplexSwitch_Switch_Right": {
"name": "study room light",
"serviceType": "Lightbulb"
}
}
....
....
"158d0001000008": {
"Global": {
"serviceType": "Lightbulb"
},
"DuplexSwitch_Switch_Left": {
"name": "master bedroom room light"
},
"DuplexSwitch_Switch_Right": {
"name": "study room light"
}
}
....
In the same way, the following two kinds of writing are alse equivalent:
同样的方式,下面两段配置的效果也是等同的:
....
"158d0001000003": {
"Button_StatelessProgrammableSwitch": {
"name": "living room button"
},
"Button_Switch_VirtualSinglePress": {
"name": "living room button virtual single press",
"disable": true
},
"Button_Switch_VirtualDoublePress": {
"name": "living room button virtual double press",
"disable": true
}
}
....
....
"158d0001000003": {
"Global": {
"disable": true
},
"Button_StatelessProgrammableSwitch": {
"name": "living room button",
"disable": false
},
"Button_Switch_VirtualSinglePress": {
"name": "living room button virtual single press"
},
"Button_Switch_VirtualDoublePress": {
"name": "living room button virtual double press"
}
}
....
It also provides a higher level of way, the following three kinds of writing are alse equivalent:
更高层级的配置也可适用,如下三段配置的效果均是等同的:
{
"platforms": [{
"platform": "MiAqaraPlatform",
"gateways": {
"6409802da3b3": "02i44k56zrgg578b",
"f0b4299a5b2b": "2F92E7DA90C66B86",
"f0b4299a77dd": "syu3oasva3uqd5qd"
},
"defaultValue": {
"158d0001000007": {
"SingleSwitch_Switch": {
"name": "living room light",
"ignoreWriteResult": true
}
},
"158d0001000008": {
"DuplexSwitch_Switch_Left": {
"name": "master bedroom room light",
"ignoreWriteResult": true
},
"DuplexSwitch_Switch_Right": {
"name": "study room light",
"ignoreWriteResult": true
}
}
}
}]
}
{
"platforms": [{
"platform": "MiAqaraPlatform",
"gateways": {
"6409802da3b3": "02i44k56zrgg578b",
"f0b4299a5b2b": "2F92E7DA90C66B86",
"f0b4299a77dd": "syu3oasva3uqd5qd"
},
"defaultValue": {
"158d0001000007": {
"SingleSwitch_Switch": {
"name": "living room light",
"ignoreWriteResult": true
}
},
"158d0001000008": {
"Global": {
"ignoreWriteResult": true
},
"DuplexSwitch_Switch_Left": {
"name": "master bedroom room light"
},
"DuplexSwitch_Switch_Right": {
"name": "study room light"
}
}
}
}]
}
{
"platforms": [{
"platform": "MiAqaraPlatform",
"gateways": {
"6409802da3b3": "02i44k56zrgg578b",
"f0b4299a5b2b": "2F92E7DA90C66B86",
"f0b4299a77dd": "syu3oasva3uqd5qd"
},
"defaultValue": {
"Global": {
"ignoreWriteResult": true
},
"158d0001000007": {
"SingleSwitch_Switch": {
"name": "living room light"
}
},
"158d0001000008": {
"DuplexSwitch_Switch_Left": {
"name": "master bedroom room light"
},
"DuplexSwitch_Switch_Right": {
"name": "study room light"
}
}
}
}]
}
If you want to specify the default name of the device, add a mapping table to your config.json like this:
如果你想给设备指定名称,可以像这样配置:
{
"platforms": [{
"platform": "MiAqaraPlatform",
"gateways": {
"6409802da3b3": "02i44k56zrgg578b",
"f0b4299a5b2b": "2F92E7DA90C66B86",
"f0b4299a77dd": "syu3oasva3uqd5qd"
},
"defaultValue": {
"158d0001000001": {
"ContactSensor_ContactSensor": {
"name": "entrance door"
}
},
"158d0001000002": {
"MotionSensor2_MotionSensor": {
"name": "study room motion sensor"
},
"MotionSensor2_LightSensor": {
"name": "study room light sensor"
}
},
"158d0001000004": {
"TemperatureAndHumiditySensor_TemperatureSensor": {
"name": "living room temperature"
},
"TemperatureAndHumiditySensor_HumiditySensor": {
"name": "living room humidity"
}
}
}
}]
}
If you like to use Light Bulb type for Light Switch to make grandma Siri happy, like snOOrz, you can set the following in the config:
如果你想用灯泡类型来替换开关类型使你的奶奶开心,就像snoorz那样,你可以像如下这样设置:
Currently only supported: SingleSwitch, DuplexSwitch, SingleSwitchLN, DuplexSwitchLN.
目前只支持:单火线单键墙壁开关,单火线双键墙壁开关,零火单键墙壁开关,零火双键墙壁开关。
If you changed serviceType config, Please clear register accessories.
如果你修改过配件类型配置, 请清除注册配件.
{
"platforms": [{
"platform": "MiAqaraPlatform",
"gateways": {
"6409802da3b3": "02i44k56zrgg578b",
"f0b4299a5b2b": "2F92E7DA90C66B86",
"f0b4299a77dd": "syu3oasva3uqd5qd"
},
"defaultValue": {
"158d0001000007": {
"SingleSwitch_Switch": {
"name": "living room light",
"serviceType": "Lightbulb"
}
},
"158d0001000008": {
"Global": {
"serviceType": "Lightbulb"
},
"DuplexSwitch_Switch_Left": {
"name": "master bedroom room light"
},
"DuplexSwitch_Switch_Right": {
"name": "study room light"
}
},
"158d10010000001": {
"DuplexSwitch_Switch_Left": {
"name": "master bedroom room light",
"serviceType": "Lightbulb"
},
"DuplexSwitch_Switch_Right": {
"name": "study room light"
}
}
}
}]
}
If you want to disable accessories, you can add disable attribute to config.
如果你想隐藏一些配件,你可以增加disable属性到你的配置。
{
"platforms": [{
"platform": "MiAqaraPlatform",
"gateways": {
"6409802da3b3": "02i44k56zrgg578b",
"f0b4299a5b2b": "2F92E7DA90C66B86",
"f0b4299a77dd": "syu3oasva3uqd5qd"
},
"defaultValue": {
"158d0001000007": {
"SingleSwitch_Switch": {
"name": "living room light",
"serviceType": "Lightbulb"
}
},
"158d0001000008": {
"DuplexSwitch_Switch_Left": {
"name": "master bedroom room light",
"serviceType": "Lightbulb",
"disable": false
},
"DuplexSwitch_Switch_Right": {
"name": "study room light",
"serviceType": "Lightbulb",
"disable": true
}
},
"158d0001000004": {
"TemperatureAndHumiditySensor_TemperatureSensor": {
"name": "living room temperature"
},
"TemperatureAndHumiditySensor_HumiditySensor": {
"name": "living room humidity",
"disable": true
}
},
"158d0001000012": {
"Global": {
"disable": true
}
},
"158d0001000015": {
"Global": {
"disable": true
},
"MagicSquare_StatelessProgrammableSwitch_Flip90": {
"name": "study room magic square flip90",
"disable": false
}
}
}
}]
}
If you want to accessory value exact, you can set syncValue is true.
如果您想要附件值精确,您可以设置syncValue为true。
when syncValue is true, accessory will synchronization value when homebridge call the get function. At the same time, it's going to waste more time.
当syncValue为true时,附件将在homebridge调用get函数时同步一次值。同时,也会浪费更多的时间。
when syncValue is false, accessory will use the device last reported value. It's going to respond quickly.
当syncValue为false时,附件将使用设备上次报告的值。它会很快做出反应。
{
"platforms": [{
"platform": "MiAqaraPlatform",
"gateways": {
"6409802da3b3": "02i44k56zrgg578b",
"f0b4299a5b2b": "2F92E7DA90C66B86",
"f0b4299a77dd": "syu3oasva3uqd5qd"
},
"defaultValue": {
"158d0001000007": {
"SingleSwitch_Switch": {
"name": "living room light",
"serviceType": "Lightbulb",
"syncValue": true
}
}
}
}]
}
If you control device always timeout, but in fact it's already working.
如果你控制设备时总是显示超时,但事实上设备已经被控制了。
you can set ignoreWriteResult is true.
您可以将ignoreWriteResult设置为true。
{
"platforms": [{
"platform": "MiAqaraPlatform",
"gateways": {
"6409802da3b3": "02i44k56zrgg578b",
"f0b4299a5b2b": "2F92E7DA90C66B86",
"f0b4299a77dd": "syu3oasva3uqd5qd"
},
"defaultValue": {
"Global": {
"ignoreWriteResult": true
},
"158d0001000007": {
"SingleSwitch_Switch": {
"name": "living room light",
"serviceType": "Lightbulb",
"syncValue": true
}
}
}
}]
}
If you don't like "No Response", you can set disableNoResponse is true.
如果你像渣渣米那样不喜欢设备显示“无响应”,可以将disableoresponse设置为true。
When the device is no pesponse and disableNoResponse is true, the accessory value will auto jump back to before the control.
当设备无响应且disableNoResponse为设为true时,配件的值将自动跳回控制前的值。
{
"platforms": [{
"platform": "MiAqaraPlatform",
"gateways": {
"6409802da3b3": "02i44k56zrgg578b",
"f0b4299a5b2b": "2F92E7DA90C66B86",
"f0b4299a77dd": "syu3oasva3uqd5qd"
},
"defaultValue": {
"Global": {
"disableNoResponse": true
},
"158d0001000007": {
"SingleSwitch_Switch": {
"name": "living room light",
"serviceType": "Lightbulb",
"syncValue": true
}
}
}
}]
}
If you want to use Aqara lock, you need add some configuration like this:
如果你使用门锁,你需要增加如下配置:
{
"platforms": [{
"platform": "MiAqaraPlatform",
"gateways": {
"6409802da3b3": "02i44k56zrgg578b",
"f0b4299a5b2b": "2F92E7DA90C66B86",
"f0b4299a77dd": "syu3oasva3uqd5qd"
},
"defaultValue": {
"LockDeviceID": {
"Lock_MotionSensor": {
"name": "door"
},
"Lock_MotionSensor_{User1ID}": {
"name": "User1Name"
},
"Lock_MotionSensor_{User2ID}": {
"name": "User2Name"
}
}
}
}]
}
{UserID}
is user identification from lock.{UserID}
是来自锁的用户标识。
The value can get from Aqara Lock Plugin
in MIHOME
APP. The user ID contains the ID type.
该值可以从“米家”应用程序中的“门锁插件”获取。用户ID包含ID类型。
The integer value obtained by dividing the user ID by 65536 is the ID type. The ID type value is:
通过将用户ID除以65536而获得的整数值是ID类型。ID类型值为:
{
"platforms": [{
"platform": "MiAqaraPlatform",
"gateways": {
"6409802da3b3": "02i44k56zrgg578b",
"f0b4299a5b2b": "2F92E7DA90C66B86",
"f0b4299a77dd": "syu3oasva3uqd5qd"
},
"defaultValue": {
"158d0001dd0289": {
"Lock_MotionSensor": {
"name": "door"
},
"Lock_MotionSensor_65536": {
"name": "Administrator"
},
"Lock_MotionSensor_65537": {
"name": "Finger"
},
"Lock_MotionSensor_196608": {
"name": "Card"
}
}
}
}]
}
Before version 0.7.x, the addition and deletion of accessories are automatic. The rules are as follows:
在版本0.7.x之前,附件的添加和删除是自动的。规则如下:
find new accessories every one hour, delete accessories which did not receive heartbeat over 7 days.
每1小时查找一次新配件,删除7天内未收到心跳的配件
Obviously, this is not easy to use. So version 0.7.0 added http web manage(if you do not set manage item, then http web manage is close.). config add these:
显然,这并不容易使用。所以版本0.7.0添加了HTTP Web 管理(如果您没有设置管理项,那么Web管理默认是关闭的)。若要开启,配置添加这些:
{
"platforms": [{
"platform": "MiAqaraPlatform",
"manage": {
"port": 11128,
"password": "107927710"
},
"gateways": {
"6409802da3b3": "02i44k56zrgg578b",
"f0b4299a5b2b": "2F92E7DA90C66B86",
"f0b4299a77dd": "syu3oasva3uqd5qd"
}
}]
}
Config items description(配置项描述):
Name 名称 |
Required 是否必填 |
Value Type 值的数据类型 |
Description 功能描述 |
Recommended Value 建议值 |
Value Example 值举例 |
|
---|---|---|---|---|---|---|
1 | port | True 是 |
Integer 整型 |
set manage web port. 设置web管理的端口号。 |
11128 | 11128 |
2 | password | True 是 |
String 字符串 |
set manage web password. 设置web管理的访问密码。 |
"107927710" | "107927710" |
config add these:
配置增加这些:
{
"platforms": [{
"platform": "MiAqaraPlatform",
"mqtt": {
},
"gateways": {
"6409802da3b3": "02i44k56zrgg578b",
"f0b4299a5b2b": "2F92E7DA90C66B86",
"f0b4299a77dd": "syu3oasva3uqd5qd"
}
}]
}
Or
或
{
"platforms": [{
"platform": "MiAqaraPlatform",
"mqtt": {
"server": "10.0.1.1",
"username": "mqtt",
"password": "mqtt"
},
"gateways": {
"6409802da3b3": "02i44k56zrgg578b",
"f0b4299a5b2b": "2F92E7DA90C66B86",
"f0b4299a77dd": "syu3oasva3uqd5qd"
}
}]
}
Config items description(配置项描述):
Name 名称 |
Required 是否必填 |
Value Type 值的数据类型 |
Description 功能描述 |
Default Value 默认值 |
Value Example 值举例 |
|
---|---|---|---|---|---|---|
1 | server | False 否 |
String 字符串 |
set mqtt server ip. 设置mqtt服务器的地址 |
"127.0.0.1" | "10.0.1.1" |
2 | username | False 否 |
String 字符串 |
set mqtt username. 设置mqtt的用户名 |
"mqtt" | "mqtt" |
3 | password | False 否 |
String 字符串 |
set mqtt password. 设置mqtt的密码 |
"mqtt" | "mqtt" |
plugin will send these topic:
插件会发送如下主题:
/homebridge-mi-aqara
: all message. 所有信息。/homebridge-mi-aqara/{cmd}
: all message after {cmd}
filter. 所有信息并按cmd过滤。/homebridge-mi-aqara/{sid}
: all message after {sid}
filter. 所有信息并按sid过滤。/homebridge-mi-aqara/{sid}/{cmd}
: all message after {sid}
and {cmd}
filter.所有信息并按cmd和sid过滤。{cmd}
is iam/get_id_list_ack/discovery_rsp/write_ack/write_rsp/read_ack/read_rsp/report.{sid}
is device's sid.
plugin will accept these topic:
插件会接受如下主题:
/homebridge-mi-aqara/write
: write device. 控制设备。${key}
is okay, this plugin will automatically calculate the key value, for example:${key}
即可,程序会自动填写计算好的key值。例子如下:{"cmd": "write", "model": "ctrl_neutral2", "sid": "158d00014a1bcd", "params": [{"channel_0": "off"}], "key": "${key}"}
Button/Button2 StatelessProgrammableSwitch support SinglePress, DoublePress, LongPress.
SingleButton86/DuplexButton86(Left, Right, Both) StatelessProgrammableSwitch only support SinglePress.
MagicSquare(Flip90, Flip180, Move, TapTwice, ShakeAir, Rotate) StatelessProgrammableSwitch only support SinglePress.
homebridge
run by debug
Debug模式运行
homebridge -D
cd ~/.homebridge/accessories/
mv cachedAccessories cachedAccessories_\`date '+%Y%m%d_%H%M%S'\`.bak
echo [] > cachedAccessories
homebridge-mi-airpurifier XiaoMi air purifier plugins for HomeBridge. Thanks for nfarina(the author of homebridge), OpenMiHome, aholstenson(the author of miio), licuhui, superszy, all other developer
homebridge-mi-acpartner English Version | 中文版 小米空调伴侣的Homebridge插件 感谢takatost,miio,YinHangCode和所有测试开发人员提供支持。 注意:此插件于0.6.0版本后修改了配置文件,请根据本文修改你的配置文件使插件正常工作。 若要查看抓包教程,请访问此项目Github的Wiki页面 Support(支持) 空调伴侣型号
homebridge-mi-hygrothermograph Homebridge plugin for exposing measured temperature and humidity from Xiaomi sensors as HomeKit accessories. Supported sensors: Xiaomi Mi Bluetooth Temperature and Hu
homebridge-mi-fan XiaoMi fan plugins for HomeBridge. Thanks for nfarina(the author of homebridge), OpenMiHome, aholstenson(the author of miio), ABC, 小马哥, all other developer and testers. Note: If you
homebridge-mi-outlet XiaoMi outlet plugins for HomeBridge. Thanks for nfarina(the author of homebridge), OpenMiHome, aholstenson(the author of miio), all other developer and testers. Note: I have only
homebridge-mi-heatercooler English | 中文 Mi / Aqara AC partner plugin for Homebridge Feature Control Mode heat cool auto Temperature 17 - 30 Celsius Fan speed 1 : low 2 : medium 3 : high 4 : auto Oscil