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%
Find a file
Nickie Deuxyeux 49f65a0e54 Make HTTP server IPv6 dual-stack (AF_INET6 on ::)
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>
2026-06-18 14:00:01 +03:00
.gitignore Initial commit: ENS160 + EZO-HUM Prometheus exporter 2026-05-14 12:37:45 +03:00
install.sh Download sensor-exporter.py automatically if not found locally 2026-05-28 16:16:50 +03:00
README.md README: show explicit wget download for both files in quick-start 2026-05-28 16:17:41 +03:00
requirements.txt Add requirements.txt 2026-05-14 12:38:27 +03:00
sensor-exporter.py Make HTTP server IPv6 dual-stack (AF_INET6 on ::) 2026-06-18 14:00:01 +03:00

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:

  1. Check and install missing Python dependencies (python3-smbus2, python3-prometheus-client) via apt
  2. Add the i2c0 overlay to /boot/armbianEnv.txt if not already present (reboot required after first install)
  3. Download and deploy the exporter to /opt/sensor-exporter/
  4. Install, enable, and start the sensor-exporter systemd 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 (15)
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