jakecoppinger / ESPHome-AirGradient

ESPHome config for AirGradient Air Quality Sensor

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

ESPHome-AirGradient

ESPHome config for AirGradient Air Quality Sensor

ko-fi

The AirGradient DIY Air Quality Sensor can be found here: https://www.airgradient.com/diy/

This repository will provide you the ESPHome config to run this with Home Assistant.

I have written a blog post about this here: Measuring Air Quality in your Home Office

0. Prerequisites

1. Add the ESPHome addon

Click here: Open the ESPHome Add-n.

Note: This deep link won't work if you're running Home Assistant in Docker. In that case you'll need to install ESPHome via Docker or manually: https://esphome.io/guides/getting_started_command_line.html

Eg: docker run -d --name=esphome --net=host -e TZ=YOUR_TZ_VALUE -v YOUR_ESPHOME_CONFIG_FOLDER:/config esphome/esphome

2. Download whatever font you feel fancy.

Follow the ESPHome font docs

  • Copy your font into the ESPHome directory (if running in Docker, the folder mapped to the /config mount point).
  • Change the font config with the path to your font: eg. swap - file: "gfonts://Ubuntu" with - file: "./yourfont.ttf"

3. Add your secrets

You can also hardcode them in the air-gradient-diy.yaml but I would recommend to split these

You can either create a separate secrets.yaml with your secrets in this file like so:

# WIFI
wifi_ssid: ""
wifi_password: ""

# OTA
ota_password: ""

#AP
fallback_ssid_password: ""

or you can just include your Home Assistant secrets.yaml: How do I use my Home Assistant secrets.yaml?

If you are using the ESPHome web interface you can edit the secrets.yaml via a button in the top right of the page.

4. Plug in your AirGradient

You can either plug it in the device running Home Assistant or your laptop/PC. Note: You must plug into the D1 Mini itself, not the D1 Mini Shield or external USB port of the Airgradient case. The shield's USB port is only used for power.

5. Add a new device

ESPHome will ask you for a name and your WiFi credentials. You can put in anything you want right now. We will change that anyway in the later steps.

6. Edit your device and change the config

Now you just need to copy the content of the air-gradient.yaml into the editor.

By default, air-gradient.yaml only records the particulate matter <2.5µm concentration that is measured by all PMSX003 sensors. The PMS5003 sensor (inlcuded with the AirGradient DIY kit) can also record <1.0µm and <10.0µm concentrations. Uncomment the sections for pm_1_0 and pm_10_0, respectively, to record those as well. If you are using the PMS5003ST sensor, you can also record the formaldehyde (HCHO) concentration by uncommenting the formaldehyde section. See the esphome docs for details.

The OLED display is limited to four lines. You may display multiple pages by adding another page id section as in the esphome docs. An example second page showing three particulate matter sensors is included in air-gradient.yaml.

Now you just need to copy the content of the air-gradient-diy.yaml into the editor

7. Save and install

This will take a minute or two. ESPHome will compile the binary for your AirGradients ESP8266.

8. Add your device to Home Assistant

In the notification panel should be an new device available to set up. Your new AirGradient Sensor.

If not you can add the device via the esphome integreation:

Setup ESPHome integration.

9. Create something!

Now it is your turn to do something silly or usefull with the air quality sensor.

Flashing over WiFi

In order to flash this project via WiFi I have added the safe_mode switch. This will:

  1. Disconnect from WiFi and disabling all functionality
  2. Scann for WiFi (Takes a about 30 seconds, so be patient)
  3. Connect to WiFi

Now you can flash the device wirelessly again.

You can see the switch in the the device view of the esphome integration:

ESPHome safe_mode

Support

Open an issue when you have any questions.

If this did help you:

About

ESPHome config for AirGradient Air Quality Sensor

License:MIT License