>>> Join Us in the Fight Against Air Pollution

AirGradient Forum

AirGradient OneV9 Indoor - ESPHome basic MQTT integration

So far I have flashed a first attempt at “MallocArray”'s yaml for ESPHome. Device is “working” with caveats.

My goal is to:

  • enable the LCD (working)
  • enable the LED bar (not working)
  • publish the data items to MQTT

MallocArray has done an amazing job, the downside is, he has done so much of a job and “correctly” divided the YAMLs up into dynamic includes, that it’s going to take a deep breath and a deep dive into modifying them. Even deployment to ESPHome isn’t that easy as it’s hard to know which files you need to deploy and which you don’t. I tried using “esphome config” to generate the resultant YAML, but again it was massively verbose and complex.

There are other more simple YAMLs but they don’t appear to be as up to date or support the V9 with the ESP32C3.

Right now, I expect to do some of the lifting on the dev work for “raw MQTT” integration, sans “HA API”. I’m just making a general enquiry on the best place to start.

I also have an issue with the device resetting itself every 10 minutes or so. This happened on the stock firmware as well as MallocArray’s.

1 Like

I went ahead and tried modifying the “full_config” version from MallocArray, just adding the relevant MQTT settings.

It “works”. Sort of. Needs more work.

I also found the source of my reboots and removed them. (Various timeouts on HA API and others).

And disregard my comment about “not knowing what to deploy”. I figured it out after I actually read the documentation. It tells me what I needed to know.

Not sure if people here know, but our stock firmware also now includes MQTT functionality as well as local polling. More information:

https://www.airgradient.com/documentation/firmwares/

2 Likes

Did you get the LED bar working? It should with the basic yaml file without modification.

I haven’t played with MQTT but it is supported with ESPHome so should be able to just add it to the bottom of the existing yaml file that lists all of the packages and it will be added in as well.

Once you get something figured out and tested, let me know and I can see about expanding the documentation for it, or adding a package specific for it.

Got the LED bar and extra pages working this morning, having figured out the HA style /state /command topics. It seems dynamic too as it set it to green shortly afterwards.

Small steps :slight_smile:

Next I think I want to look at why I have 0’s for all PM sensors. I highly doubt the air is that clean as I smoke in the room. I will go back through the docs just in case I was meant to remove a cover off a sensor or something!

CO2 and VoC seem to be working. Office gets up to 1200 in the evenings with the windows shut and this little box should remind me to open the window. On opening the window for an hour that fell to ~550.

I do need to read up on the VoC index, as a quick glance suggests it is a unit-less and dynamic value. It tells you if your air is “average” 100, better than aver age <100 and worse than average >100. Need to do more investigations before I use that for any visualisations or automations.

Hi Achim,

I did try the updated firmware, but after 20 minutes or so I could not find a single link to the actual firmware anywhere. All I see is:
“Your browser doesn’t support this. Please use Chrome or Edge on Mac or PC.”

For flashing devices I would tend to use OTA or the command line. So I wasn’t concerned my browser security said “Nope”, I could just manually flash it. I couldn’t find any downloads for the “bin” file and while I could find a few guides on how to install the Arduino IDE I still couldn’t find how to download the actual code or a “bin” file.

Then I went further afield and a raft of ESPHome based firmware showed up. I have ESPHome running in K8S for a handful of devices already, so I flashed it with MallocArray’s in about 3 minutes.

The other thing that put me off the stock firmware, was it’s insistence of steering me to the cloud. This device needs to operate fully offline with no outside help.

1 Like

So, PM sensors are 0 across the board.

Smoking near it and blowing smoke around it sends the CO2 over 2000ppm and the VoC goes nuts too. PM = 0 on all dimensions.

So I lit a bit of cardboard, blew it out and held it directly under the PM sensor… 0 on all measurements.

:frowning: is the sensor defective? I checked the JST connections … all solid. ESPHome appears to be reading the device once a second, just 0.

Can you please post a photo of the assembled PCB. Maybe we can spot something.
We do test all modules before shipment so its unlikely that they break (but obviously you never know).

I’ve also got a docker container which runs a very basic Flask app which acts as a prometheus exporter.

If you set APIROOT in arduino to point to the Flask app it should then expose all the data for prometheus locally and not send to the cloud.

I’ve been working on an update so you can configure the app to send to MQTT and Influx too but not sure that’s interesting… should I pick that up ? :slight_smile:

https://hub.docker.com/r/mcjoppy/airgradient-prometheus

The only thing I can see to question is… the cable for the Plantower sensor is a “straight through, 1 to 1”, but the documentation mentions a cross-over (I assume rx/tx) cable is used.

The plot thickens… I see a bunch of readings on the 0.3um sensor. I am not convinced, yet, it’s not config or software. Still investigating. I need to find a way to debug/breakpoint or log what exactly is being received (or not) on the UART.