Coder Social home page Coder Social logo

mmm-airquality's Introduction

Maintainability Rating Reliability Rating Security Rating Bugs All Contributors License

MMM-AirQuality

A module for the MagicMirror to display a location's air quality index using data from aqicn.org.

Preview

preview

with header and location

preview

without any header

preview

Usage

You need to install and configure the module for your MagicMirror.

Setup

Clone the module into your modules folder:

cd ~/MagicMirror/modules && git clone https://github.com/CFenner/MMM-AirQuality

Configuration

Add the module configuration to your config.js file.

{
  module: 'MMM-AirQuality',
  position: 'top_center',
  config: {
    token: 'ADD_YOUR_TOKEN_HERE',
    location: 'germany/hamburg/sternschanze/' // the location to check the index for
  }
},

Token

To use the WAQI API you need to request a token.

Location

Determine the station you want to display by selecting a station on the map.

Using Station Names

If the selected station is a named station, e.g. http://aqicn.org/city/netherland/utrecht/griftpark/ use the name from the URL in your location variable. For the given example this would be netherland/utrecht/griftpark/.

Third-Party Sensors

If your station is affiliated with a third-party air sensor network, such as the uRad Monitor air quality sensor network, you are required to specify the station identifier (e.g., A129586) in your location variable. For the station https://aqicn.org/station/@63628/ this would be A63628, so just replace the @ with an A. Please verify data retrieval by visiting https://api.waqi.info/feed/<provide station Id>/?token=<provide your token>.

Using GPS Coordinates

You may also get the data for specific longitude and latitude. Set the location to geo:lat;lng/ and replace lat and lng with your values.

Further Options

You may want to set the following options in the config section as well:

Option Description Default Required
location The location for that you you want to show the air quality. x
lang change the language en
updateInterval change the update period in minutes 30
showLocation toggle location printing true
appendLocationNameToHeader If set to true, the returned location name will be appended to the header of the module. true
showIndex toggle index printing true

Known Issues

Contributors ✨

Thanks goes to these wonderful people (emoji key):

Justin Cherniak
Justin Cherniak

💻
Bogdan Mihai Nicolae
Bogdan Mihai Nicolae

📖

This project follows the all-contributors specification. Contributions of any kind welcome!

mmm-airquality's People

Contributors

allcontributors[bot] avatar bogminic avatar cfenner avatar pimagical avatar renovate[bot] avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

mmm-airquality's Issues

Dependency Dashboard

This issue lists Renovate updates and detected dependencies. Read the Dependency Dashboard docs to learn more.

Open

These updates have all been created already. Click a checkbox below to force a retry/rebase of any.

Detected dependencies

github-actions
.github/workflows/validation.yml
  • actions/checkout v4
  • actions/setup-node v4
  • actions/checkout v4
  • nosborn/github-action-markdown-cli v3.3.0
  • actions/checkout v4
  • actions/setup-node v4
npm
package.json
  • eslint 8.57.0
  • eslint-config-standard 17.1.0
  • markdownlint 0.34.0
  • markdownlint-cli 0.41.0

  • Check this box to trigger a request for Renovate to run again on this repository

UnhandledPromiseRejectionWarning

Just updated MM to version 2.27.0, and discovered MMM-AirQuality no longer loads (data is stuck on Loading.....)

Running PM2 Log gives the below error trace

0|mm | [2024-04-19 12:28:11.472] [ERROR] (node:1100) UnhandledPromiseRejectionWarning: TypeError: fetch failed
0|mm | at Object.fetch (node:internal/deps/undici/undici:12293:11)
0|mm | at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
0|mm | at async Class.loadData (/home/mirror/MagicMirror/modules/MMM-AirQuality/helper.js:21:20)
0|mm | (Use electron --trace-warnings ... to show where the warning was created)
0|mm | [2024-04-19 12:28:11.477] [ERROR] (node:1100) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag --unhandled-rejections=strict (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)

Translation not working

Seems that Language Translation service has been moved to: http://waqi.info/translate/#/

I see Catalan language its supported (ca) but not working in the module (I thing you should change something in the code to make it working, right?)

thanks

after update modules doesn't start

I did update, but since than the module doesn't show up. I run "npm install" but it finish with warns:

pi@raspberrypi:~/MagicMirror/modules/airquality $ git pull
Updating d3897d4..a0f1ce4
Fast-forward
 airquality.js => MMM-AirQuality.js |  2 +-
 README.md                          | 22 ++++++++++++++++++----
 2 files changed, 19 insertions(+), 5 deletions(-)
 rename airquality.js => MMM-AirQuality.js (98%)
pi@raspberrypi:~/MagicMirror/modules/airquality $ npm install
npm WARN enoent ENOENT: no such file or directory, open '/home/pi/MagicMirror/modules/package.json'
npm WARN enoent ENOENT: no such file or directory, open '/home/pi/MagicMirror/modules/node_modules/node_helper/package.json'
npm WARN modules No description
npm WARN modules No repository field.
npm WARN modules No README data
npm WARN modules No license field.

So I had to restore previous version. Any idea?
Thanks, Zdeněk

module stuck at loading after update

updated to the latest version of both MagicMirror and this module and the module no longer loads.

reverted back to the prior versions and it loaded successfully.

did a fresh install of both MagicMirror and MMM-AirQuality and still does not load.

use mirror language setting

In the config, the language is already defined. The module should reuse this if not defined on module level.

MagicMirror won't start

When i add this module the MagicMirror won't start and the screen stays black.

Tried this module with the default example location "Beijing".

lang: 'cs' doesn't work for me

Hi
this is my config.js

		{
			module: 'airquality',
			position: 'bottom_left', // the location where the module should be displayed
			config: {
				lang: 'cs', 
			        location: 'czechrepublic/liberecky/liberec-rochlice' // aqicn.org
				}
		},

but still have in in english. Do I need to add definitions to traslations/cs.json ? If yes, where is possible to get full list of possibilities?

btw, is there way, how to make the modules smaller and hwo to use colours based on condition?

thanks, Zdeněk

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.