MMM-AQI is a module for MagicMirror² to display the Air Quality Index (AQI) using the World Air Quality Index project API.
cd ~/MagicMirror/modules
git clone https://github.com/ryck/MMM-AQIThe entry in config.js can include the following options:
| Option | Description |
|---|---|
token |
Required Your private API token (see aqicn.org/data-platform/token/) Type: string |
city |
Required Name of the city (eg Beijing), or id (eg @7397). You can also use the keyword here to use geolocation to get your cityType: stringPossible values: here for geolocation, nameOfCity or @idDefault value: here |
iaqi |
Display individual AQI for all pollutants (PM2.5, PM10, NO2, CO, SO2, Ozone) Type: booleanPossible values: true or falseDefault value: true |
updateInterval |
How often the data is updated. (Milliseconds) Type: integerDefault value: 30 * 60 * 1000 (Half hour) |
overrideCityDisplayName |
Override the city's display name with this value. Type: string or nullDefault value: null |
initialLoadDelay |
The initial delay before loading. If you have multiple modules that use the same API key, you might want to delay one of the requests. (Milliseconds) Type: integerPossible values: 1000 - 5000 Default value: 0 |
animationSpeed |
Speed of the update animation. (Milliseconds) Type: integerPossible values: 0 - 5000 Default value: 1000 (1 second) |
debug |
Show debug information. Type: booleanPossible values: true or false Default value: false |
Here is an example of an entry in config.js
{
module: 'MMM-AQI',
position: 'bottom_left',
header: 'Air Quality Index (AQI)',
config: {
token: "",
city: "here",
iaqi: true,
updateInterval: 30 * 60 * 1000, // Every half hour.
initialLoadDelay: 0,
animationSpeed: 1000,
debug: false
}
},The API is quite picky with the cities, so your best option is to use the keyword here or an id. To find your id, just enter this URL in your browser:
https://api.waqi.info/search/?token=TOKEN&keyword=CITY
Note: You need to replace TOKEN and CITY for your token (the same one you are using in the module works) and the city you are looking for, repectively.
- The World Air Quality Index project for providing the API.
- Nick Wootton for the MMM-UKLiveBusStopInfo module, which I used as reference.
- Nigel Daniels for the MMM-Tube-Status module, which I used as reference.
- Michael Teeuw for the MagicMirror² framework that made this module possible.
- Transport for London for the guides and information they publish on their API.