I fixed Apple's broken Weather Dashboard Widget

Wowfunhappy

macrumors member
Original poster
Mar 12, 2019
88
79
The Weather dashboard widget that ships with Mac OS X 10.4 – 10.14 broke in 2019, when the APIs it uses went offline. Luckily, the widget is all just editable Javascript code, so I rewrote a portion of the code to use the freely-accessible DarkSky and MapQuest APIs.

Edit: The irony is off the charts. If you don't already have a DarkSky account, you can't use this widget, because Apple purchased DarkSky and shut down their API for new users. So basically, Apple ruins everything, apparently.

I will eventually switch this over to a different API—I use this widget personally, so I kind of have to. But it might not happen until DarkSky's API is shut down for good some time next year.

If you know of a free weather API which works worldwide, offers a six day forecast, and has pleasant (!) json output, please let me know.

Edit 2: I found a different API and stuff is happening. It helps that I'm stuck at home because of the Coronavirus. Watch this space. :)

Here's my modified widget. It requires a small amount of setup:
  1. Download and extract the attached file.
  2. Right click Weather.wdgt and select Show Package Contents.
  3. Open the file weatherParser.js in a text editor.
  4. Make accounts at DarkSky and MapQuest to get API keys for each service.
  5. Paste your API keys into the quotes at the top of the file you opened. When you're done, the beginning of the file should look something like this:
    Code:
    // https://darksky.net/dev
    var darkSkyApiKey = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
    
    // https://developer.mapquest.com/user/me/plan
    var mapQuestApiKey = "yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy"
    
    // For OS X 10.8 and older, only. If unsure, leave this empty.
    var proxyAddress = ""
    
    
    
    //-------------------------------------------------------------------------------------
  6. Go ahead install the modified widget, either by double-clicking Weather.wdgt (recommended), or by replacing Apple's original version in /Library/Widgets/ (if having two copies on your machine would offend your sensibilities).
Possible weather conditions in this version are clear, partly cloudy, rain, snow, rain & snow, flurries, wind, fog, lightning, and freezing rain. This leaves out a few that were in the original (haze, sun-shower, etc.), but the DarkSky API doesn't offer such granularity. This mod would not have been possible without the DarkSky API, so please consider buying one of DarkSky's mobile apps to reward their work.

This widget is compatible with OS X 10.9 "Mavericks" – 10.14 "Mojave". If you're on 10.8 and below and have access to a web server, follow these instructions to get the widget working.

Please post if you encounter problems, notice something wrong, or just find something that could improved.
 

Attachments

Last edited:

blikum

macrumors newbie
Dec 20, 2006
13
2
So far, so good. I made the background images transparent, I like the way it looks better. Once again thank you, thank you, thank you for all of the great work!

Screen Shot 2020-03-06 at 11.58.18 AM.jpg
 
  • Like
Reactions: Digger148

Stephen.R

macrumors 68020
Nov 2, 2018
2,073
2,160
Thailand
It's been a while since I used a Dashboard widget, but might I suggest that the credentials required for the APIs could be entered on the 'back' of the widget, where you enter your preferred location?
 

Wowfunhappy

macrumors member
Original poster
Mar 12, 2019
88
79
It's been a while since I used a Dashboard widget, but might I suggest that the credentials required for the APIs could be entered on the 'back' of the widget, where you enter your preferred location?
I thought about it. The primary issue is that including a dialog for the API key inside the UI would pretty clearly violate DarkSky's rules. By contrast, I figure there's nothing to stop me from essentially distributing source code and providing instructions on how to finish it.

I also had some design concerns about putting too many fields on the back. I didn't want to ruin Apple's design, and as-is, I fretted for a long time about how to position the DarkSky logo.
 
Last edited:

Wowfunhappy

macrumors member
Original poster
Mar 12, 2019
88
79
Oh, phew, the widget isn't broken, you’re just having trouble obtaining a key.

Can you do as they say, and try generating a key again later? Maybe they're having a server blip.
 
Last edited:

blikum

macrumors newbie
Dec 20, 2006
13
2
Seems to work fine for me, but it doesn't seem to update. Mine still says 55 and sunny outside, but it's night time and in the 30's.
 

Wowfunhappy

macrumors member
Original poster
Mar 12, 2019
88
79
Seems to work fine for me, but it doesn't seem to update. Mine still says 55 and sunny outside, but it's night time and in the 30's.
That's not good! If you search for "Weather" in the console, do any Javascript errors come up?

