跳转至

homebridge-mi-aqara

npm version

本部分将教您如何接入小米网关到HomeBridge

注意:我只有这些设备的一部分,所以一些设备没有测试过。如果您发现bug,请提交给issues 或者QQ Group: 107927710.

注意:根据aqara本地网络协议使用UDP端口9898,请注意防火墙的相关配置。

注意:0.5。x更新到0.6。x必须清除配件信息和更新配置文件内容。

注意:关于AcPartner,这个项目只提供网关功能。如果您想使用空调功能,请参阅HORBANTIC MI合作伙伴项目。homebridge-mi-acPartner.

这个库包含了homebridge的Aqara插件。 Aqara是一个ZigBee网关与一些传感器。

支持设备

设备名称 Protocol Model Value
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
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

安装必要的库和软件

  1. 确保你的IOS版本是ios11或更高版本。
  2. 确保你有网关第二代或空调伴侣第三代。网关一代空间有限,无法支持这个功能。
  3. 将网关固件升级到**1.4.1_155.0143(网关第二代), **1.4.1_148.019(空调伴侣第三代) 或者更高版本

安装

  1. 安装HomeBridge,请按照 README进行安装。 如果你用的是树莓派,请阅读Running-HomeBridge-on-a-Raspberry-Pi.
  2. 确保你能在你的iOS设备上看到HomeBridge,如果没有,请回到步骤1。
  3. 通过NPM命令下载并安装这个插件homebridge-mi-aqara(PS:如果是树莓派pi用户,在命令前加sudo):
    npm install -g homebridge-mi-aqara
    
  4. 树莓派pi用户安装:
    sudo npm install -g homebridge-mi-aqara
    

Configuration

Name Required Value Type Description Value Example
1 platform True String It must be 'MiAqaraPlatform'
2 gateways True Object set gateway information. { "6409802da3b3": "02i44k56zrgg578b" }
3 bindAddress False String specified network. "10.0.0.1"
4 defaultValue False Object set device default value.
5 manage False Object open manage and manage configs. { "port": 11128, "password": "107927710" }

有关配置的更多信息,请参阅文件 sampleConfig.json.

网关配置

打开aqara网关的网络设置, 启用 局域网协议. 请遵循以下步骤: 1. 下载米家App,打开并登陆你的小米账号。 2. 找到多功能网关图标,点击图标,进入多功能网关操作界面,点击右上角的···图标。 3. 点击进入关于。 4. 疯狂点击底部的 插件版本,紧接着会出现局域网通信协议和网关信息。 5. 点击网关信息,找到图示位置,抄写下来,这是网关的mac地址。 6. 点击 加密,进入局域网通信协议,在局域网通信协议后面勾选,此时会出现一组密码,记下密码。

警告:网关的MAC地址 (小写不带冒号) 密码 (是啥样就啥样不要去修改和区分大小写)。
警告:网关的MAC地址 (小写不带冒号) 密码 (是啥样就啥样不要去修改和区分大小写)。
警告:网关的MAC地址 (小写不带冒号) 密码 (是啥样就啥样不要去修改和区分大小写)。
重要的事情说3遍。

{
    "platforms": [{
        "platform": "MiAqaraPlatform",
        "gateways": {
            "6409802da3b3": "02i44k56zrgg578b"
        }
    }]
}
如果你有多个网关,请按正确的顺序填写它们,如下所示。
{
    "platforms": [{
        "platform": "MiAqaraPlatform",
        "gateways": {
            "6409802da3b3": "02i44k56zrgg578b",
            "f0b4299a5b2b": "2F92E7DA90C66B86",
            "f0b4299a77dd": "syu3oasva3uqd5qd"
        }
    }]
}
还有有一种方法来搜索网关,因为有些朋友在他们的网络环境中不响应网关的信息。 也就是说,我们可以通过配置网关的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"
            }
        }
    }]
}

这也可以是混合配置,多个网关中有部分没被发现的,可以单独指定组网。

{
    "platforms": [{
        "platform": "MiAqaraPlatform",
        "gateways": {
            "6409802da3b3": "02i44k56zrgg578b",
            "f0b4299a5b2b": {
                "password": "2F92E7DA90C66B86",
                "ip": "10.3.3.2"
            },
            "f0b4299a77dd": {
                "password": "syu3oasva3uqd5qd",
                "ip": "10.3.3.3"
            }
        }
    }]
}

bindAddress configuration

