AirGradient One – Test with Home Assistant

Published by Oliver on

I tried all of the standard sensors and I wanted more. If temperature and humidity is not the enough the AirGradient One will give you more data about your air than you ever need. This is how to use this sensor local first with full Home Assistant integration.

Installation & Setup in Home Assistant

The packaging the AirGradient One comes in

Once you unpacked the sensor there is actually not much more to do. You can find pretty good setup instructions online. Some sensors need to be plucked into the main PCB of the sensor but that is pretty simple. The instructions and connectors seems to make it fool proof (at least it worked for me).

Once done you close the enclosure and you are basically ready to go. It can be mounted to the wall but I decided to put it on my desk for now, feet are included as well.

The tools & feet coming with the Air Gradient

Once assembled you just connect it to the included power supply and then start using it. The device comes with a small screen that shows the most useful stats and a pretty bright (can be adjusted) set of LEDs that can indicate a status from a room away.

I wanted more data though and I am not very interested in using another third party web service. Fortunately the AirGradient can be used fully locally and is actually auto discovered by Home Assistant. Once powered on for some time it showed up in my instance like this. A simple click on “add” started the integration process.

Autodetected by Home Assistant

Once connected to the Wifi (discovery works via bluetooth I believe) you can give your device a name and assign it to an area like any Home Assistant device.

Once thats done the new device should show up and expose a bunch of sensor readings. It includes the important CO² levels and PM2.5 readings but also temperature, humidity, PM1, PM10, VOC and NOx index values. Initially some of the values did not show up for me or were just zero, after waiting for some time (I believe one value took a couple of days) they all started to show up though.

AirGradient sensors

The device also exposes a bunch of configuration settings. Some are standard settings like the units, some learning intervals and the local/online mode but others allows for some more interesting changes. You can configure which value the LED strip on the device displays (I kept it at CO² level) and control the brightness of the LEDs and the display both individually. Awesome, I wish all devices had that! More on that later.

AirGradient configurations

I also double checked if the local mode really works and I do not see any regular activity from the devices in my Unifi dashboard. I believe it checks for firmware updates from time to time but indeed does not seem to upload anything. Again, I wish all devices would allow this local first approach.

I am running an Adguard Home DNS based ad blocker as well and checked the DNS queries arriving there as well. The only host it is trying to resolve is hw.airgradient.com. I will update this post if I should find anything else.

DNS requests in Adguard Home

You can also access all the data via a fully local API as per this documentation. Any client like curl/wget/postman/… can query this simple GET endpoint. One request from mine looks like that (serial number changed):

GET http://airgradient_d123da1c4a42.local/measures/current
{
    "pm01": 0,
    "pm02": 0,
    "pm10": 0,
    "pm01Standard": 0,
    "pm02Standard": 0,
    "pm10Standard": 0,
    "pm003Count": 72.17,
    "pm005Count": 65.33,
    "pm01Count": 15.83,
    "pm02Count": 1.17,
    "pm50Count": 0,
    "pm10Count": 0,
    "pm02Compensated": 0,
    "atmp": 20.9,
    "atmpCompensated": 20.9,
    "rhum": 51.85,
    "rhumCompensated": 51.85,
    "rco2": 565,
    "tvocIndex": 103,
    "tvocRaw": 30604.5,
    "noxIndex": 1,
    "noxRaw": 16495.08,
    "boot": 0,
    "bootCount": 0,
    "wifi": -68,
    "ledMode": "co2",
    "serialno": "d123da1c4a42",
    "firmware": "3.3.9",
    "model": "I-9PSL"
}

Data visualization

I will keep using it via Home Assistant though. In this article I described how I set up InfluxDB as a database and Grafana as the UI to display all my smart home data. I am using the same approach here, all the sensors (as well as some comparison data from the IKEA Starkvind air purifier) is showing up here. Quite neat!

Automations

Now what am I actually using the sensor for? So far honestly mostly to satisfy my curiosity. It is very interesting to see how quickly especially the CO² value rises if you spend time in a smaller room without any window open. That is especially true over night. I used the easily visible LEDs to indicate that value and made it my signal to get up from time to time to open the window and let some fresh air in. Definitely helps with concentration during work!

Given that that’s quite important I built a warning and an actual alarm. Levels over 1000 mean you should probably start noticing the effect and over 2000 it is a good idea to do something about it right now. The alarm message is sent to our phones via my pushover setup.

alias: CO² Alarm
description: >-
  Quickly flashes the desk light if the CO2 levels rise over 2000 and send a
  warning message
