It is currently September 22nd, 2021, 6:35 pm

Weather Skins Not Working

Help with creating, editing & fixing problems with skins
User avatar
pul53dr1v3r
Posts: 437
Joined: July 30th, 2014, 10:30 am

Re: Weather Skins Not Working

Post by pul53dr1v3r »

i feel like information such as AirQuality... Hope it's somewhere in the api site with a different name, but seems that nobody knows for sure.

Also, i noticed that the data usage of the Weather skins based on the api is barely 25 KB vs. ~1000 KB with standard site based JSON... Simply outstanding. :thumbup: :bow:
User avatar
jsmorley
Developer
Posts: 22291
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Weather Skins Not Working

Post by jsmorley »

Yincognito wrote: August 1st, 2020, 5:40 pm Once again, the mystery is unravelled... 8-)

Air Quality (just use EPA for <scale>, as I have no idea what that is):

Code: Select all

https://api.weather.com/v3/wx/globalAirQuality?geocode=<latitude>,<longitude>&language=<language>&scale=<scale>&format=json&apiKey=<ApiKey>
Pollen Forecast (unfortunately not a v3 option for the moment, it seems):
- tried but came out empty (I believe it needs some time interval to show the data, or maybe the file name is different):

Code: Select all

https://api.weather.com/v1/geocode/<latitude>/<longitude>/observations/pollen.json?language=<language>&apiKey=<ApiKey>
- tried and was successful:

Code: Select all

https://api.weather.com/v2/turbo/vt1PollenForecast?geocode=<latitude>,<longitude>&format=json&language=<language>&apiKey=<ApiKey>
I have no idea if this is what you want, as I never used (and will never use) these myself, but you should check here for a TON of info on pretty much everything (what I already had on the subject, although enough for my needs, is nothing compared to what's there, LOL). Just stumbled upon this today, while trying one more time to be of some help and fill the blanks for air quality and pollen. I suggest saving the important / most used bits from that link, as you never know when (and if) it gets deleted and such.
Ah yes. This is very useful indeed! Thanks a million!
User avatar
Yincognito
Rainmeter Sage
Posts: 4052
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: Weather Skins Not Working

Post by Yincognito »

jsmorley wrote: August 1st, 2020, 5:43 pm Ah yes. This is very useful indeed! Thanks a million!
No problem. Have fun checking out those docs. ;-)
User avatar
jsmorley
Developer
Posts: 22291
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Weather Skins Not Working

Post by jsmorley »

Here are a few I have uncovered from various places...
https://api.weather.com/v3/wx/conditions/historical/hourly/1day?language=en-US&apiKey=6532d6454b8aa370768e63d6ba5a832e&geocode=38.723249,-77.069950&units=e&format=json
https://api.weather.com/v2/astro?apiKey=6532d6454b8aa370768e63d6ba5a832e&geocode=38.723249,-77.069950&days=15&date=20200801&format=json
https://api.weather.com/v3/wx/almanac/daily/5day?apiKey=6532d6454b8aa370768e63d6ba5a832e&geocode=38.723249,-77.069950&units=e&startMonth=04&startDay=24&format=json
https://api.weather.com/v3/wx/conditions/historical/dailysummary/30day?language=en-US&apiKey=6532d6454b8aa370768e63d6ba5a832e&geocode=38.723249,-77.069950&units=e&format=json
https://api.weather.com/v3/wx/forecast/hourly/1day?apiKey=6532d6454b8aa370768e63d6ba5a832e&geocode=38.723249,-77.069950&units=e&language=en-US&format=json
https://api.weather.com/v3/location/near?apiKey=6532d6454b8aa370768e63d6ba5a832e&geocode=38.723249,-77.069950&product=pws&format=json
https://api.weather.com/v3/location/near?apiKey=6532d6454b8aa370768e63d6ba5a832e&geocode=38.723249,-77.069950&product=airport&subproduct=major&format=json
https://api.weather.com/v3/wx/globalAirQuality?geocode=38.723249,-77.069950&language=en-US&scale=EPA&format=json&apiKey=6532d6454b8aa370768e63d6ba5a832e
https://api.weather.com/v2/indices/pollen/daypart/15day?geocode=38.723249,-77.069950&language=en-US&format=json&apiKey=6532d6454b8aa370768e63d6ba5a832e
I will take a look at using 1-Day Forecast Hourly, Current Air Quality, Forecast Pollen, and maybe adding just tons of Moon and Sun data with "astro".
SCR
Posts: 59
Joined: April 15th, 2015, 11:13 pm