If your device(which running homebridge) has multiple network, please add the bindAddress configuration item to decide to listen which network, like below.

{
    "platforms": [{
        "platform": "MiAqaraPlatform",
        "bindAddress": "10.0.0.1",
        "gateways": {
            "6409802da3b3": "02i44k56zrgg578b",
            "f0b4299a5b2b": "2F92E7DA90C66B86",
            "f0b4299a77dd": "syu3oasva3uqd5qd"
        }
    }]
}

defaultValue configuration

如果您想指定默认值,比如指定附件的名称,隐藏附件,任何其他配置。您可以向config.json添加一个defaultValue映射表。配置支持如下:

Name Value Type Description Default Value Recommended Value Value Example
1 name String set accessory name. DeviceAccessoryType_device SID last four bits "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
4 syncValue Boolean accessory will synchronization value when homebridge call the get function, if it's true. false fasle false
5 ignoreWriteResult Boolean if set to true, the result of control is not detected. true If your network is awful, it's recommended to be set true. false
6 disableNoResponse Boolean use jump back the last value to replace show NoResponse, you can set it true. false false true

规则如下:

{
    "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"
                }
            }
        }
    }]
}
示例:
{
    "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"
                }
            }
        }
    }]
}

设备辅助类型的规则:

DeviceName_HomeBridgeAccessoryType(_ExtraMessage)
详情:

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

关于全局:
一些相似的配置和重复的副本是令人厌烦的事情。所以我提供了一个全局的方法。 以下两种写法是等同的:

....
"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"
    }
}
....
同样地,以下两种写法也是一样的效果:
....
"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"
    }
}
....
它还提供了一种更高层次的写法,以下三种写法也是相同的:
{
    "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"
                }
            }
        }
    }]
}

defaultValue name configuration

如果要指定设备的默认名称,请将映射表添加到你的config.json中。

{
    "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"
                }
            }
        }
    }]
}

defaultValue serviceType configuration

如果你喜欢用Light Bulb类型的Light Switch来让Siri奶奶开心,比如snOOrz,你可以在配置中设置如下设置。目前只支持: SingleSwitch, DuplexSwitch, SingleSwitchLN, DuplexSwitchLN. 如果您更改了serviceType配置,请清除。 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"
                }
            }
        }
    }]
}

defaultValue disable configuration

如果想禁用附件,可以向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
                }
            }
        }
    }]
}

defaultValue syncValue configuration

如果想要附加的值精确,可以设置syncValue为true。当syncValue为true时,配件将在homebridge调用get函数时同步值。同时,它会浪费更多的时间。当syncValue为false时,配件将使用设备上一次报告的值。它会迅速做出反应。

{
    "platforms": [{
        "platform": "MiAqaraPlatform",
        "gateways": {
            "6409802da3b3": "02i44k56zrgg578b",
            "f0b4299a5b2b": "2F92E7DA90C66B86",
            "f0b4299a77dd": "syu3oasva3uqd5qd"
        },
        "defaultValue": {
            "158d0001000007": {
                "SingleSwitch_Switch": {
                    "name": "living room light",
                    "serviceType": "Lightbulb",
                    "syncValue": true
                }
            }
        }
    }]
}

defaultValue ignoreWriteResult configuration

如果你控制设备总是超时,但事实上它已经工作了。可以设置IGONReWrreReSurt为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
                }
            }
        }
    }]
}

defaultValue disableNoResponse configuration

如果你不喜欢“没有回应”,你可以设置disableNoResponse为true。当设备没有pesponse且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
                }
            }
        }
    }]
}

defaultValue other configuration

如果你想使用Aqara锁,你需要添加一些配置如下:

{
    "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} 是来自lock的用户标识。
这个值可以从MIHOMEAPP中的Aqara Lock Plugin中获得。用户ID包含ID类型。
用户ID除以65536得到的整数值是ID类型。ID类型值为:
1 fingerprint
2 password
3 proximity card
5 check-in password
示例:
{
    "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"
                }
            }
        }
    }]
}

manage configuration

在0.7.x版本之前。配件的添加和删除都是自动的。规则如下:
每小时更换一次配件,删除7天没有心跳的配件。
显然,这并不容易使用。所以0.7.0版增加了 http web manage(如果不设置manage,则http web manage关闭。)在config中添加以下示例:

