A Prometheus exporter for ENS160 air quality and EZO-HUM humidity/temperature sensors over I2C, with fault detection and automatic recovery.
- Python 67.5%
- Shell 32.5%
Replaces start_http_server with a custom HTTPServer subclass using AF_INET6 bound to ::, which on Linux accepts both IPv4 and IPv6 connections without extra configuration. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> |
||
|---|---|---|
| .gitignore | ||
| install.sh | ||
| README.md | ||
| requirements.txt | ||
| sensor-exporter.py | ||
sensor-exporter
Prometheus exporter for the ENS160 (AQI, TVOC, eCO2) and EZO-HUM (humidity, temperature) sensors over I2C, targeting Armbian SBCs.
Metrics are exposed on :8000/metrics.
Quick-start
No git required. The installer downloads everything it needs automatically.
curl
sudo bash <(curl -fsSL https://git.aetherlab.org/deuxyeux/sensor-exporter/raw/branch/main/install.sh)
wget
wget -q https://git.aetherlab.org/deuxyeux/sensor-exporter/raw/branch/main/install.sh
wget -q https://git.aetherlab.org/deuxyeux/sensor-exporter/raw/branch/main/sensor-exporter.py
sudo bash install.sh
The installer will:
- Check and install missing Python dependencies (
python3-smbus2,python3-prometheus-client) viaapt - Add the
i2c0overlay to/boot/armbianEnv.txtif not already present (reboot required after first install) - Download and deploy the exporter to
/opt/sensor-exporter/ - Install, enable, and start the
sensor-exportersystemd service
Usage
# Check service status
systemctl status sensor-exporter
# Follow logs
journalctl -u sensor-exporter -f
# View metrics
curl http://localhost:8000/metrics
Metrics
| Metric | Description |
|---|---|
ezo_humidity_percent |
Relative humidity (%) |
ezo_temperature_celsius |
Temperature (°C) |
ens160_aqi |
Air Quality Index (1–5) |
ens160_tvoc_ppb |
TVOC (ppb) |
ens160_eco2_ppm |
eCO2 (ppm) |
ens160_tvoc_ug_m3 |
TVOC (µg/m³, estimated) |
ens160_sensor_faulted |
1 when ENS160 is faulted |
ezo_sensor_ok |
1 when last EZO-HUM read succeeded |