AirGradient Integrations

Indoors, I’m typically getting 0 pm2.5 with my original Basic kit and my self sourced, and with my latest Pro direct from AG, I go from 0-10 pm2.5, when the outdoor levels are 10-25. So not wildly different, but measurable.

It does make me question the AliExpress sensors, but the typically shops are either Amazon or Ali, both with varying quality, or buying a whole kit with shipping from AG, and since they all “work” but with questionable reliability/accuracy, it is hard to know.

Thanks to @MallocArray for the code, I’ve been using your airgradient-pro.yaml with my self sourced sensors and it works great. I’ll try out the newest version this weekend.

Home Assistant was new to me when I first started using AirGradient and it was pretty confusing and overwhelming at first (and I come from a technical background). I had an older Raspberry Pi that I used to install HA on using the instructions on the HA site. No problems there.

But after that things got confusing. I found several other sites where I figured out I had to install ESPHome on HA but then spent a lot of time figuring out how to add the device. I ended up understanding I could temporarily plug the AirGradient in via usb into my Pi, go to ESPHome, “New Device”, then “Plug into the computer running ESPHome Dashboard”. BTW, this is just a one time step and after the installation any future configuration updates can be done with the “wirelessly” option.

After that appeared successful though I was stuck with @barman’s question of, where’s the data? Again, this was due to having no HA experience. After finally figuring that out and creating some dashboards I feel pretty good about the setup. My one question though, is it possible in HA’s dashboards to color change the state of the graphs depending on thresholds? For example if CO2 > 1000 change it to yellow, like how the AirGradient app is.

I think it would be great to have an integration docs section with screenshots and instructions that live on this site. The forum is great too but I had to search a lot and piece info together as I understood more. Hope that makes sense.

In your HA Dashboard, you could add a “gauge card” with a config something like this:

I have just received the new " Open Air Outdoor Monitor O-1PST CO2 Version" - will these integrations work with the additional sensor, or do I need to add something?
Primarily looking to switch to ESPHOME, with the additional upload to the Air Gradient API, so I can integrate in to Home Assistant.

Thanks.

I’m working on a config for ESPHome for that model right now, so if you can wait a few days I hope to have something ready soon.

@MallocArray many thanks for this. Very appreciated!

Thanks for the update - as a newcomer to this community I can see your efforts are appreciated.
Does it include control of the blue light? That is already generating comments within the family and I haven’t even mounted it yet!

What blue light do you refer to?

Blue LED next to the USB port. Keeps coming on.

My initial release of an ESPHome config for the new AirGradient One with the v9 board is now available:

airgradient_esphome/airgradient-one.yaml at main · MallocArray/airgradient_esphome (github.com)

Supports all included sensors and the LED bar, based on CO2 values, as well as sending data to AirGradient’s dashboard in addition to your own HomeAssistant

We will most likely make the blue light only blink during the WiFi setup and if the monitor has some problem. Would that make your family happy :wink: ?

That would make the most obvious use of the LED in my mind. My children are used to things with lights on around the house and outside, and if something is showing a light which shouldn’t do I usually get a report very quickly. Therefore it being used for error conditions only would probably make the most sense.

Although I will be switching over to the ESPHome config as soon as it is ready…

I’ve updated gohai’s HomeKit port to work with DIY_PRO_V4_2. If anyone runs into any bugs or issues feel free to let me know and I’ll do my best to help out if I can. I haven’t run into any problems yet but I also haven’t done any extensive tests.

Here is the link to my repo - https://github.com/brian-gee/arduino-homekit-enabled/tree/master/examples

@investigatorno56 Thanks for your great work on HomeKit integration for DIY PRO V4.2
I would like to know can I upload the same firmware to two Boards which is DIY PRO V4.2 with the same setup password and added to the same HomKit network ?

Are the 2 units detected under the same HomeKit then they can added on the same Apple Home network such as the same Home Name and same WIFI network?

I found that only one unit can be detected on the Add Accessory Screen, the 2nd unit must be power off. Simply speaking only ONE unit can be detected on the same Home network, even I try to changed the Setup password with difference number. Do you have any idea to fix that?

Thanks!
Alan

Hey @Alan_Ng, I’m not sure as I only have one device that I can test this with. I think possibly setting a different serial number within the homekit.c file might resolve this issue. Give it a try and let me know if it works. If not maybe something in the below accessory options needs to be changed.

homekit_accessory_t *accessories[] = {
  HOMEKIT_ACCESSORY(.id = 1, .category = homekit_accessory_category_sensor, .services = (homekit_service_t*[]) {
    HOMEKIT_SERVICE(ACCESSORY_INFORMATION, .characteristics = (homekit_characteristic_t*[]) {
      HOMEKIT_CHARACTERISTIC(NAME, "AirGradient DIY PRO"),
      HOMEKIT_CHARACTERISTIC(MANUFACTURER, "Arduino HomeKit"),
      HOMEKIT_CHARACTERISTIC(SERIAL_NUMBER, "0123456"),
      HOMEKIT_CHARACTERISTIC(MODEL, "ESP8266"),
      HOMEKIT_CHARACTERISTIC(FIRMWARE_REVISION, "1.0"),
      HOMEKIT_CHARACTERISTIC(IDENTIFY, my_accessory_identify),
      NULL
    }),

For what it is worth, Airgradient uses the last 6 characters of the MAC address as the serial number with the D1 Mini ESP8266 when it comes to their API. (Full MAC for the esp32-c3)

Hey @investigatorno56 thanks for your response. Let me show you what is my findings as below.

  • Only 1 unit power on, it can be detected on Add Accessory screen and added to Home success.
  • When 1st unit is added to Home and working then 2nd unit is not shown on the screen of the Add Accessory.
  • Power off the 1st unit which is added to Home already, then 2nd unit will be shown on Add Accessory screen and it can be process the adding process but finally it failed with message of “it cannot be added”
  • Removed the 1st unit from the Home and power off it then add the 2nd unit to Home will be detected and success.

I have built others HomeKit Board, it having the same issue when adding 2nd unit. That mean if you only have 1 unit then you do not discovered that issue.

As I searched for others HomeKit projects that come with Setup QR code which have the Setup ID inside the QR code. I have referred the below document for details and build the QR code.
I have try to use different Setup ID but it look like having the same issue, may be I not good for the program and misunderstand some details of building the QR code.

I have refer to the below information to create a QR code.

This generated setup payload is the actual content of the QR code and can be generated with the HomeKit Accessory Simulator (HAS) as well.

I recalled that I have try this with different SETUP ID but it still not resolve the issue. It may be I am not good for that QR code setup .

I think HomeKit have a record ( Serial number or others information) of the added units and do not allow to add the same HW information to the same HomeKIt network.

May be I try to change the Serial Number and SETUP ID with QR to check it again.

I will let you know my findings. Thanks again!

I’m working on an AirGradient integration for OpenHAB

It is available in the openhab marketplace, so it should be easy to enable it if you are running OpenHAB 4.
AirGradient API Binding - Add-on Marketplace / Bundles - openHAB Community

All feedback is welcome.

I am new here but can we put the data from an AirGradiant to WAQI.info? I see a lot of PurpleAir but with my students, I would prefer to buy 3 AirGradiant than 1 PurpleAir…

We don’t have an integration with Waqi but with openAQ which is used by many researchers.