[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [O] org-weather for openweathermap.org
From: |
Thorsten Jolitz |
Subject: |
Re: [O] org-weather for openweathermap.org |
Date: |
Sat, 14 Jun 2014 16:02:47 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux) |
Chris Raschl <address@hidden> writes:
> Hi everybody,
>
> recently I wanted to add a weather forecast to my org-agenda. I found
> org-google-weather, but this package is obsolete since 2012, because the
> API is not available any more. So I wrote my own version which is backed
> by the openweathermap.org API.
>
> I implemented the minimal usecase which works for me, if somebody else
> dares to use it, its available here:
>
> https://github.com/kautsig/org-weather
Nice, thank you, never made org-google-weather, but this works
out-of-the-box:
,-------------------------------------------------
| City: Weather: light rain, 10.43°C - 17.58°C
`-------------------------------------------------
A few suggestions wrt
,--------------------------------------------------------------------------
| (defun org-weather-add-to-cache (item)
| "Adds the one result 'list' item to the data cache"
| (let* ((timestr (cdr (assoc 'dt item)))
| (cache-key (format-time-string "%F" (seconds-to-time timestr)))
| (weather (cdr (assoc 'weather item)))
| (temperature (cdr (assoc 'temp item)))
| (temp-min (number-to-string (org-weather-temp-min temperature)))
| (temp-max (number-to-string (org-weather-temp-max temperature)))
| (data (concat (org-weather-description weather) ", "
| temp-min org-weather-unit " - " temp-max org-weather-unit)))
| (puthash cache-key data org-weather-data)))
`--------------------------------------------------------------------------
- why not use (round ...) for the temperature data, 10-17°C would be
more than accurate enough?
- why not include city/country info in the weather string? I added
* Weather
:PROPERTIES:
:CATEGORY: City
:END:
%%(org-weather)
to get the above, but it would be much better to take the return
values for city/country and include them in the weather string, to
make sure one did not mess up the configuration and gets the weather
from another place than expected.
- maybe make the whole thing a bit customizable by adding a few
defcustoms, so the user can decide which info he wants to print in the
agenda
the return string looks like this, there are many options:
,-------------------------------------------------------------------------
| Contacting host: api.openweathermap.org:80 ((list . [((rain . 0.5)
| (clouds . 92) (deg . 353) (speed . 4.41) (weather . [((icon . 10d)
| (description . light rain) (main . Rain) (id . 500))]) (humidity . 88)
| (pressure . 1023.69) (temp (morn . 18.53) (eve . 17.32) (night . 11.63)
| (max . 19.01) (min . 11.63) (day . 18.53)) (dt . 1402743600)) ((clouds
| . 68) (deg . 334) (speed . 2.97) (weather . [((icon . 04d) (description
| . broken clouds) (main . Clouds) (id . 803))]) (humidity . 75) (pressure
| . 1027.85) (temp (morn . 15.35) (eve . 18.45) (night . 9.04) (max
| . 19.62) (min . 9.04) (day . 19.62)) (dt . 1402830000)) ((rain . 0.5)
| (clouds . 80) (deg . 264) (speed . 3.46) (weather . [((icon . 10d)
| (description . light rain) (main . Rain) (id . 500))]) (humidity . 75)
| (pressure . 1024.55) (temp (morn . 14.54) (eve . 16.83) (night . 14.58)
| (max . 19.07) (min . 14.54) (day . 19.07)) (dt . 1402916400)) ((clouds
| . 0) (deg . 248) (speed . 2.25) (weather . [((icon . 01d) (description
| . sky is clear) (main . Clear) (id . 800))]) (humidity . 88) (pressure
| . 1024.46) (temp (morn . 14.99) (eve . 17.74) (night . 9.9) (max
| . 20.82) (min . 9.9) (day . 20.82)) (dt . 1403002800)) ((clouds . 76)
| (deg . 261) (speed . 6.56) (weather . [((icon . 04d) (description
| . broken clouds) (main . Clouds) (id . 803))]) (humidity . 78) (pressure
| . 1024.87) (temp (morn . 14.25) (eve . 19.07) (night . 14.95) (max
| . 19.37) (min . 14.25) (day . 18.81)) (dt . 1403089200)) ((rain . 4.45)
| (clouds . 35) (deg . 288) (speed . 6.29) (weather . [((icon . 10d)
| (description . moderate rain) (main . Rain) (id . 501))]) (humidity . 0)
| (pressure . 1016.64) (temp (morn . 15.26) (eve . 18.07) (night . 13.78)
| (max . 19.68) (min . 13.78) (day . 19.68)) (dt . 1403175600)) ((rain
| . 1.34) (clouds . 36) (deg . 289) (speed . 5.59) (weather . [((icon
| . 10d) (description . light rain) (main . Rain) (id . 500))]) (humidity
| . 0) (pressure . 1016.73) (temp (morn . 15.05) (eve . 18.08) (night
| . 15.57) (max . 18.86) (min . 15.05) (day . 18.86)) (dt . 1403262000))])
| (cnt . 7) (city (sys (population . 0)) (population . 0) [...]
`-------------------------------------------------------------------------
--
cheers,
Thorsten
- [O] org-weather for openweathermap.org, Chris Raschl, 2014/06/14
- Re: [O] org-weather for openweathermap.org, Fletcher Charest, 2014/06/14
- Re: [O] org-weather for openweathermap.org,
Thorsten Jolitz <=
- Re: [O] org-weather for openweathermap.org, Chris Raschl, 2014/06/15
- Re: [O] org-weather for openweathermap.org, Thorsten Jolitz, 2014/06/15
- Re: [O] org-weather for openweathermap.org, Ian Barton, 2014/06/16
- Re: [O] org-weather for openweathermap.org, Thorsten Jolitz, 2014/06/16
- Re: [O] org-weather for openweathermap.org, Ian Barton, 2014/06/16
- Re: [O] org-weather for openweathermap.org, Thorsten Jolitz, 2014/06/17
- Re: [O] org-weather for openweathermap.org, Thorsten Jolitz, 2014/06/16
Re: [O] org-weather for openweathermap.org, Rüdiger Sonderfeld, 2014/06/16