Smart Weather

Posted in Weather by enochou 205 days ago


No need to enter your location or edit the code; it will use your public IP address to determine your approximate location and pull weather data (in celsius) from openweathermap.org. This dynamic location capability is extremely useful if you travel a lot.

I've separated the code into 4 different geeklets so you can format the 4 elements independently:

  1. Current temperature and weather condition
  2. Daily low and high temperature
  3. Sunrise and sunset times
  4. Current city and country


23°C, scattered clouds
-1°C, clear skies

Displaying and Editing Location

You can check the city and country that is being used (based on your public IP) by running the "citycountry.glet" geeklet. If the city/country displayed is not accurate, go into the code for any of the weather geeklets attached and look for the following two lines:


and manually replace them with numbers pertaining to your longitude and latitude. For example:



Please set the shell's refresh rate to more than 2 minutes. Reasoning: the code is using my personal API key to access data from openweathermap.org. The limit for my personal API key is 60 queries per minute. So if too many people use this code and more than 60 queries occur per minute, some people will experience denial-of-service errors.


User Avatar
cbombeck 167 days ago
Great Geeklet! How would I convert to Fahrenheit?
User Avatar
jaco 166 days ago
This worked for me:

In the following line of the script,


Replace "metric" with "imperial".

Then on the bottom line, replace °C with °F
User Avatar
cbombeck 166 days ago
Thanks Jaco! Worked great
User Avatar
mlance 115 days ago
Hi! thanks for posting this! Is there any way to incorporate a extended 3 or 4 day forecast?
User Avatar
bill1956 55 days ago
This works great! Thanks! I would like to incorporate the weather icons (Apple uses in the notification sidebar would be great). Can you provide geeklets which would "pull" the weather icons based on the weather description.
User Avatar
lhempsworth 52 days ago
Thank you enochou! It works great.
User Avatar
kdavies 25 days ago
This worked great for a day. But today it doesn't seem to pull anything. I thought it might be so many people using your API key, but after several hours, it still won't pull anything. I love the concept, though.
User Avatar
FastByte123 8 days ago
Hey, enochou works grate and thanks for hosting.

Would it be hard to add the IP address's Region (ie. Province/State) to the citycountry.glet?

Log in to comment or register here.