8000 GitHub - am3o/co2_exporter: An metrics exporter for the CO₂ sensor AirCo2ntrol Coach
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

am3o/co2_exporter

Repository files navigation

airco2ntrol CO₂ Exporter

Go Report Card Docker Image Release License: MIT

A Prometheus exporter for collecting CO₂, temperature, and humidity metrics from the
AIRCO2NTROL COACH USB monitor.

This exporter communicates with the device via the Linux HIDRAW interface (e.g., /dev/hidraw0).


📈 Exported Metrics

Metric Name Type Labels Unit
tfa_airco2ntrol_carbon_dioxide_total Gauge unit ppm
tfa_airco2ntrol_temperature_total Gauge unit °C
tfa_airco2ntrol_humidity_total Gauge unit percent

🚀 Installation & Usage

From Source

go install github.com/am3o/co2_exporter@latest

# Run with root privileges due to HIDRAW access requirement
sudo CO2MOINITOR_DEVICE=/dev/hidraw0 $GOPATH/bin/co2_exporter

Note

Accessing HIDRAW devices typically requires root permissions.

Using Docker

docker run -d \
    --name co2-exporter \
    -v /dev/hidraw0:/dev/hidraw0:ro \
    --privileged \
    -p 8080:8080 \
    ghcr.io/am3o/co2_exporter:latest

📡 Prometheus Configuration

To scrape metrics from co2_exporter, add the following to your Prometheus configuration (prometheus.yml):

scrape_configs:
  - job_name: 'co2_exporter'
    static_configs:
      - targets: ['localhost:8080']

Adjust the target if you're running the exporter on a different host or port.

🛠️ systemd Service Template

Save this file as /etc/systemd/system/co2_exporter.service:

[Unit]
Description=CO₂ Exporter
After=network.target

[Service]
ExecStart=/usr/local/bin/co2_exporter
Environment=CO2MOINITOR_DEVICE=/dev/hidraw0
Restart=on-failure
User=root

[Install]
WantedBy=multi-user.target

Enable and start the service:

sudo systemctl daemon-reexec
sudo systemctl enable --now co2_exporter.service

🤝 Contributing

Contributions are welcome! Feel free to fork the repository and submit a pull request.

About

An metrics exporter for the CO₂ sensor AirCo2ntrol Coach

Topics

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors 2

  •  
  •  
0