Re: Weather Skins Not Working - This is the only allowed thread about this

Post by SCR »

jsmorley wrote: August 1st, 2020, 3:39 pm Using a Calc measure like:

Code: Select all

[MeasureRoundDistance]
Measure=Calc
Formula=Round([@CurrentVisibilityDistance],0)
DynamicVariables=1
Will give you complete control over how many, or none, decimal places you want to show.

I see NO good reason to "overload" the measure [@CurrentVisibilityDistance] with that [Visibility] child measure you have. I would lose that measure entirely. When you "overload" a measure in the skin .ini, you are going to want to use either a String or Calc measure to manipulate the string or number values returned, or to add "tests" like IfCondition or IfMatch. There is just no good reason to prompt WebParser to return the child measure value once again. It's already there and available in [@CurrentVisibilityDistance].

The danger in what you are doing there is that I may change the StringIndex number that returns the current visibility distance from the JSON tomorrow, and the point of all this is that is transparent to you and your skin. If you start going after the RegExp in the skin itself, that can only lead to tears.

Note: Be aware that unless you play a trick where you Disabled=1 this Calc measure, and only !EnableMeasure or !EnableMeasurGroup it as a OnFinishAction on the WebParser parent measure, you might get at least one initial error in the log, something like "syntax error" or "extra operation in formula". In general, if you are using Calc or Time measures that reference the child measures from WebParser, you are going to want to disable them until WebParser is finished, or you can get a few errors.

I think you can simply add Disabled=1 to the Calc measure, and add Group=Parents or Group=Times to it as well. I already have OnFinishAction's on the WebParser parents that enables those groups when they are done.

Code: Select all

[MeasureRoundDistance]
Measure=Calc
Formula=Round([@CurrentVisibilityDistance],0)
DynamicVariables=1
Group=Parents
Disabled=1

Note: While using Round() in a Calc measure will restrict the number of decimal places, it is "no more than", not "exactly". What I'm getting at is that if you use anything other than "0" as the rounding factor, say "1", a string of "10.000" will return "10", not "10.0", and in fact a string of "10.009" will still return just "10". If you really want a consistent number of decimal places, again, say "1', you would probably want a String measure instead:

Code: Select all

[MeasureRoundDistance]
Measure=String
String=[@CurrentVisibilityDistance]
DynamicVariables=1
RegExpSubstitute=1
Substitute="^([\d]+)(\.)([\d]{1}).*$":"\1\2\3"
Now that is "truncating", not "rounding", but it is the only way I can see to get a consistent number of decimal places other than zero for a value that could in theory be 10.000 / 10.9 / 10.09 / 10.009. If the concern is "width / real estate", this is how I would go.


Throwing away all decimal places is probably fine with a units of measure of "e" (Imperial) as I think visibility is always returned in whole miles. When you are using "m" (Metric) I think it is far more likely that you will get a number that contains a fractional number of kilometers, as presumably it is converted from miles using a formula in the API, and that is pretty much never going to result in whole kilometers. So it's up to you how you handle this. It depends a bit on the design of your skin (width) and your target audience...
I replaced my measures with your first example although I did not have an error in the log. I rarely ever use a calc measure to round. All my other special measures are String=[MeasureName]. I did try to use Round but I didn't include the [ ] or the,0 My bad. :oops:

As to my target audience, it's just me for now. Perhaps I will learn enough to attempt to release something in the future when my coding ability can make sense without lines of notes to remind me what it does and why. In addition to all that my skin is entirely way to big, 7513 lines, and I am learning ways to shorten the Meters. I am currently working with Styles which will cut it in half or more. There are a lot of meters to change and I am still adding more meters as the additional data as it becomes available, yeah, it's going to have it all. Then there is Languages. It would have at best a very limited use because I don't know how long I could support the inevitable changes at my age.

To be honest there are a lot better weather skins out there then mine could ever hope to be. But I like it.

Your very informative notes are greatly appreciated. I have copied the post in to my Rainmeter notes files for future reference.

Thank you
User avatar
Yincognito
Rainmeter Sage
Posts: 4052
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: Weather Skins Not Working

Post by Yincognito »

