It is currently September 24th, 2021, 3:50 pm

OpenWeatherMap skin (WIP)

Weather skins
mak_kawa
Posts: 908
Joined: December 30th, 2015, 9:47 am

OpenWeatherMap skin (WIP)

Post by mak_kawa »

My first post to this "Share Your Creations" board. And I had never made .rmskin file until this time. So, sorry if it doesn't work.
Image1.jpg
This weather skin is inspired and modified from CyberTheWorm's OpenWeather skin (March, 2017). Thanks, CyberTheWorm.

Yes, I know that the OpenWeatherMap.org with free account is less powerfull than Weather.com. But it is an important alternative source of weather feed for Rainmeter, I think.

Todo List:
NumOfDecimals in temparature meter doesn't work... why? :-)
Precipitation value not obtained because of my poor ability in RegExp.
You do not have the required permissions to view the files attached to this post.
Last edited by mak_kawa on June 7th, 2017, 8:58 am, edited 4 times in total.
User avatar
CyberTheWorm
Posts: 792
Joined: August 22nd, 2016, 11:32 pm
Location: Surrey, B.C., Canada

Re: OpenWeatherMap skin

Post by CyberTheWorm »

Good job :great:
The only source of knowledge is experience. Albert Einstein
Deviant Art Page
mak_kawa
Posts: 908
Joined: December 30th, 2015, 9:47 am

Re: OpenWeatherMap skin

Post by mak_kawa »

Thanks, CyberTheWorm. I couldn't make this skin without your suggestion and work.

My main weather skin is still the one modified from VcloudWeather using hybrid source from Weather.com and Yahoo weather. But the alternative OpenWeatherMap skin gives me a peace of mind...:-)
mak_kawa
Posts: 908
Joined: December 30th, 2015, 9:47 am

Re: OpenWeatherMap skin

Post by mak_kawa »

Updated to OpenWeatherMap 1.0.1

Addition: Visibility and Precipitation mode meters.
Fix: NumOfDecimal on Temp meters.
Modify: meter spacing and skin width/height shrinked.
ToDo: add precipitation value... but still don't find a way.
mak_kawa
Posts: 908
Joined: December 30th, 2015, 9:47 am

Re: OpenWeatherMap skin

Post by mak_kawa »

Now I know the visibility tag, as well as precipitation tag, of the OpenWeatherMap xml feed has a "dynamic" structure, that is, different structure in a case. In such case, current OpenWeatherMap skin doesn't work because of RegExp matching error.

So, I am rewriting RegExp description and code structure corresponding to them.
mak_kawa
Posts: 908
Joined: December 30th, 2015, 9:47 am

Re: OpenWeatherMap skin (WIP)

Post by mak_kawa »

Updated OpenWeatherMap to ver.1.1.0

Add: Precipitation value meter.
Fixed?: Support the dynamic structure of XML feed of visibility and precipitation. But debugging not yet completed.
Modify: some cosmetic change.
ToDo: further debugging...:-)
MedjoPangit
Posts: 1
Joined: September 14th, 2021, 6:56 am

Re: OpenWeatherMap skin (WIP)

Post by MedjoPangit »

I'm only a few days new at Rainmeter, so bear with me in my proposition, but I found what I think to be a useful alteration to adjust the times to fit a specific timezone. First, I added an extra String Index in the Webparser Parent Measure. This is my alteration to the RegExp:



RegExp=(?siU).*<city id="(.*)".*name="(.*)".*<timezone>(.*)</timezone>.*<sun rise="(.*)".*set="(.*)".*<temperature value="(.*)".*min="(.*)".*max="(.*)".*unit="(.*)".*<humidity value="(.*)".*<pressure value="(.*)".*unit="(.*)".*<speed value="(.*)".*name="(.*)".*<direction value="(.*)".*code="(.*)".*<clouds value="(.*)".*name="(.*)".*<weather number=.*value="(.*)".*icon="(.*)".*<lastupdate value="(.*)"



Then add this Measure after [MeasureCity]:



[MeasureTimezone]
Measure=WebParser
URL=[MeasureValues]
StringIndex=3



Next, you'll have to go through all the following Measures and augment the StringIndex by 1 (i.e. [MeasureHumidity] should have a StringIndex of 10). Now that that's done, you just have to alter the Sunrise/sunset/LastUpdate measures to calculate this. It was a little tricky to figure out, but I was able to separate the hours from the time and adjust that value to be offset by the timezone (I THINK I got the math right on this. Please comment if I overlooked something). Take the [MeasureSunrise] and [MeasureSunset] snippets and replace them with the following:



[MeasureSunriseHourStep1]
Measure=WebParser
URL=[MeasureValues]
StringIndex=4
RegExpSubstitute=1
Substitute="^(.{1,})T(.{1,})+$":"\2","^(.{0,2}).+$":"\1"

[MeasureSunsetHourStep1]
Measure=WebParser
URL=[MeasureValues]
StringIndex=5
RegExpSubstitute=1
Substitute="^(.{1,})T(.{1,})+$":"\2","^(.{0,2}).+$":"\1"

[MeasureSunriseHour]
Measure=Calc
Formula=([MeasureSunriseHourStep1] >= Abs([MeasureTimezone] / 3600) ? [MeasureSunriseHourStep1] + ([MeasureTimezone] / 3600) : ([MeasureSunriseHourStep1] < Abs([MeasureTimezone] / 3600) ? [MeasureSunriseHourStep1] + 24 - Abs([MeasureTimezone] / 3600) : 37))
DynamicVariables=1

[MeasureSunsetHour]
Measure=Calc
Formula=([MeasureSunsetHourStep1] >= Abs([MeasureTimezone] / 3600) ? [MeasureSunsetHourStep1] + ([MeasureTimezone] / 3600) : ([MeasureSunsetHourStep1] < Abs([MeasureTimezone] / 3600) ? [MeasureSunsetHourStep1] + 24 - Abs([MeasureTimezone] / 3600) : 37))
DynamicVariables=1



(Note: 37 is just the random failover number I threw in; you can pick whatever you like). This same pattern should be applied to the [MeasureLastUpdate] snippet as well. In the meters, I then altered [MeterSun] with the following:


Code: Select all

[MeterSun]
Meter=String
MeasureName=MeasureSunriseHour
MeasureName2=MeasureSunsetHour
MeasureName3=MeasureSunriseMin
MeasureName4=MeasureSunsetMin
X=10
Y=20r
FontFace=Cambria
FontColor=255,255,255,255
FontSize=10
StringStyle=Bold
Text=Sunrise: %1%3#CRLF#Sunset: %2%4 


Again, do likewise with the [MeterLastUpdate] snippet. I'll reiterate, I am about as fresh as fresh gets when it comes to Rainmeter, and I'm not as much a programmer as I am a network engineer, so suggestions to improve this are highly welcomed. Just throwing this out here to whomever it may help.
Last edited by balala on September 14th, 2021, 3:35 pm, edited 1 time in total.
Reason: Please use <code> tags whenever are posting code snippets. It's the </> button.