OpenAQ Air Quality Data

OpenAQ has a pretty decent coverage map and data set. Some of the air quality services currently supported are a little slow to update, so more sources are always welcome.

This is an old post, but I just set this up for my instance using the Rest integration.

Pre-Requisites: You may need to register wirh openaq to get an API Key. I did.

On the OpenAQ website, you will need to find the location id for the location you want to measure. Then, you could configure things like this:


rest:
  resource: https://api.openaq.org/v3/locations/$YOURLOCATION/sensors
  headers: {"X-API-Key": "$YOURAPIKEY"}
  scan_interval: 300
  sensor:
    - name: "openaq.o3"
      device_class: "ozone"
      unit_of_measurement: "µg/m³"
      force_update: true
      value_template: "{{ value_json.results[0].latest.value }}"
    - name: "openaq.pm25"
      device_class: "pm25"
      unit_of_measurement: "µg/m³"
      force_update: true
      value_template: "{{ value_json.results[1].latest.value }}"
    - name: "openaq.no"
      device_class: "nitrogen_monoxide"
      unit_of_measurement: "µg/m³"
      force_update: true
      value_template: "{{ value_json.results[2].latest.value }}"
    - name: "openaq.no2"
      device_class: "nitrous_oxide"
      unit_of_measurement: "µg/m³"
      value_template: "{{ value_json.results[3].latest.value }}"
    - name: "openaq.pm10"
      device_class: "pm10"
      unit_of_measurement: "µg/m³"
      force_update: true
      value_template: "{{ value_json.results[4].latest.value }}"

I used JSON Pathfinder to inspect the results of the API call for my location. I expect different locations to have different json results.