raiguard / ModernGadgets

Sleek, minimalist, information-dense gadgets for the modern desktop. Inspired by the AddGadgets.com system monitoring gadgets. Built on the Rainmeter platform.
MIT License
300 stars 32 forks source link

Update Weather Meter to use Dark Sky API #190

Closed raiguard closed 4 years ago

raiguard commented 4 years ago

I had planned on doing this eventually, whether or not IBM decided to kill wxdata. But now that wxdata has gone down again, quite possibly forever, I think now is the time.

Weather Meter will be switched to using the Dark Sky API. For now, I am simply going to convert the existing gadget over to Dark Sky, so people can keep using it. However, once that is out, I will be rewriting Weather Meter to better take advantage of Dark Sky's features.

To-do

raiguard commented 4 years ago

image

Well... that only took a few hours! Everything works except for severe weather alerts, which aren't able to be parsed due to what I think is a bug in JsonParser.

I'm just going to delete the forecast for now, it's getting completely replaced in v1.7 anyway and I don't feel like converting it. Sorry to those who actually use it!

Edit: Turns out JsonParser is fine, I'm just stupid. Arrays start at zero, not one. 🤦‍♂

sdholden commented 4 years ago

Not working here, after replacing the appropriate files.

image

sdholden commented 4 years ago

Oh, and I put my key in and updated the lat/long for my location. Putting the key and lat/long in a browser URL as detailed on the Dark Sky API page works fine...

Partial snip of browser window below image

raiguard commented 4 years ago

You've gotta open the settings file and provide your own API key for Dark Sky. I'll be working on implementing that into the settings skin today, along with a replacement for city lookup.

sdholden commented 4 years ago

Yup did that. And confirmed it works in a browser...

raiguard commented 4 years ago

Ah, I left it in debug mode. Open the skin file and scroll to line 100. Uncomment that line and comment the line above it. Then it should work.

raiguard commented 4 years ago

Also you'll have to manually install the JsonParser plugin.

sdholden commented 4 years ago

Bingo!

Only Imperial at the moment, as I can't select Imperial/Metric now (see earlier screenshot) as the Location filed is partially on top of the Units line...

Will find the entry in the .ini and change manually for now....

sdholden commented 4 years ago

Isn't immediately obvious how to force metric in the config files....is there an easy way?

raiguard commented 4 years ago

Yeah, I haven't added support for metric units yet, this is still an early prototype. You can change the units by adding ?units=ca to the end of line 100. Here is the documentation: Screenshot_20200117-102227_Chrome

sdholden commented 4 years ago

Tried that already and it had no effect....tried ?units=auto as well. Always imperial. No worry, it can wait for next update. Thx!

raiguard commented 4 years ago

If you update the files again you should be able to easily change the units by changing the units variable. It defaults to auto, which will set them automatically depending on the location.

sdholden commented 4 years ago

Yup, updating and leaving line 100 units at auto now shows metric here in Toronto!

Great work, thanks again!

raiguard commented 4 years ago

image City search is complete. It's almost ready!

raiguard commented 4 years ago

image And it's done! I'll be releasing a beta tomorrow for widespread testing, but everything should work just fine.

Shrekmachine commented 4 years ago

Awesome

raiguard commented 4 years ago

I decided to just release the full patch instead of a beta, since it's probably fine. Please let me know if any issues come up (which they inevitably will)!

Stephen1R2 commented 4 years ago

I hope you are aware that the way you are useing the API is directly against Dark Sky's TOS? It's right there in the "Use of Service" section. The "Don't direct your users to sign up" part. I like your rainmeter skin and don't want to see it explode.

raiguard commented 4 years ago

I am aware. Unfortunately, there is quite literally no other way to do it with Rainmeter. There is no way to obfuscate the API key, and even if you could, I wouldn't be able to afford the API costs since you can't charge money for skins. Trust me, I've been thinking about this for months and don't see any other way.

Other Rainmeter skins have been using Dark Sky for years without issues, so hopefully the same will hold true here.

Unfortunately, now that wxdata is gone, there is no weather API out there that I'm aware of that doesn't use API keys. So we're either going to have to have users get their own keys, or scrape off of websites (which is significantly less stable and is, IMO, even more dishonest).

raiguard commented 4 years ago

2020-01-20 23_18_39-D__Caleb_Development_Rainmeter_Testbench_Skins_ModernGadgets_WeatherMeter_Weathe Experimenting.

Shrekmachine commented 4 years ago

very(!) promising. I like it much more. The current weather widget is very crowded

Caboose700 commented 4 years ago

Hopefully if this experiment goes though, you would leave the old layout alone as I quite like the extra bit of information that the current layout provides.

raiguard commented 4 years ago

It's not done yet, it'll have all the same information that the original does, and lots more. Just wait until you see the design I'm coming up with for the hourly forecast. :D

sausje commented 4 years ago

Hey,

One small issue I've got with the updated version is that the warning sign in the top left isn't going away.. I've now got flood warnings for the past 2-3 weeks, yet if I click on it, it says no warnings for the area..

raiguard commented 4 years ago

If it's okay with you, could you share what city you have selected? This sounds like a Dark Sky API issue.

sausje commented 4 years ago

Not a problem, that's Valkenburg (Limburg) in the Netherlands.

This is the warning itself: https://i.imgur.com/T1AlTFB.png

raiguard commented 4 years ago

Ok, so I went in and checked, and the Dark Sky API itself is at fault here. You'll just have to sit tight and wait for it to go away. Sorry about that!

sausje commented 4 years ago

Ah no worries, thanks for the quick reply. At least now I know where the issue lies and I'll see if I can notify them about it.