triggers:
  - trigger: numeric_state
    entity_id:
      - sensor.airgradient_one_carbon_dioxide
    above: 2000
conditions: []
actions:
  - action: light.turn_on
    metadata: {}
    data:
      rgb_color:
        - 255
        - 0
        - 0
      brightness_pct: 10
    target:
      device_id: 280cf5ddbad70df4bb51a65e3ce63238
  - delay:
      hours: 0
      minutes: 0
      seconds: 1
      milliseconds: 0
  - action: light.turn_off
    metadata: {}
    data: {}
    target:
      device_id: 280cf5ddbad70df4bb51a65e3ce63238
  - action: notify.pushover
    metadata: {}
    data:
      message: CO² Alarm in the bedroom
      title: Open the window!
mode: single

And here is the simpler warning at 1000 without the push notification.

alias: CO2 warning
description: Quickly flashes the desk light if the CO2 levels rise over 1000
triggers:
  - trigger: numeric_state
    entity_id:
      - sensor.airgradient_one_carbon_dioxide
    above: 1000
conditions: []
actions:
  - action: light.turn_on
    metadata: {}
    data:
      rgb_color:
        - 255
        - 255
        - 0
      brightness_pct: 10
    target:
      device_id: 280cf5ddbad70df4bb51a65e3ce63238
  - delay:
      hours: 0
      minutes: 0
      seconds: 1
      milliseconds: 0
  - action: light.turn_off
    metadata: {}
    data: {}
    target:
      device_id: 280cf5ddbad70df4bb51a65e3ce63238
mode: single

Depending on what devices you have available this could be nicely combined with an exhaust fan, some AC system or an automated window for example.

Currently we are using the device in the bedroom though which should be dark during the night. The LEDs and the screen get quite bright but luckily full control over them is possible. I added another automation to turn them off during sleeping hours.

alias: Airgradient night mode
description: Turn airgradient LED off during the night and dim down the display
triggers:
  - entity_id: binary_sensor.bed_occupied
    to: "on"
    id: in_bed
    trigger: state
    enabled: false
  - entity_id: binary_sensor.bed_occupied
    to: "off"
    id: out_of_bed
    trigger: state
    enabled: false
  - at: "23:00:00"
    id: force_night
    trigger: time
  - at: "10:00:00"
    id: morning_reset
    trigger: time
conditions: []
actions:
  - choose:
      - conditions:
          - condition: or
            conditions:
              - condition: and
                conditions:
                  - condition: trigger
                    id: in_bed
                  - condition: sun
                    after: sunset
              - condition: trigger
                id: force_night
        sequence:
          - data:
              value: 0
            target:
              entity_id: number.airgradient_one_led_bar_brightness
            action: number.set_value
          - data:
              value: "0"
            target:
              entity_id: number.airgradient_one_display_brightness
            action: number.set_value
      - conditions:
          - condition: or
            conditions:
              - condition: trigger
                id: out_of_bed
              - condition: trigger
                id: morning_reset
        sequence:
          - data:
              value: 100
            target:
              entity_id: number.airgradient_one_led_bar_brightness
            action: number.set_value
          - data:
              value: 100
            target:
              entity_id: number.airgradient_one_display_brightness
            action: number.set_value
mode: single

This one is a little more complicated. The main part is a time frame 11pm to 10am during which the lights are deactivated. Alternatively a sensor in the bed can also recognize when we need some darkness and triggers the same automation as well, but only after sunset.

My opinion on the Air Gradient one

Full disclosure: I got the device for free but with no obligations regarding my review at all. This is my personal opinion.

I am not quite sure if I can fully recommend everyone to get this sensor, it is quite expensive and so far I did not get as much value from it as lets say motion sensors and smart lights. If you already have all the basics though and are interested in the quality of your air beyond temperature and humidity then this is an amazing devices.

While I can not independently confirm the readings they seems precise enough and definitely match the felt levels and other sensors around. The setup process is simple and the integration with Home Assistant great. I love that they support a fully local first approach, even though they offer their own web service. Amazing!

The support so far was also great, the LEDs and the configuration possibilities, especially the brightness control are top notch. My only issue so far is that it from time to time makes some high pitched noise. Support recommends cleaning the build in filter, I will give that a try.

I really enjoy playing around with this device and having even more data about my smart home available, lets see what I will use it for in the future. So far it was definitely useful for figuring out when to open the window to stay productive during longer work sessions.