Git Product home page Git Product logo

worlds-air-quality-index-widget-api's Introduction

worlds-air-quality-index-widget-api

A Home Assistant custom Fronted for World's Air Quality Index widget API (waqi.info).

Widget

Fronted supports widget described in this link: https://aqicn.org/faq/2015-07-28/air-quality-widget-new-improved-feed/en/

To add it into Lovelace dashoard, you need to select:

  • add card,
  • Manual (Need to add a custom card or just want to manually write the YAML?)
  • And put below example code in Card configuration popup
city:
  - london
lang: en
display: <center>%details</center>
type: custom:worlds-air-quality-index-widget-api

City parameter determines station, you can put simple name of city such as london, or you can put full name of your specified station:

city:
  - united-kingdom/london-bloomsbury/
lang: en
display: <center>%details</center>
type: custom:worlds-air-quality-index-widget-api

To get your station city text, you need to find it on waqi.info website map, and click on it. You will be moved to aqicn.org website to your specific station details. In the URL of the browser you will find name of the station. You need to copy it and paste to the Manual card configuration as a city parameter

URL text

Lang parameter allows to set language of the widget. Supported languages are predefined by waqi.info, below is the list of all supported languages:

  • "en": English
  • "cn": Chinese
  • "jp": Japanese
  • "es": Spanish
  • "kr": Korean
  • "ru": Russian
  • "hk": Traditional Chinese
  • "fr": French
  • "pl": Polish
  • "de": German
  • "pt": Portuguese
  • "vn": Vietnamese
  • "it": Italian
  • "id": Indonesian
  • "nl": Dutch
  • "fa": Persian
  • "th": Thai
  • "hu": Hungarian
  • "el": Greek
  • "ro": Romanian
  • "bg": Bulgarian
  • "ur": Urdu
  • "hi": Hindi
  • "ar": Arabic
  • "sr": Serbian
  • "bn": Bangla
  • "hu": Hungarian
  • "bs": Bosnian
  • "hr": Croatian

Display determines method of widget printing, and it affects appearance of the widget. It is a HTML-based string, and can contain any of the following keywords:

  • %cityname for the name of the city (eg Beijing),
  • %aqi for the decorated AQI value (eg 58),
  • %aqiv for the undecorated (raw text) AQI value (eg 58),
  • %style for the css declaration of the decorated AQI details (eg background-color: #ffde33;color:#000000;),
  • %date for the time at which the AQI was updated (eg Wed 20:00),
  • %impact for the associated health impact (eg Good, Moderate...)
  • %attribution for the AQI data attribution ( eg Beijing Environmental Protection Monitoring Center)
  • %details for the full AQI details (the content of the popup displayed when moving the mouse over the AQI value).

For examples of the usage you can go to this link: https://aqicn.org/faq/2015-07-28/air-quality-widget-new-improved-feed/en/

worlds-air-quality-index-widget-api's People

Contributors

pawkakol1 avatar

Stargazers

 avatar

Watchers

 avatar

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.