Local Home Assistant Integration for AirGradient devices

As far as I can tell the device is now working with ESPhome, but it’s no longer connecting to the Wifi I configured and it’s no longer able to re-configure it. I can connect to it in web.esphome.io and see logs etc, but clicking Configure Wifi gives the error below. le sigh.
image

I reflashed the device, with no improvement… then found a fix here: New device: An error occurred. Improv Wi-Fi Serial not detected - ESPHome - Home Assistant Community (home-assistant.io)

However since re-flashing I am no longer getting any CO2 reading on the screen (just shows NaN) and shows CO2 unknown in Home Assistant. Just did a calibration and it’s reappeared… not sure the PM readings are accurate (they’re quite bad despite this being inside and readings being ok before I flashed) but right now it’s time for bed.

So you got it to connect to HomeAssistant in the end? After flashing ESPHome the first time, if you didn’t provide the Wifi SSID and password in a YAML file, then it should default to creating its own Access Point that you could connect to with your laptop/phone and then select your home wifi for it to connect to long term. But I think you got that working.

I have seen after flashing, sometimes the sensors don’t always read fully until you unplug the power and connect it again so it gets a full reboot, so hopefully that will get you going if you are still seeing NaN for any readings.

I have several devices running ESPHome and the stock firmware and both give me the same numbers, so maybe PM is just high at the time you were writing this

Thanks Malloc. I think it was behaving strangely (both temperature and PM were higher than I’d expect for an indoors sensor when it was low before flashing). In any case, it dropped fairly quickly after a calibration and is now more what I expected.

I’ve now flashed my Outdoor unit which is also behaving a little strangely… it’s only showing data for the first sensor, not the second (it showed data for both sensors before flashing ESPhome). As a result it’s showing as online in AirGradient but “no outdoor data available” I guess becayse it doesn’t trust it with only one sensor.
image

Regarding the wifi and home assistant. Behaviour wasn’t quite what I expected. I deployed the BIN file, which at the end of the process asked me to configure wifi, which I did, and then Home Assistant immediately detected the device. But after I powered it off (when I unplugged from the PC) it never reconnected and then I was unable to reconfigure the wifi using the UART cable. I ended up connecting to the AP as you’ve mentioned and was able to enter the details.

The outdoor unit never let me configure Wifi as part of the deployment and I had to connect to the AP to configure its settings before it showed up in Home Assistant.

When you flashed the .BIN file or from a YAML config, you used the o-1ppt version, right? Again, I would recommend the full power cycle just to be sure. The Dashboard would be looking for how it is returning the Average values, and if those aren’t populating, then the Dashboard will not think it is getting the full data.

I’ve not seen the final step of the .BIN file deployment prompting for configuring wifi, but I always use the .yaml files and add in my wifi credentials there. It may not fully save it until you either do it the .yaml way, or use the AP to configure it so it can fully save the configuration.

This may rely on the serial improv feature that I was not able to add, as it consumed all of the rest of the available memory and caused the devices to reboot constantly.

Yes I used the BIN file, O-1PPT. I’ve power cycled it several times, and it’s still only showing the one sensor, not both.
image

Odd. Sounds like you did it correctly. I only temporarily had a o-1ppt model when I tore apart my O-1PST to put in 2 PMS5003T modules, so I can’t easily test it without doing the same thing again.

But I can build an updated .bin file soon, but probably not until next week. It has been on my to-do list for awhile now.

I’ve just reflashed it again with no change.

Can I use Home Assistant to upload the YAML instead somehow? (not sure if that will behave differently)

To use the Yaml, you’ll need to install ESPHome, either as an add-on in HomeAssistant OS, as a Docker container, or as a standalone app. If it is your first time doing it, there may be more steps than you want at this time, so I just PMed you a link to a newer .bin file

Also, the O-1PPT is supported by the latest AirGradient firmware 3.1.1 version, so you should be able to use that and then the latest HomeAssistant has a native integration to identify those. It won’t help you with the Pro or DIY Basic models at this time, but somethign to consider

For those following along at home, based on some additional testing and the behaviour with the stock firmware it looks like one of my sensors has failed and that there was nothing wrong with Malloc’s ESPhome firmware.

[11:50:20]Firmware Version: 3.1.1
[11:50:25]Can not detect S8 on Serial1, try on Serial0
[11:50:25]CO2 S8 sensor not found
[11:50:25]Can not detect S8 run mode ‘PPT’
[11:50:25]Init SGP41 failuire
[11:50:25]SGP sensor not found
[11:50:25]Can not detect SGP run mode ‘O-1PP’
[11:50:28]Found PMS 1 on Serial0
[11:50:32]PMS2 sensor not found
[11:50:32]Firmware Mode: O-1P

Did you get the fully assembled unit or the kit? If the kit, can you post some photo how you assembled it so that we can check if the cables were connected correctly. Also the cables have to put firmly into the plugs.

Hi Achim,

It was the presoldered kit I put together.

I dismantled it to check and the cable had come out of one of the sensors entirely (not out of the joard, out of the sensor). I put it back in, it doesn’t seem like a really snug fit but the sensor is now working again. I’m assuming it fell out when I sat it upside down on the bench to upgrade the firmware.

So all working at the moment but obviously need to be careful moving it.

You need to really press the cable tightly into the blue PM modules. I use my fingernails and press on the white plastic of the cable plug to push it in. Normally these connections are very solid.

Integration with Home Assistant… perfect for the AG One and for the Open Air too!

Only One question: Is not posible now ask for a CO2 calibration as previously we can launch from the ESPHome version?

Over the next few HA updates we will add all configuration possibilities also directly into HA.

This will include the CO2 calibration.

1 Like

Will we be able to eventually, or already today, control the LED bar on the AG indoor unit? I am looking to get one of these for my daughter’s bedroom and mount it near her sleeping space but don’t want the LEDs to distract her at night. I’d like to be able to toggle them on/off with a switch in HA so when we put her to bed the unit is dark but still collecting data of course to use for automations. Thanks!

With the stock firmware, this capability is already present. You have to configure the time under the Dashboard website>Place>LED & Display
AirGradient

If you are using the ESPHome firmware, all of the pieces are there, but no instructions on how to create an automation to do it yet, but coming soon.
To turn off the display/LEDs it would be something like this, and then the inverse to turn it back on

Here is a short preview about configuration that is natively integrated into HA. It is not yet in HA Beta or Release. Just a preview from our developer.

image

A few things still missing, but just to give you an update.