PurpleAir Air Quality Sensor

just came to say thanks! works like a charm. Since I live in Europe, wish it would report in Celsius instead of Fahrenheit, I couldn’t find a way to change it on the device…

Nevertheless, kudos for the custom component…

Anyone tried to build a nice fancy lovelace dashboard for visualizing data coming from the sensor in a meaningful way?

dear @catchdave

I was using you custom component for quite some days without issues, but since yesterday I started having problems, the integration stopped communicating with my device, even tough my device is still accessible via LAN without issues, I can’t figure out what could be the problem…

These are the log entries I’m getting, did anyone else experience similar, and know hows to resolve it?

2022-08-17 11:26:16.694 ERROR (MainThread) [homeassistant] Error doing job: Task exception was never retrieved
Traceback (most recent call last):
  File "/config/custom_components/purpleair/PurpleAirApi.py", line 179, in _update
    'current_temp_raw': result['current_temp_f'],
KeyError: 'current_temp_f'

Edit, additional info:
could the problem be related to received values? I noticed, that a construction site close to me caused the values to skyrocket:

Edit2: hm, something could have happened with my device?? Did it get faulty so soon? I just realised that PurpleAir Map reports that my device:

  • temp, humidity and pressure sensor is not detected (I also do not see any relevant data in the json locally)
  • confidence is ZERO, channel A reporting is bad


Yeah it’s likely your device. The error you mentioned simply means an expected value in the API is missing.

If you browse to 192.168.x.x/json?live=false (where 192.168.x.x is the IP of your device), you’ll probably see current_temp_f is missing or malformed.

Based on your edit—I’d check the device for physical stuff in tiur sensors—maybe blow on it with compressed air to clear whatever is clogging the sensor.

1 Like

Hm, can’t believe I get problems with it so soon, after only one week :joy:

Ok, I’ll check it for physical problem, hope it’s not insect. If it is, should I create some kind of protection, use some fine net, or similar? Or will this alter readings too much?

I had a similar issue after about a week my outside unit side A read extremely high while B read normal, then after unplugging the unit the A side read 0 from then on. I contacted support and tried to blow out the sensor like they wanted but it didn’t help so they sent a new sensor pair and a link to a video on switching them out. It’s been fine since (about a year now).

1 Like

I plugged it out, blew some air into the housing, and voi lá, it works again. I hope it will stay like this.

1 Like

Maybe I’m missing something but have read through the thread and am not sure how to solve what I am trying to do. I have a indoor sensor but would also like to pull data from an outdoor sensor in my neighborhood. I used catchdave’s Github integration for my local indoor sensor and wanted to use gibixcomputing integration for the outdoor sensor in my neighborhood. I already got my API keys so I’m set there.

So the issue I have is both of these integrations save to the custom_components/purpleair folder so adding the gibixcomputing integration overwrites the catchdave one and then both do not work. I thought I could do one of the following:

  1. Fork one of the integrations and try to change the install folder (is that possible?)
  2. Write a new integration that combines them into one integration (not sure I have the skills for that)
  3. Ask someone smarter than me for advice (Option I chose :slight_smile: )

Thanks for the help in advance!

Well, I can’t help you with the integrations…but I do have both an indoor and an outdoor station pulled into HA. They are both mine, so a little different. What I would try in your case would be to use the integration for the outdoor unit (if you want to use the integration otherwise use REST API on both) that is not yours and use the REST API for your indoor. Above I have everything you need to get all the info from your indoor.

Thanks @GlennHA. I’ll give that a try.

So it turns out I have the same problem. I actually saw the spider at one point, but after several vacuumings I can’t get one of the sensors to work anymore. One is always > 2,000 AQI.

So I modified the code to fallback to choosing the lowest sensor when there is a difference of 300 AQI or more between the two sensors.

This is great; thank you for sharing!
It worked great for both my indoor and outdoor PurpleAir sensors.

I must have found it just minutes after you posted here.

Two asides:

  • PurpleAir is written without the space (not Purple Air) :slight_smile:
  • There was a naming conflict with the PurpleAir API integration (so I removed that one - it was giving me a lower number than the website showed and only a single sensor value)
    PurpleAir Air Quality Sensor - #24 by gibwar

Hey Dave, try an air blower, a compressor, or canned pressurized air, it most probably will help. Vacuuming doesn’t solve the problem unfortunately, and I think we’ll have to clean the unit occasionally with compressed air, if the outside unit is within easy reach of insects, and not on a higher pole or something… mine is on the back wall of the house around 1 m high from the ground, so I expect quite a few cleaning sessions :slight_smile:

Thanks. I have tried that 3 times now - still have sensor B reporting 2,300 AQI :frowning: I even found and pulled out a spider and web, but something is stuck somewhere that even compressed air doesn’t dislodge.

I love that widget! Is that something you’d be willing to share your code for?

THANK YOU!!!

This is exactly what I was looking for, and now I can integrate that with my whole house HVAC fan / air cleaning so when the AQI gets above a certain level it will automatically turn on

1 Like

A few months ago I added a RGB LED on a desk lamp that mimics the Outdoor Air Quality colors; this has proven to be a great addition to my setup. My kids know if the air quality is good or not and whether they can go outside or now. Yesterday, unfortunately, I got to see the lamp in its purple shade.

For the indoor air quality I have my living room TV backlights mimic that color, so the vast majority of the time it is green. But the last few days, even with my fans & filters on it has been hanging out just above 50 in the yellow. I can see the jump up when my front door is opened because outside quaility is just that bad right now.

Hi all – I’ve recently become interested in PurpleAir, and am embarking on adding an official integration for it (using their official API). Will share progress here and would love feedback as I progress.

1 Like

I’ve submitted the official PR: Add PurpleAir integration by bachya · Pull Request #82110 · home-assistant/core · GitHub

This will allow you to input a latitude/longitude and track the sensor closest to it. Once approved, I’ll work on additional functionality via subsequent PRs.

2 Likes

@bachya, would love to make use of this.

1 Like

Excited to deliver it ASAP! I’m working on a challenging architectural issue, but once I come up with a solution, I’ll undraft this and get it reviewed. Reminder in the meantime: you can always install the PR’s files as a custom component.