It is currently November 30th, 2022, 7:38 am

Custom weather plugin

Share and get help with Plugins and Addons
Posts: 3
Joined: May 22nd, 2022, 10:38 pm

Custom weather plugin

Post by cperryoh »

Hello, I originally posted this on the Rainmeter subreddit but a commenter told me to come here as it could reach more people that might use it. Anyways, I got Rainmeter a few years back and I have always kind of noticed that every premade skin with weather is using an old and broken API. I decided to spend a few hours writing up a plugin that uses the free API it allows for 60 calls a min and provides substantial information to replace the API in most older skins. There are two ways I have programmed it to be used.

First, you can make a measure for a particular piece of data you want to grab. The ones I have set up so far are temp(or current temp), temp_min, temp_max, humidity, condition, and description. So if I wanted to create a measure that kept track of current temperature and let's say longitude 50 and latitude 50, the measure would look like this.

Code: Select all

key=*your openweather API key here*
#Other options: temp_min, temp_max, humidity, condition, description
It can also be used with a custom function I wrote into the plugin, it includes all the options for data listed above with two others that I will explain later. I made it this way as well for 2 reasons. (1) I figured out that when making a measure for every piece of data you want to access(temp, temp_min, temp_max, etc) it will run a separate instance of the plugin, therefore, making more API calls and possibly temporarily locking you out of the API. I could've solved this by slowing the update of my skin, but that felt a bit hacky. Using the getValue function and dynamic variables makes only one instance but still allows you to access all the data the plugin has access to. (2) I am lazy and one plugin is easier to keep track of. Now as for the other two parameters that this method has access to. They are icon and iconUrl. 'icon' is the icon id for the weather status outside and iconUrl is a URL to that icon hosted by OpenWeatherMap. The icons for OpenWeatherMap icons follow a format of <iconId>2x.png. I added access to both of these so you could have an image sourcing from the web or store the icons locally and access them from the Resources folder. Personally, I could not get dynamic variables working with the web parser plugin, so I could not grab an icon based on the icon URL variable. I opted for downloading all the icons using a google extension from open weather API and accessing them locally using the icon parameter.

Code: Select all

key=*your openweather API key here*

[Meter Current tempature]
FontFace=Segoe UI
Text=The temperature out side is: [weatherApi:getValue(temp)]
#Other options: temp_min, temp_max, humidity, condition, description, icon, iconUrl
I am aware that there are other ways of going about fixing these old skins(like this tutorial), but frankly parsing Jsons and web scraping in Rainmeter does not make sense to me and this, in my opinion, is a much more elegant way of doing the same thing. Although I do not know if anyone has done anything similar to this in the past. I will link the GitHub to the plugin below, it also has a copy of the popular skin Simplic with that was modified to use the plugin. Also, in the resources folder of the skin, all the icons for open weather API are in there. I originally was making this as a side project but I figured to make this post to offer people an alternative to other methods of fixing weather skins. This is in no way polished or documented yet, I made this in the past 2 days so it is still a bit rough around the edges, but it works. I would love to hear what you guys think and maybe features that I could add 🙂 .




Final Product:

Example skin credit:

Wallpaper engine wallpaper:
User avatar
Rainmeter Sage
Posts: 14744
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Custom weather plugin

Post by balala »

Would be an interesting plugin, but where can it be downloaded? The GitHub link (In the Skin line) is broken, clicking it leads to a "This is not the web page you are looking for" message. The skin downloaded from DeviantArt (the Example skin credit line), doesn't contain the plugin. So please post a complete package with and example skin and the plugin.