It is currently April 13th, 2021, 11:44 pm
Weather Skins Not Working
-
- Developer
- Posts: 21619
- Joined: April 19th, 2009, 11:02 pm
- Location: Fort Hunt, Virginia, USA
Re: Weather Skins Not Working
The JSON API version of the weather is fine for me. I can't say about any skins parsing the embedded JSON in the HTML, I just don't use that approach anymore.
-
- Posts: 3054
- Joined: February 27th, 2015, 2:38 pm
- Location: Terra Yincognita
Re: Weather Skins Not Working
Just open the actual URL in the browser (I believe jsmorley's skin here can do that too by clicking on the weather icon, although it's based on the API JSON method nowadays), right click inside the webpage and choose "View Page Source" (that's how it's called in Chrome, it may be named a bit differently in other browsers) from the context menu. A new tab will open with the associated HTML, which you can then copy, save, search into it using CTRL+F, etc.bravo-lemur wrote: ↑August 20th, 2020, 9:48 pm Sorry for the totally noob-ish question, but can you point me in the direction of where to check those section names so I can update the skin I'm using? Thanks!
-
- Posts: 1031
- Joined: February 7th, 2016, 6:08 am
Re: Weather Skins Not Working
i had some older version fixed it with your 4 august version
the older version chrashed today in the evening.. 
it was some TimeStampFormat=%Y-%m-%dT%H:%M:%S error



it was some TimeStampFormat=%Y-%m-%dT%H:%M:%S error

