ryck / MMM-AQI

MagicMirror module to get the Air Quality Index (AQI)
MIT License
11 stars 5 forks source link

MMM-AQI

MMM-AQI is a module for MagicMirror² to display the Air Quality Index (AQI) using the World Air Quality Index project API.

screenshot

Installation

cd ~/MagicMirror/modules
git clone https://github.com/ryck/MMM-AQI

Config

The 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 city
Type: string
Possible values: here for geolocation, nameOfCity or @id
Default value: here
iaqi Display individual AQI for all pollutants (PM2.5, PM10, NO2, CO, SO2, Ozone)
Type: boolean
Possible values: true or false
Default value: true
updateInterval How often the data is updated. (Milliseconds)
Type: integer
Default value: 30 * 60 * 1000 (Half hour)
overrideCityDisplayName Override the city's display name with this value.
Type: string or null
Default 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: integer
Possible values: 1000 - 5000
Default value: 0
animationSpeed Speed of the update animation. (Milliseconds)
Type: integer
Possible values:0 - 5000
Default value: 1000 (1 second)
debug Show debug information.
Type: boolean
Possible 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
            }
        },

Find your city

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.

Thanks To...