在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
开源软件名称:hannseman/homebridge-mi-hygrothermograph开源软件地址:https://github.com/hannseman/homebridge-mi-hygrothermograph开源编程语言:JavaScript 100.0%开源软件介绍:homebridge-mi-hygrothermographHomebridge plugin for exposing measured temperature, humidity and plant metrics from Xiaomi sensors as HomeKit accessories. Supported sensors:
InstallationMake sure your system matches the prerequisites. You need to have a C compiler and Node.js newer or equal to version 12.0.0 installed. Noble is BLE central module library for Node.js used to discover and read values from the sensor. These libraries and their dependencies are required by the Noble library and provide access to the kernel Bluetooth subsystem: sudo apt-get install bluetooth bluez libbluetooth-dev libudev-dev For more detailed information and descriptions for other platforms please see the Noble documentation. Install homebridge and this plugin
Note: depending on your platform you might need to run See the Homebridge documentation for more information. If you are running Homebridge as another user than You'll need to grant the node binary cap_net_raw privileges:
Please see the Noble documentation for more details. Homebridge configurationUpdate your Homebridge "accessories": [
{
"accessory": "Hygrotermograph",
"name": "Temperature & Humidity"
}
]
Multiple sensorsWhen running just one Hygrotermograph accessory there is no need to specify the address of the BLE device. But if you want to run multiple Hygrotermograph accessories you need to specify the BLE address for each of them. If the address is not specified they will interfere with each other. The easiest way to find the address of the device is to use Update your Homebridge "accessories": [
{
"accessory": "Hygrotermograph",
"name": "Room 1",
"address": "4c:64:a8:d0:ae:65"
},
{
"accessory": "Hygrotermograph",
"name": "Room 2",
"address": "2c:34:b3:d4:a1:61"
},
{
"accessory": "Hygrotermograph",
"type": "MiFlora",
"name": "Garden",
"address": "2f:34:b5:d4:a2:20"
}
] Note that this step is also required when running Mi Flora devices in the same location as they use the same protocol and their data will be intercepted by this plugin. MacOSOn MacOS You also need to make sure that TimeoutIf the accessory has not received an updated value from the sensor within the specified timeout it will inform Homekit that the accessory is not responsive by returning an error until it receives an updated value. The default timeout is 15 minutes but can be changed by specifying the number of minutes under the "accessories": [
{
"accessory": "Hygrotermograph",
"name": "Temperature & Humidity",
"timeout": 30
}
] If the NamingBy default the Humidity and Temperature accessories visible in the Home-app will have the names "Humidity" and "Temperature". They can be changed in the Home-app if wanted. It is also possible to set custom initial values by specifying the {
"humidityName": "Luftfuktighet",
"temperatureName": "Temperatur"
} Elgato EveThis plugin has support for adding historical data to the Elgato Eve App by using the excellent module fakegato-history. When using this feature it's required to specify the address of the device as described in Multiple sensors. This is required because fakegato-history requires a unique serial number for each device. When restarting Homebridge the Eve app will show the Accessories as having 0% battery until the sensor actually reports its battery status. This can sometimes take a couple of minutes. Just be patient and the actual battery status will show up. The E-Ink sensors do not report the current battery level. This will cause Elgato Eve to incorrectly warn about low battery. Set To enable the Elgato Eve feature set {
"fakeGatoEnabled": true
} fakegato-history caches historical values into a json-file.
Usually located in {
"fakeGatoStoragePath": "/tmp/"
} MQTTThe plugin can be configured to publish temperature/humidity/battery values to an MQTT-broker. Basic configuration: {
"mqtt": {
"url": "mqtt://test.mosquitto.org",
"temperatureTopic": "sensors/temperature",
"humidityTopic": "sensors/humidity",
"batteryTopic": "sensors/battery"
}
} Basic configuration for Mi Flora: {
"mqtt": {
"url": "mqtt://test.mosquitto.org",
"temperatureTopic": "sensors/temperature",
"moistureTopic": "sensors/moisture",
"fertilityTopic": "sensors/fertility",
"illuminanceTopic": "sensors/illuminance",
"batteryTopic": "sensors/battery"
}
} If one is interested in only publishing a specific value just skip configuring the topics wished to ignore: {
"mqtt": {
"url": "mqtt://test.mosquitto.org",
"temperatureTopic": "sensors/temperature"
}
} To enable authentication specify the {
"mqtt": {
"url": "mqtt://test.mosquitto.org",
"username": "admin",
"password": "hunter2",
"temperatureTopic": "sensors/temperature"
}
} For more options see the MQTT.js documentation.
Everything set in EncryptionSome Xiaomi sensors have encrypted data. For example LYWSD03MMC.
To be able to read the data from this sensor one needs to get a hold of the encryption key.
For ways to get this key please read this FAQ entry
from the custom-components/sensor.mitemp_bt repository. When found it can be set with the Thanks ulrich-berl for implementing support for this. Encryption can also be turned off by installing the ATC_MiThermometer custom firmware. If you find yourself having issues with getting
the device working with the Technical detailsThe plugin scans for Bluetooth Low Energy peripherals and check the broadcast advertisement packets.
By only reading the advertisement packet there is no need to establish a connection to the peripheral.
Inside each packet discovered we look for Service Data with a UUID of By using a Bluetooth LE Sniffer it is possible to see that the peripheral advertises 3 different sized Service Data:
Some bytes stay the same and some bytes change over time. By placing the peripheral in different temperated places it could be established that the last bytes contain the sensor data. These were the observations:
So we actually have 4 different packets that contains the sensor data:
After some investigation and thanks to node-xiaomi-gap-parser it is probable that the data of
Bytes 1-14 have the same function for all 4 variations but the following bytes contain different sensor data. Automation (iOS 13+)There is a new very handy automation option in iOS 13 allowing us to convert home automation rule to "Advanced shortcut". Using that you can make rules like "If temperature drops below 21C and someone is at home and it is not during night then turn on heater". Unfortunately you can't normally bind this rule to any timer trigger. However you can use other homebridge plugin which fakes sensor events e.g. every 5 seconds and you can bind that rule to it! Check https://github.com/nitaybz/homebridge-delay-switch Known problemsSome hardware combinations are problematic and may cause weird troubles like sensor timeout after some time etc.
Mi Flora Fertility level noticeSoil Fertility measures in LegalXiaomi and Mi are registered trademarks of BEIJING XIAOMI TECHNOLOGY CO., LTD. This project is in no way affiliated with, authorized, maintained, sponsored or endorsed by Xiaomi or any of its affiliates or subsidiaries. |
2023-10-27
2022-08-15
2022-08-17
2022-09-23
2022-08-13
请发表评论