Skip to content

AirGradient Binding ​

AirGradient provides open source and open hardware air quality monitors.

This binding reads air quality data from the AirGradient API.

This API is documented at the AirGradient API documentation.

Supported Things ​

AirGradient sensors

This binding supports all the different AirGradient sensors, providing most of the sensor data.

  • bridge: Connection to the API
  • location: Location in the API to read values for

Discovery ​

Autodiscovery of locations is implemented. Start by adding an AirGradient API thing. When that is added and online, run a scan for new things in the AirGradient binding.

Thing Configuration ​

This binding supports reading data both directly from AirGradient sensors and from the AirGradient API. If you don't specify any path on the server, the binding will behave as if the hostname is the hostname of the AirGradient API server, and append paths and tokens for it.

The binding will adapt to the content type of the returned content to support different formats for getting data both from local and cloud installations.

NameHostnameContent-TypeParser
APIHostnames without any path (e.g., https://api.airgradient.com/)application/jsonJSON parser for the AirGradient API, correct paths will be appended to the calls
Local OpenMetricsHostnames with path (e.g., http://192.168.x.x/metrics)application/openmetrics-textOpenMetrics parser
Local WebHostnames with path (e.g., http://192.168.x.x/measures/current)application/jsonJSON parser for the AirGradient API, as if you returned the value of sendToServer() payload
Local PrometheusHostnames with path (e.g., http://192.168.x.x/measures)text/plainPrometheus parser for Prometheus format

AirGradient API ​

The connection to the API needs setup and configuration

  1. Log in to the AirGradient Dashboard
  2. Navigate to Place->Connectivity Settings from the upper left hamburger menu.
  3. Enable API access, and take a copy of the Token, which will be used in the token setting to configure the connection to the API.

To add a location, you need to know the location ID. To get the location ID, you

  1. Log in to the AirGradient Dashboard
  2. Navigate to Locations from the upper left hamburger menu.
  3. Here you will find a list of all of your sensors, with a location ID in the left column. Use that id when you add new Location things.

API Thing Configuration ​

NameTypeDescriptionDefaultRequiredAdvanced
tokentextToken to access the deviceN/Ayesno
hostnametextHostname or IP address of the APIhttps://api.airgradient.com/noyes
refreshIntervalintegerInterval the device is polled in sec.600noyes

Location Thing Configuration ​

NameTypeDescriptionDefaultRequiredAdvanced
locationtextA number identifying the location id in the AirGradient DashboardN/Ayesno

Channels ​

For more information about the data in the channels, please refer to the models in the AirGradient API documentation.

ChannelTypeRead/WriteDescription
pm01Number:DensityReadParticulate Matter 1 (0.001mm)
pm02Number:DensityReadParticulate Matter 2.5 (0.0025mm)
pm10Number:DensityReadParticulate Matter 10 (0.01mm)
pm003-countNumber:DimensionlessReadThe number of particles with a diameter beyond 0.3 microns in 1 deciliter of air
rco2Number:DensityReadCarbon dioxide PPM
tvocNumber:DensityReadTotal Volatile Organic Compounds
atmpNumber:TemperatureReadAmbient Temperature
rhumNumber:DimensionlessReadRelative Humidity Percentage
wifiNumber:PowerReadReceived signal strength indicator
uploads-since-bootNumber:DimensionlessReadNumber of measure uploads since last reboot (boot)
ledsStringRead/WriteSets the leds mode (off/co2/pm)
calibrationStringWriteTriggers co2 calibration on the device

Some configuration channels are only available for local devices (for cloud devices use the AirGradient dashboard to configure these instead). These configuration settings needs AirGradient firmware on the sensor of version 3.1.1 or later.

ChannelTypeRead/WriteDescription
country-codeStringRead/WriteThe ALPHA-2 Country code used for the device
pm-standardStringRead/WriteStandard used for Parts per Million measurements (us-aqi or ugm3)
abc-daysNumber:DaysRead/WriteCo2 calibration automatic baseline calibration days
tvoc-learning-offsetNumber:DimensionlessRead/WriteTime constant of long-term estimator for offset.
nox-learning-offsetNumber:DimensionlessRead/WriteTime constant of long-term estimator for offset.
mqtt-broker-urlStringRead/WriteMQTT Broker URL
temperature-unitStringRead/WriteTemperature unit used on the display
configuration-controlStringRead/WriteWhere the unit is configured from (local/cloud/both)
post-to-cloudSwitchRead/WriteSend data to the AirGradient cloud
led-bar-brightnessNumber:DimensionlessRead/WriteBrightness of the LED bar
display-brightnessNumber:DimensionlessRead/WriteBrightness of the display
modelStringRead/WriteThe model of the device (can be changed e.g. if you change sensors)
led-bar-testStringWriteTrigger test of LED bar

The following additional measurement channels are added dynamically, depending on the device model and firmware version.

ChannelTypeRead/WriteDescription
pm01-standardNumber:DensityReadPM1.0 concentration (standard particle)
pm02-standardNumber:DensityReadPM2.5 concentration (standard particle)
pm10-standardNumber:DensityReadPM10 concentration (standard particle)
pm005-countNumber:DimensionlessReadParticle count for particles >= 0.5 microns per deciliter air
pm01-countNumber:DimensionlessReadParticle count for particles >= 1.0 microns per deciliter air
pm02-countNumber:DimensionlessReadParticle count for particles >= 2.5 microns per deciliter air
pm50-countNumber:DimensionlessReadParticle count for particles >= 5.0 microns per deciliter air
pm10-countNumber:DimensionlessReadParticle count for particles >= 10 microns per deciliter air
pm02-compensatedNumber:DensityReadPM2.5 concentration with correction applied
tvoc-indexNumber:DimensionlessReadTVOC index value
tvoc-rawNumber:DimensionlessReadRaw TVOC value
nox-indexNumber:DimensionlessReadNOx index value
nox-rawNumber:DimensionlessReadRaw NOx value

Full Example ​

Things Configuration ​

dsl
Bridge airgradient:airgradient-api:home "My Home" [ token="abc123...." ] {
    Thing location      "654321"               "Outside"      [ location="654321" ]
}

Item Configuration ​

dsl
Number:Density      AirGradient_Location_PM2        "%.0f kg/m³"                         <density>       {channel="airgradient:location:654321:pm02"}"
Number:Temperature  AirGradient_Location_PM2        "Temperature [%.1f °C]"              <temperature>   {channel="airgradient:location:654321:atmp"}"