>>> Join Us in the Fight Against Air Pollution

AirGradient Forum

AirGradient FW + ESPHome (beginner)

Hi all,

Before purchasing an AirGradient monitor, I have never used Home assistant nor any automation in my home.

I’ve been reading more about it, as I’m quite impressed with the ability to adjust multiple device/sensors settings using yaml files.

I think I also read somewhere that it might be possible to have both AirGradient default Firmware flashed in the device and then also set ESPHome, which would allow for having data both in the AirGradient dashboard and in home assistant - is that correct?

That would be a quite useful feature for me, as I would like to compare readings obtained using different configuration files. For example not touching the Arduino FW, and then playing with the yaml file for ESPHome to add the CO2 altitude compensation, or test alternative formulas for PM correction. Do you think this is feasible?

Finally, due to my lack of experience with home assistant, I would like to know if I need e.g. a Raspberry PI (or any other sever running 24/7) for getting and storing the data from the AG monitor, or if there are other alternatives, e.g. cloud-based (AWS)?

Any hints here would be greatly appreciated, thanks!

There are 2 options.

  • Install ESPHome firmware on the device which allows for data in HomeAssistant and AirGradient Dashboard
  • Use the stock firmware from AirGradient, and use the HomeAssistant Integration to add the sensor data to both HomeAssistant as well as the AirGradient Dashboard.

If you just want to get things up and running, I would go with the second option and run the stock firmware.
If you really want to tweak the running configuration, then you can pick if you want to edit Arduino sketches and C++, or move to ESPHome where everything is done in YAML files, which I find easier to work with.

I would recommend starting with Stock firmware and get just HomeAssistant configured, as it is its own thing independent of which firmware option you choose. You can run HA on just about any Pi 3 or later, or on a full PC if desired. Once you get HA up and running and comfortable, you can always switch to the ESPHome firmware, but then you also get to learn about setting up ESPHome and how to manage those files.

So I would start with the Easy Button of stock firmware and add in HA, then consider if you want to add ESPHome to the mix.

Thanks for clarifying, @MallocArray ! I like the stepwise suggestion so I get gradually familiar with the multiple components needed.

Nevertheless, I would like to ask what is the envisioned added value of having the sensor data in Home assistant? If I don’t have (yet) other devices to be automatically controlled (i.e. I’m only running AirGradient monitors), does Home assistant integration have an advantage over using the AirGradient app and dashboard alone?

My initial use case would be to have two separate data streams based on different FW settings, but both obtained from the same AG monitor. For example, (a) AirGradient stock Firmware without any changes, so I get the original readings in the AG app; + (b) ESPHome-based tweaked configuration files to have adjusted CO2 and PM readings.

I’m looking for an easy way to e.g. compare the CO2 sensor readings with and without altitude compensation. Or applying an alternative formula to obtain the PM2.5 levels and compare with the original values from AG. Note that for me it’s important to have the “ground truth” (original values) in parallel for comparison purposes. But I’m not sure if that’s at all possible?

Alternatively, maybe I rather need to change the Arduino firmware in such a way to expose all these envisioned values (original and compensated for each sensor), so I could compare them? Although I’m not sure if this would ultimately break the integration with the AG dashboard.

Sorry if my description above is confusing, I think it reflects some persisting FW knowledge gaps on my end.

Update: I managed to achieve my initial goal by tweaking the AirGradient firwmare code (C++), and documented it in following posts:

So for now I think I won’t proceed with Home Assistant and ESPHome (yet). The major blocking factor for me is indeed the lack of required hardware (e.g. Raspberry PI or another PC that I could dedicate to that). If things could work with a cloud-based server (e.g. in AWS), it would be easier for me at this moment. But anyway, if I identify advantages of starting automating my home devices, I’ll definitely get back to this.

As far as the added value of having HA in the mix, you could do automations based on the sensor readings. See a spike in VOC, due to cooking or painting, turn on the HVAC circulation fan.
See a rise in CO2, send a reminder to you to open a window, or turn on a fan (Or change your RGB bulbs around the house to match the AG colors)
Get alerts when the temperature in the house rises/falls outside of a desired range
Want to see graphs where you can control all of the parameters? You can do that
Want to see a graph that overlays AG values with other statuses around your home, such as presence sensors, energy usage, smart outlet states, or anything else you have configured as Smart, you can do it.