agoode / airthings-exporter

Prometheus exporter for Airthings devices

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Airthings Exporter

Prometheus exporter for Airthings devices.

Requirements

  • Python 3
  • Airthings device

Setup

  • Register your Airthings device to sync with the cloud following the instructions manual
  • Check the Airthings app or the web dashboard to obtain your device serial number. This is your client id
  • Go to the Airthings Integrations webpage and request an API Client to obtain a client secret
  • Install airthings-exporter
pip install airthings-exporter

Usage

# Start server (1 device)
airthings-exporter --client-id [client_id] --client-secret [client_secret] --device-id [device_id]

# Start server (2 devices)
airthings-exporter --client-id [client_id] --client-secret [client_secret] --device-id [device_id_1] --device-id [device_id_2]

# Test server works
curl -s localhost:8000

Tested Devices

  • Airthings View Plus
  • Airthings Wave Mini

Example Prometheus configuration file (prometheus.yml)

scrape_configs:
  - job_name: 'airthings'
    scrape_interval: 5m
    scrape_timeout: 10s
    static_configs:
      - targets: ['localhost:8000']

API limitations

Airthings API for consumers allows only up to 120 requests per hour. Every scrape in prometheus sends one request per device to the Airthings API. Make sure the configured prometheus scrape interval does not exceed the limit.

About

Prometheus exporter for Airthings devices

License:MIT License


Languages

Language:Python 100.0%