Skip to content

Commit

Permalink
Documentation updates for AirVisual (home-assistant#3370)
Browse files Browse the repository at this point in the history
  • Loading branch information
bachya authored and MartinHjelmare committed Sep 16, 2017
1 parent 39383a4 commit c8cdb9c
Showing 1 changed file with 58 additions and 9 deletions.
67 changes: 58 additions & 9 deletions source/_components/sensor.airvisual.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,11 @@ ha_iot_class: "Cloud Polling"
---

The `airvisual` sensor platform queries the [AirVisual](https://airvisual.com/) API for air quality
data on the nearest city to a latitude and longitude. The resulting information
creates sensors for the Air Quality Index (AQI), the human-friendly air quality
level, and the main pollutant of that area. Sensors that conform to either/both
the [U.S. and Chinese air quality standards](http://www.clm.com/publication.cfm?ID=366) can be created.
data. Data can be collected via latitude/longitude or by city/state/country.
The resulting information creates sensors for the Air Quality Index (AQI), the
human-friendly air quality level, and the main pollutant of that area. Sensors
that conform to either/both the [U.S. and Chinese air quality standards](http://www.clm.com/publication.cfm?ID=366) can be
created.

This platform requires an AirVisual API key, which can be obtained [here](https://airvisual.com/api). Note
that the platform was designed using the "Community" package; the "Startup"
Expand All @@ -29,10 +30,10 @@ The "Community" API key is limited to 10,000 calls per month. In order to leave
a buffer, the `airvisual` platform queries the API every 10 minutes.
</p>

## {% linkable_title Configuring the Platform %}
## {% linkable_title Configuring the Platform via Latitude/Longitude %}

To enable this platform, add the following lines to your `configuration.yaml`
file:
To enable the platform and gather data via latitude/longitude, add the
following lines to your `configuration.yaml` file:

```yaml
sensor:
Expand All @@ -52,12 +53,60 @@ Configuration variables:
- **monitored_conditions** (*Required*): the air quality standard(s) to use
(`us` for U.S., `cn` for Chinese)
- **latitude** (*Optional*): the latitude to monitor; if excluded, the latitude
defined in `configuration.yaml` will be used
defined under the `homeassistant` key in `configuration.yaml` will be used
- **longitude** (*Optional*): the longitude to monitor; if excluded, the longitude
defined in `configuration.yaml` will be used
defined under the `homeassistant` key in `configuration.yaml` will be used
- **radius** (*Optional*): the radius (in meters) around the latitude/longitude to
search for the nearest city; defaults to `1000`

## {% linkable_title Configuring the Platform via City/State/Country %}

To enable the platform and gather data via city/state/country, add the
following lines to your `configuration.yaml` file:

```yaml
sensor:
- platform: airvisual
api_key: abc123
monitored_conditions:
- us
- cn
city: southend-on-sea
state: essex
country: uk
```

Configuration variables:

- **api_key** (*Required*): your AirVisual API key
- **monitored_conditions** (*Required*): the air quality standard(s) to use
(`us` for U.S., `cn` for Chinese)
- **city** (*Optional*): the city to monitor
- **state** (*Optional*): the state/region to monitor
- **country** (*Optional*): the country to monitor

To easily determine the proper values for a particular location, use the
[AirVisual region directory](https://airvisual.com/world). Once you browse to the particular city you want,
take note of the breadcrumb title, which is of the form
`country > state/region > city`. Use this information to fill out
`configuration.yaml`.

For example, Sao Paulo, Brazil shows a breadcrumb title of
`Brazil > Sao Paulo > Sao Paulo` – thus, the proper configuration would look
like this:

```yaml
sensor:
- platform: airvisual
api_key: abc123
monitored_conditions:
- us
- cn
city: sao-paulo
state: sao-paulo
country: brazil
```

## {% linkable_title Sensor Types %}

When configured, the platform will create three sensors for each configured
Expand Down

0 comments on commit c8cdb9c

Please sign in to comment.