PurpleAir
PurpleAir makes sensors that measure hyper-local air quality data and share it with the public.
此集成可通过 UI 配置。前往 设置 > 设备与服务 添加。
Options
To define options for PurpleAir, follow these steps:
-
In Home Assistant, go to Settings > Devices & services.
-
If multiple instances of PurpleAir are configured, choose the instance you want to configure.
-
On the card, select the cogwheel
. - If the card does not have a cogwheel, the integration does not support options for this device.

-
Edit the options, then select Submit to save the changes.
Creating an API key
To add this integration, you need a (free) Purple Air API Key. A new account currently comes with 1 million free points. After that, you need to buy additional points to continue to use the API. The current plugin uses ~30K points/day. The 1 million points last about a month. A lack of points will trigger API errors until you buy more points.
Detailed instructions can be found here but in summary you:
- Create an account at https://develop.purpleair.com/ (which uses Single Sign-On through a Google account).
- On the 'keys' page press the "plus" button to create an API key. Leave the defaults of Read and Enabled.
- Go to the 'projects' page and select the edit (pencil) button on the listed Project. Add points (for example 1,000,000), then select Update.
- Go back to the 'keys' page and copy the API key. It will be a value like XXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXXX.
- Paste that API key into the API Key field when creating the integration in Home Assistant.
Note that if you are using your own sensor, it will need to be set to Public to be visible.
Creating an AQI Rating from Raw Particulate Data
The PurpleAir API does not provide AQI data; therefore, the integration does not create an AQI sensor automatically. However, sensors providing raw particulate data can be used to create a human-friendly AQI rating sensor.
The guidelines within this documentation constitute estimates and are intended to help informed decision making. They should not replace analysis, advice or diagnosis from a trained medical professional.
Understanding EPA Guidelines
The United States Environmental Protection Agency (EPA) provides guidelines on correlating the concentration of pollution over a time period to overall "healthiness." For example, a PM2.5 concentration between 0.0 and 12.0 µg/m³ over a 24-hour period equates to a "Good" AQI rating.
Therefore, a common strategy would be to use the guidelines for the particulate types provided by the PurpleAir integration and "merge" them into a single AQI rating.
Creating Statistics Sensors
With the EPA guidelines in hand, the next step is to create
statistics sensors for each particulate sensor you are
interested. This example uses PM2.5 and PM10.0 over a 24-hour period:
The entity IDs provided below are simulated; make sure that you use entity IDs that actually exist in your Home Assistant instance.
Creating the AQI Rating Sensor
The statistics sensors can then be combined into a template
sensor. Note that this example takes a conservative approach: the "worse" of the two
values (PM2.5 or PM10.0) is used to determine the overall rating.
Reminder that the breakpoints used below can be determined from the aforementioned EPA guidelines.