-
- Developer
- Posts: 21619
- Joined: April 19th, 2009, 11:02 pm
- Location: Fort Hunt, Virginia, USA
Re: Weather Skins Not Working
Great.
I don't want to make a big deal out of this, as with Rainmeter, there are always alternative ways to accomplish things, that is one of the big charms of Rainmeter.
However... I pretty strongly feel that everyone who wants to use weather.com should be using the latest @Include .inc files that I provide with the .rmskin in:
https://forum.rainmeter.net/viewtopic.php?f=118&t=34628#p171501
In my view, this the only safe way to get the info for weather.com right now. You just CANNOT depend on parsing an HTML website for the long-term, as the site WILL change, maybe not today, maybe not tomorrow, but soon. It's guaranteed …
In addition, I just don't see any real purpose in having multiple approaches to parsing the JSON API data floating around. While they all may work just fine, it certainly makes answering questions and supporting users a lot more complicated.
I'm not suggesting that everyone use my "skin". Not at all. It works for me, but anyone can build weather skins, based on the same "plug-and-play" .inc files, and have it display and look exactly as they want. All I'm suggesting is that the .inc file approach allows us to separate the data "back-end" from the display "front-end", and I really strongly recommend that we all use the same "back-end". I will certainly keep it absolutely current as the needs arise, and this is one time when it will sure simplify things if we all are singing from the same songsheet.
I don't want to make a big deal out of this, as with Rainmeter, there are always alternative ways to accomplish things, that is one of the big charms of Rainmeter.
However... I pretty strongly feel that everyone who wants to use weather.com should be using the latest @Include .inc files that I provide with the .rmskin in:
https://forum.rainmeter.net/viewtopic.php?f=118&t=34628#p171501
In my view, this the only safe way to get the info for weather.com right now. You just CANNOT depend on parsing an HTML website for the long-term, as the site WILL change, maybe not today, maybe not tomorrow, but soon. It's guaranteed …
In addition, I just don't see any real purpose in having multiple approaches to parsing the JSON API data floating around. While they all may work just fine, it certainly makes answering questions and supporting users a lot more complicated.
I'm not suggesting that everyone use my "skin". Not at all. It works for me, but anyone can build weather skins, based on the same "plug-and-play" .inc files, and have it display and look exactly as they want. All I'm suggesting is that the .inc file approach allows us to separate the data "back-end" from the display "front-end", and I really strongly recommend that we all use the same "back-end". I will certainly keep it absolutely current as the needs arise, and this is one time when it will sure simplify things if we all are singing from the same songsheet.
-
- Posts: 7
- Joined: August 20th, 2020, 8:49 pm
Re: Weather Skins Not Working
I've bitten the bullet - currently re-building my skin based on yours rather than Weatherbox, which was parsing the HTML.jsmorley wrote: ↑August 20th, 2020, 10:44 pm Great.
I don't want to make a big deal out of this, as with Rainmeter, there are always alternative ways to accomplish things, that is one of the big charms of Rainmeter.
However... I pretty strongly feel that everyone who wants to use weather.com should be using the latest @Include .inc files that I provide with the .rmskin in:
https://forum.rainmeter.net/viewtopic.php?f=118&t=34628#p171501
In my view, this the only safe way to get the info for weather.com right now. You just CANNOT depend on parsing an HTML website for the long-term, as the site WILL change, maybe not today, maybe not tomorrow, but soon. It's guaranteed …
In addition, I just don't see any real purpose in having multiple approaches to parsing the JSON API data floating around. While they all may work just fine, it certainly makes answering questions and supporting users a lot more complicated.
I'm not suggesting that everyone use my "skin". Not at all. It works for me, but anyone can build weather skins, based on the same "plug-and-play" .inc files, and have it display and look exactly as they want. All I'm suggesting is that the .inc file approach allows us to separate the data "back-end" from the display "front-end", and I really strongly recommend that we all use the same "back-end". I will certainly keep it absolutely current as the needs arise, and this is one time when it will sure simplify things if we all are singing from the same songsheet.
Is there a way to parse the sunset/sunrise hour and minutes separately? I previously made a little roundline suntrail, but it relies on being able to calculate the difference in time in minutes, so I'm not sure how to do that with the current .inc file measures.
Thank you!
-
- Developer
- Posts: 21619
- Joined: April 19th, 2009, 11:02 pm
- Location: Fort Hunt, Virginia, USA
Re: Weather Skins Not Working
bravo-lemur wrote: ↑August 20th, 2020, 11:21 pm I've bitten the bullet - currently re-building my skin based on yours rather than Weatherbox, which was parsing the HTML.
Is there a way to parse the sunset/sunrise hour and minutes separately? I previously made a little roundline suntrail, but it relies on being able to calculate the difference in time in minutes, so I'm not sure how to do that with the current .inc file measures.
Thank you!
Code: Select all
[MeasureSunRiseHourString]
Measure=String
String=[@CurrentSunriseTime]
DynamicVariables=1
RegExpSubstitute=1
Substitute="^(.*):.*$":"\1"
[MeasureSunRiseMinuteString]
Measure=String
String=[@CurrentSunriseTime]
DynamicVariables=1
RegExpSubstitute=1
Substitute="^.*:(.*) .*$":"\1"
[MeasureSunRiseHourNumber]
Measure=Calc
Formula=[MeasureSunRiseHourString]
DynamicVariables=1
[MeasureSunRiseMinuteNumber]
Measure=Calc
Formula=[MeasureSunRiseMinuteString]
DynamicVariables=1
You do not have the required permissions to view the files attached to this post.
-
- Developer
- Posts: 21619
- Joined: April 19th, 2009, 11:02 pm
- Location: Fort Hunt, Virginia, USA
Re: Weather Skins Not Working
If it's easier for your calculations, you can also use the actual "timestamps" for Sunrise / Sunset from the measures.
You do not have the required permissions to view the files attached to this post.
-
- Posts: 7
- Joined: August 20th, 2020, 8:49 pm
Re: Weather Skins Not Working
That seems to work, thank you! The only thing I noticed is that if the minutes is 00 in the string, it gets converted to 0 in the number. So if the sunrise time is 6:00, it displays as 6:0 instead.jsmorley wrote: ↑August 20th, 2020, 11:28 pmCode: Select all
[MeasureSunRiseHourString] Measure=String String=[@CurrentSunriseTime] DynamicVariables=1 RegExpSubstitute=1 Substitute="^(.*):.*$":"\1" [MeasureSunRiseMinuteString] Measure=String String=[@CurrentSunriseTime] DynamicVariables=1 RegExpSubstitute=1 Substitute="^.*:(.*) .*$":"\1" [MeasureSunRiseHourNumber] Measure=Calc Formula=[MeasureSunRiseHourString] DynamicVariables=1 [MeasureSunRiseMinuteNumber] Measure=Calc Formula=[MeasureSunRiseMinuteString] DynamicVariables=1
I've currently got the following code, which seems to be working for the roundline suntrail (Meter=Roundline, MeasureName=MeasurePosition2), although I'll double check tomorrow during the day!
Code: Select all
[MeasureCurrentHourString]
Measure=String
String=[@CurrentObservationTime]
StringIndex=44
Group=Weather
DynamicVariables=1
RegExpSubstitute=1
Substitute="^(.*):.*$":"\1"
[MeasureCurrentMinuteString]
Measure=String
String=[@CurrentObservationTime]
StringIndex=45
Group=Weather
DynamicVariables=1
RegExpSubstitute=1
Substitute="^.*:(.*) .*$":"\1"
[MeasureCurrentHourNumber]
Measure=Calc
Formula=[MeasureCurrentHourString]
DynamicVariables=1
[MeasureCurrentMinuteNumber]
Measure=Calc
Formula=[MeasureCurrentMinuteString]
DynamicVariables=1
[MeasureSunRiseHourString]
Measure=String
String=[@CurrentSunriseTime]
StringIndex=46
Group=Weather
DynamicVariables=1
RegExpSubstitute=1
Substitute="^(.*):.*$":"\1"
[MeasureSunRiseMinuteString]
Measure=String
String=[@CurrentSunriseTime]
StringIndex=47
Group=Weather
DynamicVariables=1
RegExpSubstitute=1
Substitute="^.*:(.*) .*$":"\1"
[MeasureSunRiseHourNumber]
Measure=Calc
Formula=[MeasureSunRiseHourString]
DynamicVariables=1
[MeasureSunRiseMinuteNumber]
Measure=Calc
Formula=[MeasureSunRiseMinuteString]
DynamicVariables=1
[MeasureSunsetHourString]
Measure=String
String=[@CurrentSunsetTime]
StringIndex=48
Group=Weather
DynamicVariables=1
RegExpSubstitute=1
Substitute="^(.*):.*$":"\1"
[MeasureSunsetMinuteString]
Measure=String
String=[@CurrentSunsetTime]
StringIndex=49
Group=Weather
DynamicVariables=1
RegExpSubstitute=1
Substitute="^.*:(.*) .*$":"\1"
[MeasureSunsetHourNumber]
Measure=Calc
Formula=[MeasureSunsetHourString]
DynamicVariables=1
[MeasureSunsetMinuteNumber]
Measure=Calc
Formula=[MeasureSunsetMinuteString]
DynamicVariables=1
[MeasureDifferenceMin]
Measure=Calc
Formula=(MeasureSunsetHourNumber*60+MeasureSunsetMinuteNumber)-(MeasureSunRiseHourNumber*60+MeasureSunRiseMinuteNumber)
Group=Weather
DynamicVariables=1
[MeasurePosition1]
Measure=Calc
Formula=((MeasureCurrentHourNumber*60+MeasureCurrentMinuteNumber)-(MeasureSunRiseHourNumber*60+MeasureSunsetMinuteNumber))/(MeasureDifferenceMin=0?1:MeasureDifferenceMin)
Group=Weather
DynamicVariables=1
[MeasurePosition2]
Measure=Calc
Formula=MeasurePosition1 < 0 ? 0 : (MeasurePosition1 < 1 ? MeasurePosition1 : 1)
Group=Weather
DynamicVariables=1
-
- Developer
- Posts: 21619
- Joined: April 19th, 2009, 11:02 pm
- Location: Fort Hunt, Virginia, USA
Re: Weather Skins Not Working
Yeah, I wouldn't use the "number" value to display the minutes. You are going to want the "string" value from the String measure, which will display the minutes as "00". Use the "number" value for calculations. "00" is not a valid number. That is why I used String measures to extract the values, and Calc measures to turn that into actual numbers.bravo-lemur wrote: ↑August 20th, 2020, 11:43 pm That seems to work, thank you! The only thing I noticed is that if the minutes is 00 in the string, it gets converted to 0 in the number. So if the sunrise time is 6:00, it displays as 6:0 instead.
I've currently got the following code, which seems to be working for the roundline suntrail (Meter=Roundline, MeasureName=MeasurePosition2), although I'll double check tomorrow during the day!
Code: Select all
[MeasureCurrentHourString] Measure=String String=[@CurrentObservationTime] StringIndex=44 Group=Weather DynamicVariables=1 RegExpSubstitute=1 Substitute="^(.*):.*$":"\1" [MeasureCurrentMinuteString] Measure=String String=[@CurrentObservationTime] StringIndex=45 Group=Weather DynamicVariables=1 RegExpSubstitute=1 Substitute="^.*:(.*) .*$":"\1" [MeasureCurrentHourNumber] Measure=Calc Formula=[MeasureCurrentHourString] DynamicVariables=1 [MeasureCurrentMinuteNumber] Measure=Calc Formula=[MeasureCurrentMinuteString] DynamicVariables=1 [MeasureSunRiseHourString] Measure=String String=[@CurrentSunriseTime] StringIndex=46 Group=Weather DynamicVariables=1 RegExpSubstitute=1 Substitute="^(.*):.*$":"\1" [MeasureSunRiseMinuteString] Measure=String String=[@CurrentSunriseTime] StringIndex=47 Group=Weather DynamicVariables=1 RegExpSubstitute=1 Substitute="^.*:(.*) .*$":"\1" [MeasureSunRiseHourNumber] Measure=Calc Formula=[MeasureSunRiseHourString] DynamicVariables=1 [MeasureSunRiseMinuteNumber] Measure=Calc Formula=[MeasureSunRiseMinuteString] DynamicVariables=1 [MeasureSunsetHourString] Measure=String String=[@CurrentSunsetTime] StringIndex=48 Group=Weather DynamicVariables=1 RegExpSubstitute=1 Substitute="^(.*):.*$":"\1" [MeasureSunsetMinuteString] Measure=String String=[@CurrentSunsetTime] StringIndex=49 Group=Weather DynamicVariables=1 RegExpSubstitute=1 Substitute="^.*:(.*) .*$":"\1" [MeasureSunsetHourNumber] Measure=Calc Formula=[MeasureSunsetHourString] DynamicVariables=1 [MeasureSunsetMinuteNumber] Measure=Calc Formula=[MeasureSunsetMinuteString] DynamicVariables=1 [MeasureDifferenceMin] Measure=Calc Formula=(MeasureSunsetHourNumber*60+MeasureSunsetMinuteNumber)-(MeasureSunRiseHourNumber*60+MeasureSunRiseMinuteNumber) Group=Weather DynamicVariables=1 [MeasurePosition1] Measure=Calc Formula=((MeasureCurrentHourNumber*60+MeasureCurrentMinuteNumber)-(MeasureSunRiseHourNumber*60+MeasureSunsetMinuteNumber))/(MeasureDifferenceMin=0?1:MeasureDifferenceMin) Group=Weather DynamicVariables=1 [MeasurePosition2] Measure=Calc Formula=MeasurePosition1 < 0 ? 0 : (MeasurePosition1 < 1 ? MeasurePosition1 : 1) Group=Weather DynamicVariables=1
-
- Posts: 3054
- Joined: February 27th, 2015, 2:38 pm
- Location: Terra Yincognita
Re: Weather Skins Not Working
Yep, after some analysis, it turns out that the differences are indeed minor in the webpage JSON. Just the name of the forecast section and some other subsection that was introduced at the end of the forecast one (called responseHeaders). In my case the "fix" is trivial and I've already identified it, I'm just weighing in which pattern would be best suited for it. So far my aim of requiring only minor adaptations in my skin when weather.com JSON changes remains intact.
Regarding jsmorley's "standardization" around his .inc files, I agree 95% - I'm all for standardization in general, as long as the solution is efficient and comprehensive. However, what happens when everybody is in the same boat (so to speak) is that everyone "navigates" properly when things go well, but when things go south everybody drowns. In other words, a single solution works well if it suits circumstances, but when it doesn't anymore, it leaves you without alternatives. That's why while I'm all for the same data "back-end" in theory, I must admit that in practice having multiple options to choose from is quite useful when issues arise. Like with everything in life, moderation is a good approach here as well.
Regarding jsmorley's "standardization" around his .inc files, I agree 95% - I'm all for standardization in general, as long as the solution is efficient and comprehensive. However, what happens when everybody is in the same boat (so to speak) is that everyone "navigates" properly when things go well, but when things go south everybody drowns. In other words, a single solution works well if it suits circumstances, but when it doesn't anymore, it leaves you without alternatives. That's why while I'm all for the same data "back-end" in theory, I must admit that in practice having multiple options to choose from is quite useful when issues arise. Like with everything in life, moderation is a good approach here as well.