miflora-prom - generate prometheus metrics from Xiaomi Mi flower care plant sensor
miflora-prom
miflora-prom is a small application that connects to a Xiami Mi flower plant sensor over blue tooth
and converts the sensor data into prometheus metrics. If needs a config file in /etc/miflora
to
operate.
The data retrieved and the prometheus metrics are:
- battery level,
miflora_meta_battery_percentage{name="<alias>"}
- firmware version,
miflora_meta_firmware_version{name="<alias>", version="<version>"}
- illumination level in Lux,
miflora_plant_illumination_lux{name="<alias>"}
- moisture percentage,
miflora_plant_moisture_percentage{name="<alias>"}
- ground conductivity,
miflora_plant_conductivity{name="<alias>"}
When running as a non-root user the following capabilities are needed:
'CAP_NET_RAW' and 'CAP_NET_ADMIN' for miflora-prom
to accessing bluetooth and sending packets.
Under Linux, the application uses the mac address to connect to devices; under MacOs the UUID.
The configuration file contains lines constisting of a LHS <colon> RHS
. It defines the MAC
addreses or UUIDs of the sensors to be queried and two other variables:
# adapter, defaults to 'default'
adapter: default
# how often to query the sensors
duration: 1h
# the sensor's aliases and their uuid or mac address
myfirstsensor: 422b23155c369dfee0aea210d1a9bc37
mysecondsensor: ...
- Xiaomi for creating the sensor.
- Creators of go-ble.
- Creators of miflora wiki.