1
0
Fork 0
Firmware for a Wemos d1 Mini to export metrics from a connected environmental sensor via a Prometheus compatible interface.
Find a file
2025-03-09 22:33:14 +01:00
firmware Initial commit 2025-03-09 22:33:14 +01:00
README.md Initial commit 2025-03-09 22:33:14 +01:00

ESP-Exporter 📈

Simple firmware to Export the Measurings of a DF Robot Environmental Sensor with a Wemos D1 Mini in the form of a Prometheus-compatible /metrics-endpoint.

Usage

You can obtain the current metrics from <ip>:9100/metrics:

you@some ~> curl http://esp:9100/metrics

# HELP temperature_celsius Temperature in Celsius
# TYPE temperature_celsius gauge
temperature_celsius 29.87
# HELP pressure_pa Atmospheric pressure in Pascals
# TYPE pressure_pa gauge
pressure_pa 94785
# HELP altitude_meters Altitude above sea level in meters
# TYPE altitude_meters gauge
altitude_meters 581.15
# HELP humidity_percent Relative humidity in percentage
# TYPE humidity_percent gauge
humidity_percent 25.55
# HELP co2_ppm Carbon dioxide concentration in ppm
# TYPE co2_ppm gauge
co2_ppm 426
# HELP tvoc_ppb Total Volatile Organic Compounds concentration in ppb
# TYPE tvoc_ppb gauge
tvoc_ppb 3

To use it in Prometheus, add the following scrape config:

scrape_configs:
  - [...]
+ - job_name: esp-exporter
+   static_configs:
+     - targets:
+       - "<your-ip>:9100"

Setup

  1. Install Arduino IDE
  2. Install the Board-Package for the Wemos D1 mini / ESP8266 1
  3. Install the DFRobot_BME280 and the DFRobot_CCS811 Libraries
  4. Change the WIFI-Credentials in the Firmware
  5. Flash the device2

  1. You might have to add https://arduino.esp8266.com/stable/package_esp8266com_index.json as _additional boards URL _ in the Settings of the Arduino IDE ↩︎

  2. If you can not flash the device, you might have to temporarily change the permissions on the USB device by running sudo chmod 777 /dev/ttyUSB0. ↩︎