3

I've had Conky Tomorrow since January, and the temperatures were shown properly. But as you know Yahoo's Weather API isn't free longer (the forecast wasn't show any more), so I got a (free) key in http://openweathermap.org/. I have all the weather forecast in my city, but the problem is that I'm unable to change the commands to adapt the old Conky script to a new one which shows the forecast.

As I can see, the comands I have to change are:

 ${execi 300 curl -s "CODE OF THE FORECAST IN MY CITY" -o ~/.cache/weather.xml}
 ${font Raleway:size=20}${voffset -40}
 ${goto 16}${execi 300 grep "yweather:condition" ~/.cache/weather.xml | grep -o "temp=\"[^\"]*\"" | grep -o "\"[^\"]*\"" | grep -o "[^\"]*"}°${font Raleway:weight=Light:size=14}${goto 114}${execi 300 grep "yweather:forecast" ~/.cache/weather.xml | grep -o "high=\"[^\"]*\"" | grep -o "\"[^\"]*\"" | grep -o "[^\"]*" | awk 'NR==2'}°${goto 224}${execi 300 grep "yweather:forecast" ~/.cache/weather.xml | grep -o "high=\"[^\"]*\"" | grep -o "\"[^\"]*\"" | grep -o "[^\"]*" | awk 'NR==3'}°${goto 334}${execi 300 grep "yweather:forecast" ~/.cache/weather.xml | grep -o "high=\"[^\"]*\"" | grep -o "\"[^\"]*\"" | grep -o "[^\"]*" | awk 'NR==4'}°${goto 444}${execi 300 grep "yweather:forecast" ~/.cache/weather.xml | grep -o "high=\"[^\"]*\"" | grep -o "\"[^\"]*\"" | grep -o "[^\"]*" | awk 'NR==5'}°

  ${font Raleway:weight=Light:size=10}${goto 150}${execi 300 grep "yweather:forecast" ~/.cache/weather.xml | grep -o "low=\"[^\"]*\"" | grep -o "\"[^\"]*\"" | grep -o "[^\"]*" | awk 'NR==2'}°${goto 260}${execi 300 grep "yweather:forecast" ~/.cache/weather.xml | grep -o "low=\"[^\"]*\"" | grep -o "\"[^\"]*\"" | grep -o "[^\"]*" | awk 'NR==3'}°${goto 370}${execi 300 grep "yweather:forecast" ~/.cache/weather.xml | grep -o "low=\"[^\"]*\"" | grep -o "\"[^\"]*\"" | grep -o "[^\"]*" | awk 'NR==4'}°${goto 480}${execi 300 grep "yweather:forecast" ~/.cache/weather.xml | grep -o "low=\"[^\"]*\"" | grep -o "\"[^\"]*\"" | grep -o "[^\"]*" | awk 'NR==5'}°

And the information (in xml, but it also can be show in json) that I got is

 <forecast>
 <time from="2016-04-16T12:00:00" to="2016-04-16T15:00:00">
 <symbol number="500" name="light rain" var="10d"/>
 <precipitation unit="3h" value="0.11" type="rain"/>
 <windDirection deg="245.51" code="WSW" name="West-southwest"/>
 <windSpeed mps="7.71" name="Moderate breeze"/>
 <temperature unit="celsius" value="16.44" min="16.44" max="16.44"/>
 <pressure unit="hPa" value="990.11"/>
 <humidity value="83" unit="%"/>
 <clouds value="scattered clouds" all="44" unit="%"/>
 </time>
 <time from="2016-04-16T15:00:00" to="2016-04-16T18:00:00">
 <symbol number="802" name="scattered clouds" var="03d"/>
 <precipitation/>
 <windDirection deg="248.5" code="WSW" name="West-southwest"/>
 <windSpeed mps="6.46" name="Moderate breeze"/>
 <temperature unit="celsius" value="14.31" min="14.3" max="14.31"/>
 <pressure unit="hPa" value="990.94"/>
 <humidity value="78" unit="%"/>
 <clouds value="scattered clouds" all="32" unit="%"/>
 </time>

So, anybody knows how to change the Conky comands?

It would be extremely helpful.

Thanks in advance.

2 Answers 2

1

From oct 2015 you must use a url curl command like :

http://api.openweathermap.org/data/2.5/forecast/daily?q=YOURCITY&APPID={APIKEY}&mode=xml&units=metric&cnt=5&lang=xx

Where:

  • xx is your language: en, es, etcetera.
  • The ApiKey can be obteined signing up.
  • The YOURCITY variable is the name of your city. It's better to use your CityID.

More info about API at : OpenWeather

Finally, you must change all the variables names obteined with curl to read all the weather conditions.

List of all variables can see at API Openweather XML output

You can see an example at: Conky Gnow. Click on Download link, unzip the file and take a look into .conkyrc file.

5
  • Thanks for answering. The point is that I've got the key and the forecast in my city in JSON and XLM. My problem is that I don't know who to change the Conky conf in order to real the xml/json file properly. The one I showed worked with the Yahoo API.
    – Minkowski
    Commented Apr 16, 2016 at 17:26
  • @Minkowski you must change all the variables names. I've edited my answer to add an example.
    – bitseater
    Commented Apr 17, 2016 at 7:25
  • "change all variables names": where are they? where is the provided example? please, add more details
    – user170
    Commented Apr 25, 2016 at 15:19
  • 1
    @cipricus I edited the answer to more information.
    – bitseater
    Commented Apr 25, 2016 at 16:16
  • for reference: a similar conky (Visions) was updated to fit the change to OpenWeather.
    – user170
    Commented Apr 27, 2016 at 5:27
-1

I finally got Conky Harmattan. Its author has adapted to OpenWeatherMap. It works perfectly.

2
  • You didn't say how you got it, which would be useful to future visitors.
    – RolandiXor
    Commented Apr 18, 2016 at 20:52
  • Let's see. I finally wasn't able to fix my conky file. I just downloaded Conky Harmattan from zagortenay333.deviantart.com/art/Conky-Harmattan-426662366 and followed the steps. But I repeat, I didn't achieve my target.
    – Minkowski
    Commented Apr 22, 2016 at 15:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.