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.


Ah yes. This is very useful indeed! Thanks a million!Yincognito wrote: ↑August 1st, 2020, 5:40 pm Once again, the mystery is unravelled...![]()
Air Quality (just use EPA for <scale>, as I have no idea what that is):Pollen Forecast (unfortunately not a v3 option for the moment, it seems):Code: Select all
https://api.weather.com/v3/wx/globalAirQuality?geocode=<latitude>,<longitude>&language=<language>&scale=<scale>&format=json&apiKey=<ApiKey>
- tried but came out empty (I believe it needs some time interval to show the data, or maybe the file name is different):- tried and was successful:Code: Select all
https://api.weather.com/v1/geocode/<latitude>/<longitude>/observations/pollen.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.Code: Select all
https://api.weather.com/v2/turbo/vt1PollenForecast?geocode=<latitude>,<longitude>&format=json&language=<language>&apiKey=<ApiKey>
No problem. Have fun checking out those docs.
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".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 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.jsmorley wrote: ↑August 1st, 2020, 3:39 pm Using a Calc measure like:
Will give you complete control over how many, or none, decimal places you want to show.Code: Select all
[MeasureRoundDistance] Measure=Calc Formula=Round([@CurrentVisibilityDistance],0) DynamicVariables=1
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:
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.Code: Select all
[MeasureRoundDistance] Measure=String String=[@CurrentVisibilityDistance] DynamicVariables=1 RegExpSubstitute=1 Substitute="^([\d]+)(\.)([\d]{1}).*$":"\1\2\3"
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...
Yep. So, to conclude (<format> is generally json, as xml doesn't seem to be used much):
Code: Select all
https://api.weather.com/v1/geocode/<latitude>/<longitude>/<filename>.<format>?&units=<units>&language=<language>&apiKey=<ApiKey>
Code: Select all
https://api.weather.com/v1/geocode/<latitude>/<longitude>/forecast/daily/<numberofdays>day.<format>?&units=<units>&language=<language>&apiKey=<ApiKey>
Code: Select all
https://api.weather.com/v2/turbo/<sectionname>[;<sectionname>...]?geocode=<latitude>,<longitude>&format=<format>&units=<units>&language=<language>&apiKey=<ApiKey>
Code: Select all
https://api.weather.com/v3[/wx]/<sectionname>[/<subsectionname>...][/<numberofdaysforforecasts>]?geocode=<latitude>,<longitude>&format=<format>&units=<units>&language=<language>&apiKey=<ApiKey>
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>
Code: Select all
[MeterFWDay1]
Meter=String
MeterStyle=StyleFont1
StringAlign=center
Group=DAY1
MeasureName=@ForecastTodayDayLong
X=(#WEATHER5DAYAlignX#)
Y=(#WEATHER5DAYAlignY#)-2
ToolTipText=[@ForecastTodayDayLong]
DynamicVariables=1
What I do looks like this in my skin: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.![]()
Here is the code I'm currently using for the output: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/362u8WSCode: Select all
[MeterFWDay1] Meter=String MeterStyle=StyleFont1 StringAlign=center Group=DAY1 MeasureName=@ForecastTodayDayLong X=(#WEATHER5DAYAlignX#) Y=(#WEATHER5DAYAlignY#)-2 ToolTipText=[@ForecastTodayDayLong] DynamicVariables=1
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"]
Thanks a bunch. That did the trick once I edited it a bit to match my labels.jsmorley wrote: ↑August 1st, 2020, 8:16 pm What I do looks like this in my skin:
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.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"]
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
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#