Skip to content
MagicMirror module to get the Air Quality Index (AQI)
JavaScript CSS
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
screenshots Add screenshot & update README Feb 8, 2018
.gitignore Ignore files Feb 7, 2018
LICENSE Initial commit Feb 7, 2018
MMM-AQI.css 🐛 Fix header issue Apr 28, 2019
MMM-AQI.js 🐛 Fix header issue Apr 28, 2019
README.md Formatting and README changes Mar 11, 2018
node_helper.js Small fixes Feb 8, 2018
package-lock.json 🐛 Fix header issue Apr 28, 2019
package.json 🐛 Fix header issue Apr 28, 2019

README.md

MMM-AQI

This a module for the MagicMirror.

MagigMirror module to get the Air Quality Index (AQI) using the World Air Quality Index project API.

Installation

git clone https://github.com/ryck/MMM-AQI.git
cd MMM-AQI
npm install

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)
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 you city

The API is quite picky with the cities, so yoiur 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.

Dependencies

  • request (installed via npm install)

Thanks To...

You can’t perform that action at this time.