Hobbyist firmware for the AirGradient Open Air (Model O-1PST).
This is NOT the official firmware; see airgradient.com for that.
⚠️ DISCLAIMER: This firmware is provided as-is with no support. Use at your own risk. The author makes no guarantees about reliability, safety, or fitness for any purpose.
This project was written with significant assistance from LLMs. It likely has some bugs.
This has a minimal feature set:
- OpenMetrics-compatible endpoint at
http://<device-ip>/metrics. - Hardware watchdog integration.
The watchdog is configured to check:
- WiFi connection, including DHCP assignment
- Sensor data freshness
- Metrics scrape recency
If any of those checks fail for long enough, the device will reset. See src/config.rs for what those timeouts are.
| Metric | Description | Labels |
|---|---|---|
airgradient_info |
Device information | version, commit, build_type, airgradient_serial_number, mac_address, reset_reason |
| Metric | Unit | Description |
|---|---|---|
esp32_uptime_seconds |
seconds | System uptime since boot |
esp32_heap_used_bytes |
bytes | Currently used heap memory |
esp32_heap_total_bytes |
bytes | Total available heap memory |
| Metric | Unit | Description |
|---|---|---|
airgradient_pm0d3_p100ml |
particles/100ml | PM0.3 particle count |
airgradient_pm0d5_p100ml |
particles/100ml | PM0.5 particle count |
airgradient_pm1_p100ml |
particles/100ml | PM1.0 particle count |
airgradient_pm2d5_p100ml |
particles/100ml | PM2.5 particle count |
airgradient_pm1_ugm3 |
µg/m³ | PM1.0 concentration |
airgradient_pm2d5_ugm3 |
µg/m³ | PM2.5 concentration |
airgradient_pm10_ugm3 |
µg/m³ | PM10 concentration |
airgradient_co2_ppm |
ppm | CO2 concentration |
airgradient_tvoc_index |
index (1-500) | TVOC index |
airgradient_nox_index |
index (1-500) | NOx index |
airgradient_temperature_celsius |
°C | Temperature |
airgradient_humidity_percent |
% | Relative humidity |
| Metric | Labels | Description |
|---|---|---|
airgradient_sensor_error |
sensor, error |
Per-sensor error status (0 = OK, 1 = error) |
Follow the Espressif Rust Book to set up the Rust toolchain for ESP32 development.
This uses a nightly toolchain.
env DEFMT_LOG=info WIFI_SSID="SomeNetwork" WIFI_PASSWORD="SomePassword" cargo run --releaseThis uses defmt for logging. See the filtering doc section for available options.
Most configuration is in src/config.rs.
Rust on ESP Book. impl Rust for ESP32. Great resource with examples on how to get started with Embassy async. I borrowed most of the wifi/web parts.