What happens if you reload the widget? (make sure the widget is in focus and then cmd+r)
 

blikum

macrumors newbie
Dec 20, 2006
13
2
That's not good! If you search for "Weather" in the console, do any Javascript errors come up?

What happens if you reload the widget? (make sure the widget is in focus and then cmd+r)
No errors in console. When I refresh it does fetch the current conditions. It just seems like it's not refeshing on it's own.
 

Wowfunhappy

macrumors member
Original poster
Mar 12, 2019
88
79
Can you try changing... anything possible about the machine you use to get the keys? Different browser, different device, different network, different physical location, etc.

You'll only ever have to do this once.

No errors in console. When I refresh it does fetch the current conditions. It just seems like it's not refeshing on it's own.
Okay, so presumably the function startFetchDataTimer() isn't running. You're in Wake Forest, NC, right? Going to see if I can reproduce the problem with that location.
 

blikum

macrumors newbie
Dec 20, 2006
13
2
Can you try changing... anything possible about the machine you use to get the keys? Different browser, different device, different network, different physical location, etc.

You'll only ever have to do this once.



Okay, so presumably the function startFetchDataTimer() isn't running. You're in Wake Forest, NC, right? Going to see if I can reproduce the problem with that location.
Yes, Wake Forest, NC. Thanks for helping.
 

Wowfunhappy

macrumors member
Original poster
Mar 12, 2019
88
79
Sigh, so now another user is also having issues getting a MapQuest key. Then I did a small amount of Googling, and it looks like lots of people are having this problem:


The issues appear to have (quite coincidentally) begun yesterday. Unfortunate, but presumably they'll fix it, let's just wait a bit.

If anyone knows of a better Geocoding API, please feel free to suggest it.
 

Wowfunhappy

macrumors member
Original poster
Mar 12, 2019
88
79
Yes, Wake Forest, NC. Thanks for helping.
Huh, that location is updating for me.

There's no reason this should do anything whatsoever, but just before I go crazy—can you try restoring the original weather widget without your transparency changes, to make sure the problem still happens?

Also, what OS are you running?
 
Last edited:

blikum

macrumors newbie
Dec 20, 2006
13
2
You know what? It's working for me too now. When I got up today, it was the same temp as last night, it didn't update. I'm on 10.10.5 I'll keep an eye on it and let you know what happens.
 

Wowfunhappy

macrumors member
Original poster
Mar 12, 2019
88
79
Because MapQuest is currently having problems, please send me a PM if you need a MapQuest key. Please note:
  1. Everyone who PM's me will get the same key. Please don't abuse the key by using it elsewhere. I will need to revoke the key if usage is too high.
  2. Regardless of usage, I will revoke this key as soon as I get hear that MapQuest has fixed their problems. At this time, you will need to go through the process to acquire and add your own key, or else the widget will stop working when you next change your location.
Thanks!

Sounds like this is fixed now!
 
Last edited:

Mr_Brightside_@

macrumors 68040
Sep 23, 2005
3,189
1,268
Toronto
I was having some issues with the widget on High Sierra, but a killall Dock in a Terminal cleared them up!
No issues with my MQ API key.
 

maxx1

macrumors newbie
Mar 7, 2020
3
0
Because MapQuest is currently having problems, please send me a PM if you need a MapQuest key. Please note:
  1. Everyone who PM's me will get the same key. Please don't abuse the key by using it elsewhere. I will need to revoke the key if usage is too high.
  2. Regardless of usage, I will revoke this key as soon as I get hear that MapQuest has fixed their problems. At this time, you will need to go through the process to acquire and add your own key, or else the widget will stop working when you next change your location.
Thanks!
Can you share the MapQuest key in a public message?
Thank you!
 

Erehy Dobon

macrumors 6502a
Feb 16, 2018
789
660
As of 8am PDT today Sunday 8 March 2020, the Mapquest developer site was generating API keys normally.

I generated mine and edited the JS parser file per the instructions.

The widget works great here in California.

Thanks to Wowfunhappy for his hard work!
 

Wowfunhappy

macrumors member
Original poster
Mar 12, 2019
88
79
Thats for catalina too?
No, sorry! This is just a modified dashboard widget that will keep receiving new weather information now that the original servers have gone down. You still need to be running an operating system that has the dashboard, aka 10.4 – 10.14. In Catalina, the dashboard is completely gone! :(
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.