Publish AirGradient to Home Assistant through MQTT
Based on the work done by https://www.airgradient.com/diy/ and https://github.com/ChaseCares/AirGradient-InfluxDB
- Install arduino-cli
make init
Now, copy DeviceConfig.hpp.template into DeviceConfig.hpp and configure the stuff: cp ./DeviceConfig.hpp.template ./DeviceConfig.hpp
Then, compile it: make compile
Finally, upload it: make upload
(you can only use make upload, as it automatically compile)
- Assemble the AirGradient device - Instructions here
- Install Arduino - Download here
- Download this repository - Click the green “Code” button and then “Download ZIP”
- Unzip the folder, navigate to the AirQualityMonitor and copy the example config file. Paste it into the same directory and rename it
DeviceConfig
Add ESP8266 platform information.
- Open the Arduino sketch file. Then open the Preferences menu, and add
http://arduino.esp8266.com/stable/package_esp8266com_index.json
to Additional Board Manager URLs - Open the Board Manager and search for and install:
esp8266
byESP8266 comunity
- Load the board preferences by navigating to Tool -> Board: -> ESP8266 Boards, then select
LOLIN(WEMOS) D1 R2 & mini
Add the required libraries.
- Open library manager, search for and install:
AirGradient Air Quality Sensor
If only using sensors, with no connectivity skip to step two
- Search for and install:
AirGradient Air Quality Sensor
by AirGradient - Search for and install:
ESP8266 and ESP32 OLED driver for SSD1306 displays
by ThingPulse
Only needed if you enable MQTT
- Search for and install:
home-assistant-integration
by Dawid Chyrzynski You will be asked if you would like to install dependencies, select Install all
Navigate to DeviceConfig.hpp tab and enable any features you would like to use. Then fill out their corresponding credentials.
Once customization is complete, plug the device (esp8266) into your computer then click upload.