sensor-probe
Sensor Probe is a small utility that reads advertisement data sent by the Xiaomi Thermometer LYWSD03MMC via Bluetooth LE and expose them as Prometheus metrics.
This program currently only supports sensors flashed with the ATC_MiThermometer custom firmware and the "custom" data format; if you're using the other custom firmware you can probably just use Bluewalker to get your sensor data.
All the heavy lifting is done by Bluewalker since I couldn't find an easy way to read BLE events from Go and the BlueZ stack on Linux.
You should be able to find those Xiaomi sensors on AliExpress.
Configuration format
The configuration file is a simple TOML file:
[[sensors]]
name = "bedroom"
mac = "a4:c1:38:01:01:01"
firmware = "custom"
[[sensors]]
name = "studio"
mac = "a4:c1:38:02:02:02"
firmware = "custom"
Usage
First you need to bring down your Bluetooth device by running hciconfig
:
sudo hciconfig hci0 down
Then you can start sensor-probe
.
Credits
- The Humidity Control with Home Assistant blog post on Splitbrain.org that made me discover those Xiaomi sensors.
- atc1441 for writing the custom firmware for the Xiaomi sensors.
- Jukka Taimisto for writing Bluewalker.