{
    "platforms": [{
        "platform": "MiAqaraPlatform",
        "bindAddress": "10.0.0.1",
        "manage": {
            "port": 11128,
            "password": "107927710"
        },
        "gateways": {
            "6409802da3b3": "02i44k56zrgg578b",
            "f0b4299a5b2b": "2F92E7DA90C66B86",
            "f0b4299a77dd": "syu3oasva3uqd5qd"
        }
    }]
}
配置项说明:

Name Required Value Type Description Recommended Value Value Example
1 port True Integer set manage web port. 11128 11128
2 password True String set manage web password. "107927710" "107927710"

Some explanation

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.

Run it

homebridge -D

Clear register accessories

cd ~/.homebridge/accessories/ mv cachedAccessories cachedAccessories_`date '+%Y%m%d_%H%M%S'`.bak echo [] > cachedAccessories

Version Logs

0.7.3 (2018-10-27)

  1. add support for VibrationSensor.

0.7.2 (2018-10-09)

  1. fixed bug that move 'sensor_switch' type form Button2 to Button.
  2. add support for Button3(sensor_switch.aq3).
  3. add support for DuplexButton862(remote.b286acn01).

0.7.1 (2018-09-14)

  1. fixed bug that delete orphan accessory list item fail in http web manage.

0.7.0 (2018-09-13)

  1. fixed bug that DuplexSwitchLN right switch not work.
  2. fixed bug that sometimes Gateway, AcPartner and MotionSensor2 light senor no response.
  3. fixed bug that MagicSquare Rotate StatelessProgrammableSwitch not work.
  4. fixed bug that crash when auto remove accessory.
  5. add http web manage.

0.6.9 (2018-06-23)

  1. fixed bug that config 'defaultValue' can not support: Button2, MotionSensor2, ContactSensor2, PlugBase86.
  2. fixed bug that MotionSensor not work in aqara local network protocol 2.x version.
  3. support config gateway ip feature.

0.6.9_beta (2018-03-26)

  1. optimized some of the basic code to facilitate the subsequent support of new hardware.
  2. supports aqara local network protocol 2.x version.
  3. add support for lock device.
  4. add support for acpartner accessory.

0.6.8 (2018-01-21)

  1. fixed bug that sometimes DuplexSwitchLN and DuplexSwitch no response.
  2. fixed bug that it still show battery low power after replacing the battery.
  3. fixed bug that TemperatureAndHumiditySensor and TemperatureAndHumiditySensor2 temperature sensor accessory can't show the negative number.
  4. remove a duplicated function.
  5. add the choice bindAddress feature.

0.6.7 (2017-12-10)

  1. optimizing log content.

0.6.6 (2017-12-10)

  1. fixed bug that sometimes DuplexSwitchLN and DuplexSwitch no response.
  2. fixed bug that sometimes Gateway and MotionSensor2 light senor no response.
  3. fixed bug that global config not work in some cases.
  4. add setting "ignoreWriteResult" feature.
  5. remove the SingleButton86, DuplexButton86, MagicSquare redundant event action.

0.6.5 (2017-10-31)

  1. optimizing log content.
  2. optimizing read/write device response timeout rules.
  3. optimizing read/write device no response rules.
  4. add gateway join permission switch accessory.
  5. add setting disable "No Response" feature.

0.6.4 (2017-10-27)

  1. add virtual switch accessory can trigger homekit click events.
  2. optimizing log content.
  3. optimizing HomeBridge startup read device info algorithm.

0.6.3 (2017-10-26)

  1. fixed bug that ElectricCurtain can't work.
  2. remove synchronization value when homebridge call the get function(only electrify device) and add setting synchronization value feature.
  3. add config Global mode.

0.6.2 (2017-10-25)

  1. fixed bug that MotionSensor motion sonser accessory status is error.
  2. fixed bug that MotionSensor2 motion sonser accessory status is error.

0.6.1 (2017-10-23)

  1. fixed bug that MotionSensor2 light sonser accessory value is error.

0.6.0 (2017-10-22)

  1. refactoring code.
  2. add feedback when control accessory.
  3. synchronization value when homebridge call the get function. (only electrify device)
  4. optimizing program structure, send fewer packets.
  5. optimizing config item name, easier to read.
  6. fixed some bug.
  7. add Button(single press, double press) virtual switch accessory.
  8. add Button2(single press, double press) virtual switch accessory.
  9. add SingleButton86(single press) virtual switch accessory.
  10. add DuplexButton86(left button single press, right button single press, both press) virtual switch accessory.
  11. add MagicSquare(flip90, flip180, move, tapTwice, shakeAir) virtual switch accessory.