jsmorley wrote: August 1st, 2020, 5:49 pm Here are a few I have uncovered from various places...
...
I will take a look at using Forecast Hourly, Air Quality, Pollen, and adding just tons of Moon data with "astro".
Yep. So, to conclude (<format> is generally json, as xml doesn't seem to be used much):

For V1, the standard URL format is (<filename> can be observations, <numberofdays> can be 7 or 15):

Code: Select all

https://api.weather.com/v1/geocode/<latitude>/<longitude>/<filename>.<format>?&units=<units>&language=<language>&apiKey=<ApiKey>
or, for forecasts

Code: Select all

https://api.weather.com/v1/geocode/<latitude>/<longitude>/forecast/daily/<numberofdays>day.<format>?&units=<units>&language=<language>&apiKey=<ApiKey>
For V2, the standard URL format is (<sectionname> can be vt1Loc, vt1Observation, vt1CurrentDateTime, vt1DailyForecast, vt1PollenForecast, etc.):

Code: Select all

https://api.weather.com/v2/turbo/<sectionname>[;<sectionname>...]?geocode=<latitude>,<longitude>&format=<format>&units=<units>&language=<language>&apiKey=<ApiKey>
For V3, the standard URL format is (<sectionname> can be observations, forecast - subsections daily or hourly with their own subsections like Ndays where N is a number, dateTime, location - subsections point or near, conditions - subsections historical with its own subsections like hourly or dailysummary again with subsections like Ndays where N is a number, almanac - subsection daily, globalAirQuality, etc.):

Code: Select all

https://api.weather.com/v3[/wx]/<sectionname>[/<subsectionname>...][/<numberofdaysforforecasts>]?geocode=<latitude>,<longitude>&format=<format>&units=<units>&language=<language>&apiKey=<ApiKey>
or, the aggregate form

Code: Select all

https://api.weather.com/v3/aggcommon/v3[-wx]-<sectionname>[-<subsectionname>...][;v3[-wx]-<sectionname>[-<subsectionname>...]...]?geocode=<latitude>,<longitude>&format=<format>&units=<units>&language=<language>&apiKey=<ApiKey>
Note that [somethinghere] means optional, ... possible repetition of the text inside the current square brackets, and for some sections, the units=<units> part must be excluded from the URL.
DougS2K
Posts: 13
Joined: July 26th, 2020, 6:33 pm

Re: Weather Skins Not Working

Post by DougS2K »

So I've converted my skin to use your inc files jsmorley (Thanks for the work and effort BTW). Just one question if you don't mind. How do I get the following output in the picture to show either Today or Tonight depending on time of day instead of just the current day which is Saturday in this example? This was done through RegExp with the old coding but not sure how to adapt this to your coding. :confused:

Here is the code I'm currently using for the output:

Code: Select all

[MeterFWDay1]
Meter=String
MeterStyle=StyleFont1
StringAlign=center
Group=DAY1
MeasureName=@ForecastTodayDayLong
X=(#WEATHER5DAYAlignX#)
Y=(#WEATHER5DAYAlignY#)-2
ToolTipText=[@ForecastTodayDayLong]
DynamicVariables=1
Picture of what the output looks like now with what I'm talking about circled in green. Would like it to show "Today" or "Tonight" depending on time of day. https://imgur.com/362u8WS
User avatar
jsmorley
Developer
Posts: 22291
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Weather Skins Not Working

Post by jsmorley »

DougS2K wrote: August 1st, 2020, 7:58 pm So I've converted my skin to use your inc files jsmorley (Thanks for the work and effort BTW). Just one question if you don't mind. How do I get the following output in the picture to show either Today or Tonight depending on time of day instead of just the current day which is Saturday in this example? This was done through RegExp with the old coding but not sure how to adapt this to your coding. :confused:

Here is the code I'm currently using for the output:

Code: Select all

[MeterFWDay1]
Meter=String
MeterStyle=StyleFont1
StringAlign=center
Group=DAY1
MeasureName=@ForecastTodayDayLong
X=(#WEATHER5DAYAlignX#)
Y=(#WEATHER5DAYAlignY#)-2
ToolTipText=[@ForecastTodayDayLong]
DynamicVariables=1
Picture of what the output looks like now with what I'm talking about circled in green. Would like it to show "Today" or "Tonight" depending on time of day. https://imgur.com/362u8WS
What I do looks like this in my skin:

Code: Select all

[MeasureToggleAtNight]
Measure=String
Group=Weather
String=[@ForecastTodayDayTemperature]
DynamicVariables=1
IfMatch=^$
IfMatchAction=[!SetOption MeterTodayIcon MeasureName "@ForecastTodayNightIcon"][!SetOption MeterTodayName MeasureName "@ForecastTodayNightPart"][!SetOption MeterTodayHighLow MeasureName "@CurrentTemperatureMaxSince7AM"][!SetOption MeterTodayPrecipitation MeasureName "@ForecastTodayNightPrecipitationPercent"][!SetOption MeterTodayHighLow InlineSetting "Color | 160,160,160,255"]
IfNotMatchAction=[!SetOption MeterTodayIcon MeasureName "@ForecastTodayDayIcon"][!SetOption MeterTodayName MeasureName "@ForecastTodayDayPart"][!SetOption MeterTodayHighLow MeasureName "@ForecastTodayDayTemperature"][!SetOption MeterTodayPrecipitation MeasureName "@ForecastTodayDayPrecipitationPercent"][!SetOption MeterTodayHighLow InlineSetting "None"]
So I look to see if it is "day" or "night", but seeing if there is no forecasted "day" temperature, which there won't be after 3pm or so.
Then if that value is an empty string, I set various meters to use "night" measures instead of "day" measures.

[@ForecastTodayDayPart] and [@ForecastTodayNightPart] are the measures that will return "Today" and "Tonight".



1.jpg
You do not have the required permissions to view the files attached to this post.
DougS2K
Posts: 13
Joined: July 26th, 2020, 6:33 pm

Re: Weather Skins Not Working

Post by DougS2K »

jsmorley wrote: August 1st, 2020, 8:16 pm What I do looks like this in my skin:

Code: Select all

[MeasureToggleAtNight]
Measure=String
Group=Weather
String=[@ForecastTodayDayTemperature]
DynamicVariables=1
IfMatch=^$
IfMatchAction=[!SetOption MeterTodayIcon MeasureName "@ForecastTodayNightIcon"][!SetOption MeterTodayName MeasureName "@ForecastTodayNightPart"][!SetOption MeterTodayHighLow MeasureName "@CurrentTemperatureMaxSince7AM"][!SetOption MeterTodayPrecipitation MeasureName "@ForecastTodayNightPrecipitationPercent"][!SetOption MeterTodayHighLow InlineSetting "Color | 160,160,160,255"]
IfNotMatchAction=[!SetOption MeterTodayIcon MeasureName "@ForecastTodayDayIcon"][!SetOption MeterTodayName MeasureName "@ForecastTodayDayPart"][!SetOption MeterTodayHighLow MeasureName "@ForecastTodayDayTemperature"][!SetOption MeterTodayPrecipitation MeasureName "@ForecastTodayDayPrecipitationPercent"][!SetOption MeterTodayHighLow InlineSetting "None"]
So I look to see if it is "day" or "night", but seeing if there is no forecasted "day" temperature, which there won't be after 3pm or so.
Then if that value is an empty string, I set various meters to use "night" measures instead of "day" measures.

[@ForecastTodayDayPart] and [@ForecastTodayNightPart] are the measures that will return "Today" and "Tonight".




1.jpg
Thanks a bunch. That did the trick once I edited it a bit to match my labels. :thumbup:
pbutler6
Posts: 76
Joined: April 27th, 2020, 8:10 pm

Re: Weather Skins Not Working

Post by pbutler6 »

I am having a problem with the new WeatherConJSONAlerts.inc file. I get a RegExp matching error (-1) for [@AlertsParent] every 10 minutes (UpdateRate=1000).

There is no string in the Skins log for @AlertsParent. To try to isolate the problem I added a new [@EntireSiteSuperParent1] to your WeatehrConJSONAlerts.inc file, but I still get the error:

Code: Select all

[@EntireSiteSuperParent1]
Measure=WebParser
URL=#URLSite#
UpdateRate=#UpdateRate#
Flags=Resync | NoCookies
UserAgent=Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Firefox/78.0
DecodeCharacterReference=1
LogSubstringErrors=0
RegExp=(?siU)^(.*)$
StringIndex=1
FinishAction=[!EnableMeasureGroup Parents1]

[@AlertsParent]
Measure=WebParser
Group=Parents1
URL=[@EntireSiteSuperParent1]
Disabled=1
LogSubstringErrors=0
StringIndex=1
RegExp=#WeatherAlert#