Page 1 of 1

OpenWeatherMap skin (WIP)

Posted: June 3rd, 2017, 8:19 am
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.

Re: OpenWeatherMap skin

Posted: June 3rd, 2017, 9:46 am
by CyberTheWorm
Good job :great:

Re: OpenWeatherMap skin

Posted: June 3rd, 2017, 10:08 am
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...:-)

Re: OpenWeatherMap skin

Posted: June 6th, 2017, 10:38 am
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.

Re: OpenWeatherMap skin

Posted: June 6th, 2017, 11:12 pm
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.

Re: OpenWeatherMap skin (WIP)

Posted: June 7th, 2017, 8:54 am
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...:-)

Re: OpenWeatherMap skin (WIP)

Posted: September 14th, 2021, 2:50 pm
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.