0.5.3 (2017-08-26)

  1. optimized code.

0.5.2 (2017-08-23)

  1. fixed bug that gateway light brightness is 100 when it light up.

0.5.1 (2017-08-14)

  1. fixed bug that natgas detector is not alarm.

0.5.0 (2017-08-13)

  1. add support for water detector accessory.
  2. fixed bug that natgas detector is not alarm.
  3. fixed bug that smoke detector is not alarm.

0.4.4 (2017-08-09)

  1. add log content that show plugin version when homebridge started.
  2. fixed bug that run homebridge error there is no MiAqaraPlatform in config.json file.

0.4.3 (2017-08-01)

  1. fixed bug that gateway light sensor not support when value is 0;
  2. fixed bug that motion sensor version 2 light sensor not support when value is 0;

0.4.2 (2017-07-29)

  1. adjustment gateway light sensor value(subtract 279).
  2. delete PlugBase, PlugBase86, SingleSwitch, DuplexSwitch, SingleSwitchLN, DuplexSwitchLN battery information.
  3. add motion sensor version 2 light sensor battery information.
  4. add setting accessory disable feature.
  5. fixed bug that electric curtain can't work, but there is no current operation state information now.

0.4.1 (2017-07-26)

  1. code collation.

0.4.0 (2017-07-26)

  1. add support for electric curtain accessory.
  2. add support for contact sensor version 2 accessory.
  3. add support for motion sensor version 2 accessory.
  4. add support for button version 2 accessory.
  5. add support for temperature and humidity sensor version 2 accessory.
  6. optimize log content.
  7. add setting default name feature.
  8. add setting default service type feature.
  9. fixed motion sensor bug that wrong trigger when homebridge start. 10.adjustment gateway light sensor value(subtract 300).

0.3.3 (2017-06-16)

  1. add single button 86 long press event.
  2. add duplex button 86 long press event.
  3. changed button click event value from Characteristic.ProgrammableSwitchEvent.CLICK back to Characteristic.ProgrammableSwitchEvent.SINGLE_PRESS.
  4. changed single button 86 click event value from Characteristic.ProgrammableSwitchEvent.CLICK back to Characteristic.ProgrammableSwitchEvent.SINGLE_PRESS.
  5. changed duplex button 86 click event value from Characteristic.ProgrammableSwitchEvent.CLICK back to Characteristic.ProgrammableSwitchEvent.SINGLE_PRESS.

0.3.2 (2017-06-15)

  1. fixed bug that duplex switch LN charging state.
  2. fixed bug that single switch LN charging state.
  3. fixed bug that single button 86 charging state.
  4. changed button click event value from Characteristic.ProgrammableSwitchEvent.SINGLE_PRESS to Characteristic.ProgrammableSwitchEvent.CLICK.
  5. changed single button 86 click event value from Characteristic.ProgrammableSwitchEvent.SINGLE_PRESS to Characteristic.ProgrammableSwitchEvent.CLICK.
  6. changed duplex button 86 click event value from Characteristic.ProgrammableSwitchEvent.SINGLE_PRESS to Characteristic.ProgrammableSwitchEvent.CLICK.
  7. fixed bug that natgas detector is not alarm.
  8. fixed bug that smoke detector is not alarm.

0.3.1 (2017-06-14)

  1. code collation.

0.3.0 (2017-06-14)

  1. add support for single switch LN accessory.
  2. add support for duplex switch LN accessory.
  3. add support for plug base 86 accessory.
  4. add support for smoke detector accessory.
  5. add support for natgas detector accessory.

0.2.1 (2017-06-14)

  1. change accessory registration mechanism, fixed bug that new accessory can't correlate associated with gateway.

0.2.0 (2017-06-14)

  1. add support for duplex switch accessory.
  2. add support for single button 86 accessory.
  3. add support for duplex button 86 accessory.

0.1.0 (2017-06-13)

  1. add support for plug base accessory.
  2. add support for magic square accessory.

0.0.6 (2017-06-12)

  1. add some logs.

0.0.5 (2017-06-08)

  1. fixed bug.

0.0.4 (2017-06-08)

  1. fixed bug.

0.0.3 (2017-06-08)

  1. add support for gateway accessory: light sensor, hue light.

0.0.2 (2017-06-07)

  1. add support for single switch accessory.

0.0.1 (2017-06-07)

  1. supported contact sensor accessory.
  2. supported motion sensor accessory.
  3. supported button accessory.
  4. supported temperature and humidity sensor accessory.