This program maintains Ruuvi sensor values and exposes them via HTTP for a Prometheus-like consumer who accepts the text-based exposition format. The program composes nicely with ruuviscan and ruuviparse. You can feed input data to ruuvimetrics directly from Bluetooth Low Energy (BLE) reception (ruuviscan) or with raw BLE Advertisement packets (ruuviparse). The idea is that those programs generate sensor values as JSON to standard output and this program reads sensor values from standard input.
Builds for many platforms can be found here. You may also use the Go toolchain:
$ go install github.com/susji/ruuvimetrics/cmd/ruuvimetrics@latest
ruuvimetrics
has some command-line arguments. To see them, invoke
$ ruuvimetrics -h
For local BLE scans, invoke
$ ruuviscan | ruuvimetrics
and then wait for values to be aggregated and query them with some HTTP client:
$ curl http://localhost:9900/metrics
For parsing and exposing Ruuvi sensor values via MQTT, you probably have to figure out how your transmitters or BLE proxies send the values, but it might look something like this:
$ mosquitto_sub \
-h mqtt.example.com \
-t ruuvi/001 \
--cert ruuvi-listener.cert.pem \
--key ruuvi-listener.private.key \
--cafile ca.crt \
-i ruuvi-listener \
| jq --raw-output --unbuffered \
'.ads[].ad | ascii_downcase | select(.[8:14] == "ff9904") | .[14:]' \
| ruuviparse \
| ruuvimetrics