Local Server Documentation

Local Server API

From firmware version 3.0.10 onwards, the AirGradient ONE and Open Air monitors have below API available.

Discovery

The monitors run with mDNS. So within the same network, the monitor can be accessed through:

http://airgradient_{{serialnumber}}.local

The following requests are possible:

Get Current Air Quality (GET)

With the path “/measures/current” you can get the current air quality data.

http://airgradient_ecda3b1eaaaa.local/measures/current

“ecda3b1eaaaa” being the serial number of your monitor

You get the following response:

{"wifi":-46,
"serialno":"ecda3b1eaaaa",
"rco2":447,
"pm01":3,
"pm02":7,
"pm10":8,
"pm003Count":442,
"atmp":25.87,
"rhum":43,
"atmpCompensated": 26.66,
"rhumCompensated": 55,
"tvocIndex":100,
"tvocRaw":33051,
"noxIndex":1,
"noxRaw":16307,
"boot":6,
"ledMode":"off",
"firmwareVersion":"3.0.10beta2",
"fwMode":"I-1PST"}
Properties Type Explanation
serialno String Serial Number of the monitor
wifi Number WiFi signal strength
pm01, pm02, pm10 Number PM1, PM2.5 and PM10 in ug/m3
rco2 Number CO2 in ppm
pm003Count Number Particle count per dL
atmp Number Temperature in Degrees Celsius. Raw value from sensor module.
rhum Number Relative Humidity. Raw value from sensor module.
atmp_compensated Number Temperature in Degrees Celsius. Compensated value for Open Air.
rhum_compensated Number Relative Humidity. Compensated value for Open Air.
tvocIndex Number Sensirion VOC Index
tvocRaw Number VOC raw value
noxIndex Number Sensirion NOx Index
noxRaw Number NOx raw value
boot Number Counts every measurement cycle. Low boot counts indicate restarts.
ledMode String Current configuration of the LED mode
firmwareVersion String Current firmware version
fwMode String Current model name

About compensated value

In version 3.0.6 we implemented a temperature and humidity compensation algorithm in the firmware for the outdoor model Open Air. This was necessary to compensate for the internal heat built up in the enclosure. So the atmp and rhum properties were adjusted.

However, that change was not consistent because all other parameters, e.g. the CO2 or PM values are the unaltered values we get from the sensor modules.

We have therefore rolled back this change in version 3.0.10+ and the atmp and rhum properties are now raw values as in the firmware version prior 3.0.6. We are implementing this correction on our server side. For the local server API (see above), the corrected values is available as a separate parameter with the postfix “_compensated”. So it is recommended that you use these properties for more accurate numbers within your local implementation.

Get Configuration Parameters (GET)

With the path “/config” you can get the current configuration.

{"country":"US",
"pmStandard":"ugm3",
"ledBarMode":"pm",
"displayMode":"on",
"abcDays":30,
"tvocLearningOffset":12,
"noxLearningOffset":12,
"mqttBrokerUrl":"",
"temperatureUnit":"f",
"configurationControl":"both",
"postDataToAirGradient":true}

Set Configuration Parameters (PUT)

Configuration parameters can be changed with a put request to the monitor, e.g.

Example to force CO2 calibration

curl -X PUT -H "Content-Type: application/json" -d '{"co2CalibrationRequested":true}' http://airgradient_84fce612eff4.local/config

Example to set monitor to Celsius

curl -X PUT -H "Content-Type: application/json" -d '{"temperatureUnit":"c"}' http://airgradient_84fce612eff4.local/config

Avoiding Conflicts with Configuration on AirGradient Server

If the monitor is set up on the AirGradient dashboard, it will also receive configurations from there. In case you do not want this, please set “configurationControl” to local. In case you set it to cloud and want to change it to local, you need to make a factory reset.

Configuration Parameters (GET/PUT)

Properties Type Accepted Values Example
country String Country code as ALPHA-2 notation {“country”: “TH”}
pmStandard String ugm3 : ug/m3
usaqi: USAQI
{“pmStandard”: “ugm3”}
ledBarMode String co2: LED bar displays CO2
pm: LED bar displays PM
off: Turn off LED bar
{“ledBarMode”: “off”}
abcDays Number Number of days for CO2 automatic baseline calibration. Maximum 200 days. Default 8 days. {“abcDays”: 8}
mqttBrokerUrl String MQTT broker URL. {“mqttBrokerUrl”:“mqtt://192.168.0.18:1883”}
temperatureUnit String c or C: Degree Celsius °C
f or F: Degree Fahrenheit °F
{“temperatureUnit”: “c”}
configurationControl String both : Accept local and cloud configuration
local : Accept only local configuration
cloud : Accept only cloud configuration
{“configurationControl”: “both”}
postDataToAirGradient Boolean Send data to AirGradient cloud:
true : Enabled
false: Disabled
{“postDataToAirGradient”: true}
co2CalibrationRequested Boolean Trigger CO2 calibration (400ppm) on monitor:
true : Calibration will be triggered
{“co2CalibrationRequested”: true}
ledBarTestRequested Boolean Test LED bar:
true : LEDs will run test sequence
{“ledBarTestRequested”: true}