Repository navigation
Prometheus and Grafana
Languages: English | 繁體中文
Run your own self-hosted Prometheus + Grafana stack on any machine with Docker (Linux server, Raspberry Pi, mini PC, Synology NAS, macOS, or Windows) to record 5 years of multi-room air-quality history, view pre-built dashboards, log power cuts on Battery edition monitors, and receive custom alerts — or scrape /metrics directly from your own Prometheus server.
- What Is Included
- Step 1: Download & Extract the Stack
- Step 2: Initialize & Start with Docker
- Step 3: Verify Prometheus Targets
- Step 4: Open Grafana
- Naming Rooms & Manual IPs
- Alerts & Everyday Commands
- Direct Scraping &
/metricsReference
- Air quality dashboard (Grafana home page): live CO₂, air-quality level, temperature, humidity, and VOC index across all rooms, 24 h / 7 d trends, time with good air, daily average CO₂, dew point, and absolute humidity.
- Monitors & Power dashboard: per-monitor online status, firmware & board revision, USB/battery source timeline, power-cut log, battery charge & voltage, Wi-Fi signal, free memory, uptime, restarts, and sensor errors.
-
Automatic mDNS discovery: on Linux / Raspberry Pi / NAS hosts, new Stuffy Meters on the same LAN are discovered automatically (
_stuffymeter._tcp). - 6 pre-provisioned Grafana alert rules: monitor offline, bad CO₂ for 10 minutes, sensor error, repeated restarts, running on battery, and low battery.

Download stuffy_meter_monitoring_v2.0.1.tar.gz from the Latest Release (it contains docker-compose.yml, .env.example, prometheus/prometheus.yml, pre-provisioned Grafana dashboards and alert rules, mDNS discovery, and stack.sh):
tar -xzf stuffy_meter_monitoring_v2.0.1.tar.gz
cd stuffy-meter-monitoringRequires Docker with the Compose plugin (docker compose).
Recommended on Linux / Raspberry Pi / NAS / macOS (stack.sh — automatically generates a random Grafana password and picks free ports):
bash stack.sh init
bash stack.sh upstack.sh init prints the generated Grafana admin password once (run bash stack.sh password anytime to view it again).
Windows PowerShell or plain docker compose (no bash needed):
cp .env.example .env # edit .env and set GRAFANA_ADMIN_PASSWORD
mkdir -p data/prometheus data/grafana
docker compose up -dWithin a minute, open http://<host>:9090/targets (replace <host> with your Docker host's IP or localhost). Every monitor on your LAN should show UP under the stuffymeter scrape pool:

Open http://<host>:3000 in your browser and sign in as admin with the password from Step 2. The Air quality dashboard opens automatically as the home page; switch to Stuffy Meter · Monitors at the top to view device health, power cuts, and battery telemetry:

-
Give discovered monitors room names: edit
targets/rooms.ymlwith one line per monitor (<device_id>: Living Room— find the 6-character ID on the monitor's Device Info screen or hostnamestuffymeter-<id>), then apply without restarting containers:bash stack.sh reload
-
Docker Desktop (macOS / Windows) or static IPs: mDNS multicast does not cross Docker Desktop's VM network, so list your monitors' IP addresses in
targets/static.ymlinstead (Prometheus automatically re-readstargets/every few seconds, or runbash stack.sh reload):- targets: ["192.168.1.42:80"] labels: room: Living Room instance: stuffymeter-a1b2c3
- Alert notifications: all 6 alert rules are pre-loaded in Grafana under Alerting → Alert rules. Add a contact point under Alerting → Contact points (Telegram, email, Slack, Discord, ntfy, etc.) to receive notifications.
-
Common commands (inside
stuffy-meter-monitoring/):-
bash stack.sh status— check container health, ports, and discovered monitors -
bash stack.sh reload— reloadtargets/rooms.yml,targets/static.yml, dashboards, and alert rules with zero downtime -
bash stack.sh password— show the Grafana admin password -
bash stack.sh logs [prometheus|grafana|discovery]— view container logs -
bash stack.sh down— stop containers while keeping all history indata/
-
Every Stuffy Meter exposes Prometheus text-format metrics at http://<host>/metrics (public, no authentication required).
curl -s http://stuffymeter-a1b2c3.local/metricsscrape_configs:
- job_name: stuffymeter
scrape_interval: 15s
scrape_timeout: 5s
static_configs:
- targets:
- 192.168.1.42:80
labels:
room: Living room
- targets:
- 192.168.1.43:80
labels:
room: Bedroom# Current CO2 (ppm) per room
scd41_co2_ppm
# VOC index and temperature
sgp40_voc_index
scd41_temperature_celsius
# Air quality level (1=good, 2=moderate, 3=poor, 4=bad)
stuffymeter_air_quality_level{source="overall"}
# Battery edition (board 4.1): battery level and power cuts over the last 24 h
stuffymeter_battery_percent
increase(stuffymeter_power_losses_total[24h])
increase(stuffymeter_battery_seconds_total[24h])
Names of the previous firmware are kept, so existing Grafana dashboards work unchanged. Sample lines are omitted while a value is invalid.
| Metric | Type | Notes |
|---|---|---|
scd41_co2_ppm |
gauge | legacy |
scd41_temperature_celsius |
gauge | legacy |
scd41_humidity_percent |
gauge | legacy |
sgp40_voc_index |
gauge | legacy, omitted during warm-up |
sgp40_voc_raw |
gauge | legacy |
esp32_uptime_seconds |
counter | legacy |
esp32_free_heap_bytes |
gauge | legacy |
esp32_reset_reason{reason} |
gauge | legacy, value 1 |
esp32_wifi_rssi_dbm |
gauge | legacy, omitted when not on Wi-Fi |
sensor_ok{sensor="scd41"|"voc"} |
gauge | legacy, 0/1 |
sensor_errors_total{sensor} |
counter | legacy |
i2c_bus_recoveries_total |
counter | legacy |
sensor_power_cycles_total |
counter | legacy |
display_ok |
gauge | legacy |
backlight_duty_percent |
gauge | legacy |
stuffymeter_info{id,hostname,version,hw_rev,board,idf} |
gauge | value 1; board is 3.2 or 4.1
|
stuffymeter_dew_point_celsius |
gauge | |
stuffymeter_absolute_humidity_grams_per_cubic_meter |
gauge | |
stuffymeter_air_quality_level{source="overall"|"co2"|"voc"} |
gauge | 0 unknown, 1 good .. 4 bad |
esp32_min_free_heap_bytes |
gauge | |
esp32_largest_free_block_bytes |
gauge | |
stuffymeter_boot_count |
gauge | |
stuffymeter_wifi_disconnects_total |
counter | |
stuffymeter_mqtt_connected |
gauge | |
stuffymeter_ota_pending_verify |
gauge | |
stuffymeter_time_synced |
gauge | |
stuffymeter_voc_warmup_seconds |
gauge | seconds left in the VOC blackout |
stuffymeter_usb_power |
gauge | boards 4.x only: 0/1, USB present |
stuffymeter_on_battery |
gauge | boards 4.x only: 0/1, running from the cell |
stuffymeter_battery_present |
gauge | boards 4.x only: 0/1, cell connected (switch ON) |
stuffymeter_battery_volts |
gauge | boards 4.x only: cell voltage, 0 without a cell |
stuffymeter_battery_percent |
gauge | boards 4.x only: 0..100, 0 without a cell |
stuffymeter_charging |
gauge | boards 4.x only: 0/1, inferred (see power above) |
stuffymeter_battery_seconds_total |
counter | boards 4.x only: seconds on battery since boot |
stuffymeter_power_losses_total |
counter | boards 4.x only: USB -> battery switches since boot |
A board 4.x does not restart when USB goes away, so the two counters keep
counting across a power cut even when the monitoring host and the router are down meanwhile:
increase() over the gap in the scrapes still shows the time on battery and
the number of cuts.
Stuffy Meter firmware v2.1.0 · Releases