Skip to content

Commit d911c3d

Browse files
bachyafabaff
authored andcommitted
Add documentation updates for upcoming AirVisual changes. (home-assistant#5534)
* Add doc updates for upcoming AirVisual changes * Added language about scan_interval
1 parent ee853f3 commit d911c3d

File tree

1 file changed

+72
-61
lines changed

1 file changed

+72
-61
lines changed

source/_components/sensor.airvisual.markdown

Lines changed: 72 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -13,21 +13,24 @@ ha_release: 0.53
1313
ha_iot_class: "Cloud Polling"
1414
---
1515

16-
The `airvisual` sensor platform queries the [AirVisual](https://airvisual.com/) API for air quality
17-
data. Data can be collected via latitude/longitude or by city/state/country.
18-
The resulting information creates sensors for the Air Quality Index (AQI), the
19-
human-friendly air quality level, and the main pollutant of that area. Sensors
20-
that conform to either/both the [U.S. and Chinese air quality standards](http://www.clm.com/publication.cfm?ID=366) can be
21-
created.
22-
23-
This platform requires an AirVisual API key, which can be obtained [here](https://airvisual.com/api). Note
24-
that the platform was designed using the "Community" package; the "Startup"
25-
and "Enterprise" package keys should continue to function, but actual results
26-
may vary (or not work at all).
16+
The `airvisual` sensor platform queries the [AirVisual](https://airvisual.com/)
17+
API for air quality data. Data can be collected via latitude/longitude or by
18+
city/state/country. The resulting information creates sensors for the Air
19+
Quality Index (AQI), the human-friendly air quality level, and the main
20+
pollutant of that area. Sensors that conform to either/both the
21+
[U.S. and Chinese air quality standards](http://www.clm.com/publication.cfm?ID=366)
22+
can be created.
23+
24+
This platform requires an AirVisual API key, which can be obtained
25+
[here](https://airvisual.com/api). Note that the platform was designed using
26+
the "Community" package; the "Startup" and "Enterprise" package keys should
27+
continue to function, but actual results may vary (or not work at all).
2728

2829
<p class='note warning'>
2930
The "Community" API key is limited to 10,000 calls per month. In order to leave
30-
a buffer, the `airvisual` platform queries the API every 10 minutes.
31+
a buffer, the `airvisual` platform queries the API every 10 minutes by default.
32+
Modification of this (via the `scan_interval` key) to a too-low value may
33+
result in your API key being deactivated.
3134
</p>
3235

3336
## {% linkable_title Configuring the Platform via Latitude/Longitude %}
@@ -42,59 +45,67 @@ sensor:
4245
monitored_conditions:
4346
- us
4447
- cn
48+
show_on_map: false
49+
scan_interval: 30
50+
# Configure by latitude/longitude:
4551
latitude: 42.81212
4652
longitude: 108.12422
47-
radius: 500
48-
show_on_map: false
49-
```
50-
51-
Configuration variables:
52-
53-
- **api_key** (*Required*): your AirVisual API key
54-
- **monitored_conditions** (*Required*): the air quality standard(s) to use
55-
(`us` for U.S., `cn` for Chinese)
56-
- **latitude** (*Optional*): the latitude to monitor; if excluded, the latitude
57-
defined under the `homeassistant` key in `configuration.yaml` will be used
58-
- **longitude** (*Optional*): the longitude to monitor; if excluded, the longitude
59-
defined under the `homeassistant` key in `configuration.yaml` will be used
60-
- **radius** (*Optional*): the radius (in meters) around the latitude/longitude to
61-
search for the nearest city; defaults to `1000`
62-
- **show_on_map** (*Optional*): whether to show a marker on the map at the specified
63-
location; defaults to `true`
64-
65-
## {% linkable_title Configuring the Platform via City/State/Country %}
66-
67-
To enable the platform and gather data via city/state/country, add the
68-
following lines to your `configuration.yaml` file:
69-
70-
```yaml
71-
sensor:
72-
- platform: airvisual
73-
api_key: abc123
74-
monitored_conditions:
75-
- us
76-
- cn
77-
city: southend-on-sea
78-
state: essex
79-
country: uk
80-
show_on_map: false
53+
# Or configure by location:
54+
city: Los Angeles
55+
state: California
56+
country: USA
8157
```
8258
83-
Configuration variables:
84-
85-
- **api_key** (*Required*): your AirVisual API key
86-
- **monitored_conditions** (*Required*): the air quality standard(s) to use
87-
(`us` for U.S., `cn` for Chinese)
88-
- **city** (*Optional*): the city to monitor
89-
- **state** (*Optional*): the state/region to monitor
90-
- **country** (*Optional*): the country to monitor
91-
- **show_on_map** (*Optional*): whether to show a marker on the map at the specified
92-
location; defaults to `true`
59+
{% configuration %}
60+
api_key:
61+
description: your AirVisual API key
62+
required: required
63+
type: string
64+
monitored_conditions:
65+
description: the air quality standard(s) to use (`us` for U.S., `cn` for Chinese)
66+
required: required
67+
type: list
68+
default: ['us', 'cn']
69+
show_on_map:
70+
description: whether to show a marker on the map at the specified location
71+
required: optional
72+
type: boolean
73+
default: true
74+
scan_interval:
75+
description: the rate at which AirVisual should be polled for new data
76+
required: optional
77+
type: int
78+
default: 600
79+
latitude:
80+
description: the latitude of the location to monitor
81+
required: optional
82+
type: str
83+
default: the latitude defined under the `homeassistant` key in `configuration.yaml`
84+
longitude:
85+
description: the longitude of the location to monitor
86+
required: optional
87+
type: str
88+
default: the longitude defined under the `homeassistant` key in `configuration.yaml`
89+
city:
90+
description: the city to monitor
91+
required: optional
92+
type: str
93+
state:
94+
description: the state the city belongs to
95+
required: optional
96+
type: str
97+
country:
98+
description: the country the state belongs to
99+
required: optional
100+
type: str
101+
{% endconfiguration %}
102+
103+
## {% linkable_title Determining the City/State/Country %}
93104

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

100111
For example, Sao Paulo, Brazil shows a breadcrumb title of
@@ -120,8 +131,8 @@ air quality standard:
120131

121132
### Air Quality Index
122133

123-
**Description:** This sensor displays a numeric air quality index (AQI), a metric
124-
for the overall "health" of the air.
134+
**Description:** This sensor displays a numeric air quality index (AQI), a
135+
metric for the overall "health" of the air.
125136

126137
**Example Sensor Name:** `sensor.chinese_air_quality_index`
127138

0 commit comments

Comments
 (0)