Air Quality Index in Melbourne is 28 the dominant pollutant is pm25
This commit is contained in:
parent
31bfbefa91
commit
dff57a346b
2 changed files with 23 additions and 2 deletions
10
README.org
10
README.org
|
@ -20,10 +20,16 @@ To access the WAQI project API it’s necessary to register at http://aqicn.org/
|
||||||
aqi-use-cache t)
|
aqi-use-cache t)
|
||||||
#+END_SRC
|
#+END_SRC
|
||||||
|
|
||||||
The simplest way to view AQI info is with =M-x aqi-report= which displays air quality info for your algorithmically derived location (equivalent to the location ="here"=) or the name of a place. A place can be the name of a city (in which case the nearest monitoring station is used) or the name of specific monitoring station.
|
The simplest way to view AQI info is with =M-x aqi-report= which displays air quality info for your algorithmically derived location (equivalent to the location "here") or the name of a place. A place can be the name of a city (in which case the nearest monitoring station is used) or the id of specific monitoring station.
|
||||||
|
|
||||||
|
By name…
|
||||||
#+BEGIN_SRC emacs-lisp
|
#+BEGIN_SRC emacs-lisp
|
||||||
(aqi-report "Taipei")
|
(aqi-report "Ulaanbaatar")
|
||||||
|
#+END_SRC
|
||||||
|
|
||||||
|
By id…
|
||||||
|
#+BEGIN_SRC emacs-lisp
|
||||||
|
(aqi-report "@7397")
|
||||||
#+END_SRC
|
#+END_SRC
|
||||||
|
|
||||||
A detailed report is displayed by default and a single line summary can be provided by using the keyword ='brief=
|
A detailed report is displayed by default and a single line summary can be provided by using the keyword ='brief=
|
||||||
|
|
15
aqi.el
15
aqi.el
|
@ -158,6 +158,21 @@
|
||||||
(aqi--city-cache-get city)
|
(aqi--city-cache-get city)
|
||||||
(aqi-request city)))
|
(aqi-request city)))
|
||||||
|
|
||||||
|
(defun aqi-search (name)
|
||||||
|
"Search for the nearest stations (if any) matching a given NAME."
|
||||||
|
(request
|
||||||
|
(format "https://api.waqi.info/search/?keyword=%s&" name)
|
||||||
|
:sync t
|
||||||
|
:params `(("token" . ,aqi-api-key))
|
||||||
|
:parser 'json-read
|
||||||
|
:success (cl-function
|
||||||
|
(lambda (&key data &allow-other-keys)
|
||||||
|
(pcase (assoc-default 'status data)
|
||||||
|
("ok" (message "Search: %s" (assoc-default 'data data)))
|
||||||
|
("error" (message "Search error: %s" (assoc-default 'data data))))))
|
||||||
|
:error (cl-function
|
||||||
|
(lambda (&rest args &key error-thrown &allow-other-keys)
|
||||||
|
(message "WAQI error: %s" error-thrown)))))
|
||||||
|
|
||||||
;; printing, formatting and presenting.
|
;; printing, formatting and presenting.
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue