It is currently March 28th, 2024, 2:53 pm

Weather Skins Not Working

Get help with creating, editing & fixing problems with skins
anbr07
Posts: 82
Joined: July 17th, 2016, 12:19 pm

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

Post by anbr07 »

SilverAzide wrote: July 31st, 2020, 2:30 pm You can go HERE if you don't want to wait. An updated Weather Meter will be released once the official fix is available.
Thanks for fixing, but i still have an issue. I have set Gadgets to use the local settings, but still get miles and Fahrenheit. I have no idea how to get the correct settings here. I also noticed, that the opacity of the module displaying the time and date is different from the others. If i set it to 10%, nothing seems to change. In order to have about the same opacity like all other parts, which is 10%, i will have to set it to 20%.

/edit, forget the first part. It is fixed now, after i set the country to "automatic". Keep up the nice work!
DougS2K
Posts: 13
Joined: July 26th, 2020, 6:33 pm

Re: Weather Skins Not Working

Post by DougS2K »

jsmorley wrote: July 29th, 2020, 6:05 pm So it seems like two steps are needed.

1) Replace all " with \\" in all RegExp options in the various WeatherComJSONMeasures*.inc files.
2) Add ,"\\":"" to the end of #CommonSubstitute# in the WeatherComJSONVariables.inc file.

And bingo...

1.jpg
Thanks for posting this. This fixed my problem except for one part. With these changes I get an extra / before and after the "Today" and the condition as seen in the pic. Doesn't do this later in the day when it says tonight. Any idea what lines I have to edit to fix this as the RegExp file is hard to pinpoint the issue myself.

https://imgur.com/3SpZn5P
User avatar
jsmorley
Developer
Posts: 22628
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, 3:02 pm Thanks for posting this. This fixed my problem except for one part. With these changes I get an extra / before and after the "Today" and the condition as seen in the pic. Doesn't do this later in the day when it says tonight. Any idea what lines I have to edit to fix this as the RegExp file is hard to pinpoint the issue myself.

https://imgur.com/3SpZn5P
Just get the new .inc files from the .zip here:

https://forum.rainmeter.net/viewtopic.php?f=118&t=34628&start=530#p180868

And replace all of them in your @Resources folder.

Do be aware that latitude and longitude are required for the location now. Be sure to read WeatherComJSONVariables.inc.
DougS2K
Posts: 13
Joined: July 26th, 2020, 6:33 pm

Re: Weather Skins Not Working

Post by DougS2K »

jsmorley wrote: August 1st, 2020, 3:08 pm Just get the new .inc files from the .zip here:

https://forum.rainmeter.net/viewtopic.php?f=118&t=34628&start=530#p180868

And replace all of them in your @Resources folder.

Do be aware that latitude and longitude are required for the location now. Be sure to read WeatherComJSONVariables.inc.
Hmmm. I don't see any RegExp file bundled in that zip. Looking in those files I see nothing that looks like the RegExp file I'm using. To use these files may take a full rewrite of my output file I'm thinking. :confused:

Coding for RegExp file I'm using by author xxenium:

Code: Select all

; Do NOT change this file unless you are sure you know what you are doing !!!
; ========================================================================

; © 2020 by xxenium

[Variables]
@Include=#@#Variables.inc

Location=(?siU)\\"getSunV3LocationPointUrlConfig\\":.*{\\"location\\":{\\"latitude\\":(.*),\\"longitude\\":(.*),.*,\\"adminDistrict\\":(.*),\\"adminDistrictCode\\":(.*),.*,\\"country\\":(.*),\\"countryCode\\":(.*),.*,\\"displayName\\":(.*),.*}

CurrentObservations=(?siU)\\"getSunV3CurrentObservationsUrlConfig\\":.*{\\"cloudCeiling\\":.*,\\"cloudCoverPhrase\\":\\".*\\",\\"dayOfWeek\\":\\".*\\",\\"dayOrNight\\":\\".*\\",\\"expirationTimeUtc\\":.*,\\"iconCode\\":(.*),\\"iconCodeExtend\\":.*,\\"obsQualifierCode\\":.*,\\"obsQualifierSeverity\\":.*,\\"precip1Hour\\":.*,\\"precip6Hour\\":.*,\\"precip24Hour\\":.*,\\"pressureAltimeter\\":(.*),\\"pressureChange\\":(.*),\\"pressureMeanSeaLevel\\":.*\\"pressureTendencyCode\\":.*,\\"pressureTendencyTrend\\":\\"(.*)\\",\\"relativeHumidity\\":(.*),\\"snow1Hour\\":.*,\\"snow6Hour\\":.*,\\"snow24Hour\\":.*,\\"sunriseTimeLocal\\":\\"(.*)\\",\\"sunriseTimeUtc\\":.*\\"sunsetTimeLocal\\":\\"(.*)\\",\\"sunsetTimeUtc\\":.*\\"temperature\\":(.*),\\"temperatureChange24Hour\\":.*,\\"temperatureDewPoint\\":(.*),\\"temperatureFeelsLike\\":(.*),\\"temperatureHeatIndex\\":.*\\"temperatureMax24Hour\\":.*\\"temperatureMaxSince7Am\\":.*\\"temperatureMin24Hour\\":.*\\"temperatureWindChill\\":.*\\"uvDescription\\":\\"(.*)\\",\\"uvIndex\\":(.*),\\"validTimeLocal\\":\\"(.*)\\",\\"validTimeUtc\\":.*\\"visibility\\":(.*),\\"windDirection\\":.*\\"windDirectionCardinal\\":\\"(.*)\\",\\"windGust\\":(.*),\\"windSpeed\\":(.*),\\"wxPhraseLong\\":\\"(.*)\\",\\"wxPhraseMedium\\":.*,\\"wxPhraseShort\\":.*}

UpdateTimeZone=(?siU)\\"getSunV3CurrentDateTimeByGeocodeUrlConfig\\":{\\"geocode:.*\\":{.*,\\"data\\":{\\"dateTime\\":\\".*\\",\\"ianaTimeZone\\":\\".*\\",\\"timeZoneAbbreviation\\":\\"(.*)\\"}

DailyForecastDayOfWeek=(?siU)\\"getSunV3DailyForecastUrlConfig\\":.*{\\"dayOfWeek\\":.*\\"(.*)\\",\\"(.*)\\",\\"(.*)\\",\\"(.*)\\",\\"(.*)\\",\\"(.*)\\",\\"(.*)\\",\\"(.*)\\"

DailyForecastMoon=(?siU)\\"getSunV3DailyForecastUrlConfig\\":.*{.*\\"moonPhase\\":.\\"(.*)\\",.*,\\"moonPhaseCode\\":.*\\"(.*)\\",.*\\"moonriseTimeLocal\\":.*\\"(.*)\\",\\"(.*)\\",.*\\"moonsetTimeLocal\\":.*\\"(.*)\\",\\"(.*)\\"

DailyForecastTempMax=(?siU)\\"getSunV3DailyForecastUrlConfig\\":.*{.*\\"temperatureMax\\":(.*),(.*),(.*),(.*),(.*),(.*),(.*),(.*),.*

DailyForecastTempMin=(?siU)\\"getSunV3DailyForecastUrlConfig\\":.*{.*\\"temperatureMin\\":(.*),(.*),(.*),(.*),(.*),(.*),(.*),(.*),.*

DailyForecastDate=(?siU)\\"getSunV3DailyForecastUrlConfig\\":.*{.*\\"validTimeLocal\\":.*\\"(.*)\\",\\"(.*)\\",\\"(.*)\\",\\"(.*)\\",\\"(.*)\\",\\"(.*)\\",\\"(.*)\\",\\"(.*)\\"

DailyForecastDayPart=(?siU)\\"getSunV3DailyForecastUrlConfig\\":.*{.*\\"daypartName\\":(.*),\\"(.*)\\",\\"(.*)\\",\\"(.*)\\",\\"(.*)\\",\\"(.*)\\",\\"(.*)\\",\\"(.*)\\",\\"(.*)\\",\\"(.*)\\",\\"(.*)\\",\\"(.*)\\",\\"(.*)\\",\\"(.*)\\",\\"(.*)\\",\\"(.*)\\"

DailyForecastIconCode=(?siU)\\"getSunV3DailyForecastUrlConfig\\":.*{.*\\"iconCode\\":(.*),(.*),(.*),(.*),(.*),(.*),(.*),(.*),(.*),(.*),(.*),(.*),(.*),(.*),(.*),(.*),.*

DailyForecastDetails=(?siU)\\"getSunV3DailyForecastUrlConfig\\":.*{.*\\"iconCode\\":.*\\"narrative\\":(.*),\\"(.*)\\",\\"(.*)\\",\\"(.*)\\",\\"(.*)\\",\\"(.*)\\",\\"(.*)\\",\\"(.*)\\",\\"(.*)\\",\\"(.*)\\",\\"(.*)\\",\\"(.*)\\",\\"(.*)\\",\\"(.*)\\",\\"(.*)\\",\\"(.*)\\"

DailyForecastPrecip=(?siU)\\"getSunV3DailyForecastUrlConfig\\":.*{.*\\"precipChance\\":(.*),(.*),(.*),(.*),(.*),(.*),(.*),(.*),(.*),(.*),(.*),(.*),(.*),(.*),(.*),(.*),.*

DailyForecastCondition=(?siU)\\"getSunV3DailyForecastUrlConfig\\":.*{.*\\"wxPhraseLong\\":(.*),\\"(.*)\\",\\"(.*)\\",\\"(.*)\\",\\"(.*)\\",\\"(.*)\\",\\"(.*)\\",\\"(.*)\\",\\"(.*)\\",\\"(.*)\\",\\"(.*)\\",\\"(.*)\\",\\"(.*)\\",\\"(.*)\\",\\"(.*)\\",\\"(.*)\\"

HourlyForecastIconCode=(?siU)\\"getSunV3HourlyForecastUrlConfig\\":.*{.*\\"iconCode\\":(.*),(.*),(.*),(.*),(.*),(.*),(.*),(.*),(.*),(.*),(.*),(.*),.*

HourlyForecastPrecip=(?siU)\\"getSunV3HourlyForecastUrlConfig\\":.*{.*\\"precipChance\\":(.*),(.*),(.*),(.*),(.*),(.*),(.*),(.*),(.*),(.*),(.*),(.*),.*

HourlyForecastTemp=(?siU)\\"getSunV3HourlyForecastUrlConfig\\":.*{.*\\"temperature\\":(.*),(.*),(.*),(.*),(.*),(.*),(.*),(.*),(.*),(.*),(.*),(.*),.*

HourlyForecastHour=(?siU)\\"getSunV3HourlyForecastUrlConfig\\":.*{.*\\"validTimeLocal\\":.*\\"(.*)\\",\\"(.*)\\",\\"(.*)\\",\\"(.*)\\",\\"(.*)\\",\\"(.*)\\",\\"(.*)\\",\\"(.*)\\",\\"(.*)\\",\\"(.*)\\",\\"(.*)\\",\\"(.*)\\"

HourlyForecastCondition=(?siU)\\"getSunV3HourlyForecastUrlConfig\\":.*{.*\\"wxPhraseLong\\":(.*),\\"(.*)\\",\\"(.*)\\",\\"(.*)\\",\\"(.*)\\",\\"(.*)\\",\\"(.*)\\",\\"(.*)\\",\\"(.*)\\",\\"(.*)\\",\\"(.*)\\",\\"(.*)\\"

WeatherAlert=(?siU)\\"getSunWeatherAlertHeadlinesUrlConfig\\":.*{.*,\\"alerts\\":.*(?(?=.*{\\"detailKey\\").*:\\".*\\",.*,\\"eventDescription\\":\\"(.*)\\",\\"severityCode\\":(.*),\\"severity\\":\\"(.*)\\",.*,\\"headlineText\\":\\"(.*)\\",.*}).*(?(?=.*{\\"detailKey\\").*:\\".*\\",.*,\\"eventDescription\\":\\"(.*)\\",\\"severityCode\\":(.*),\\"severity\\":\\"(.*)\\",.*,\\"headlineText\\":\\"(.*)\\",.*}).*(?(?=.*{\\"detailKey\\").*:\\".*\\",.*,\\"eventDescription\\":\\"(.*)\\",\\"severityCode\\":(.*),\\"severity\\":\\"(.*)\\",.*,\\"headlineText\\":\\"(.*)\\",.*}).*(?(?=.*{\\"detailKey\\").*:\\".*\\",.*,\\"eventDescription\\":\\"(.*)\\",\\"severityCode\\":(.*),\\"severity\\":\\"(.*)\\",.*,\\"headlineText\\":\\"(.*)\\",.*}).*(?(?=.*{\\"detailKey\\").*:\\".*\\",.*,\\"eventDescription\\":\\"(.*)\\",\\"severityCode\\":(.*),\\"severity\\":\\"(.*)\\",.*,\\"headlineText\\":\\"(.*)\\",.*}).*(?(?=.*{\\"detailKey\\").*:\\".*\\",.*,\\"eventDescription\\":\\"(.*)\\",\\"severityCode\\":(.*),\\"severity\\":\\"(.*)\\",.*,\\"headlineText\\":\\"(.*)\\",.*}).*(?(?=.*{\\"detailKey\\").*:\\".*\\",.*,\\"eventDescription\\":\\"(.*)\\",\\"severityCode\\":(.*),\\"severity\\":\\"(.*)\\",.*,\\"headlineText\\":\\"(.*)\\",.*}).*(?(?=.*{\\"detailKey\\").*:\\".*\\",.*,\\"eventDescription\\":\\"(.*)\\",\\"severityCode\\":(.*),\\"severity\\":\\"(.*)\\",.*,\\"headlineText\\":\\"(.*)\\",.*}).*

PollenForecastDayPart=(?siU)\\"getSunIndexPollenDaypartUrlConfig\\":.*{.*\\"daypartName\\":(.*),\\"(.*)\\",\\"(.*)\\",\\"(.*)\\",\\"(.*)\\",\\"(.*)\\",\\"(.*)\\",\\"(.*)\\"

PollenForecastGrassPollenIndex=(?siU)\\"getSunIndexPollenDaypartUrlConfig\\":.*{.*\\"grassPollenIndex\\":(.*),(.*),(.*),(.*),(.*),(.*),(.*),(.*),.*}

PollenForecastGrassPollenCategory=(?siU)\\"getSunIndexPollenDaypartUrlConfig\\":.*{.*\\"grassPollenCategory\\":.*\\"(.*)\\",\\"(.*)\\",\\"(.*)\\",\\"(.*)\\",\\"(.*)\\",\\"(.*)\\",\\"(.*)\\",\\"(.*)\\".*

PollenForecastTreePollenIndex=(?siU)\\"getSunIndexPollenDaypartUrlConfig\\":.*{.*\\"treePollenIndex\\":(.*),(.*),(.*),(.*),(.*),(.*),(.*),(.*),.*

PollenForecastTreePollenCategory=(?siU)\\"getSunIndexPollenDaypartUrlConfig\\":.*{.*\\"treePollenCategory\\":.*\\"(.*)\\",\\"(.*)\\",\\"(.*)\\",\\"(.*)\\",\\"(.*)\\",\\"(.*)\\",\\"(.*)\\",\\"(.*)\\".*

PollenForecastRagweedPollenIndex=(?siU)\\"getSunIndexPollenDaypartUrlConfig\\":.*{.*\\"ragweedPollenIndex\\":(.*),(.*),(.*),(.*),(.*),(.*),(.*),(.*),.*

PollenForecastRagweedPollenCategory=(?siU)\\"getSunIndexPollenDaypartUrlConfig\\":.*{.*\\"ragweedPollenCategory\\":.*\\"(.*)\\",\\"(.*)\\",\\"(.*)\\",\\"(.*)\\",\\"(.*)\\",\\"(.*)\\",\\"(.*)\\",\\"(.*)\\".*

AirQuality=(?siU)\\"getSunV3GlobalAirQualityUrlConfig\\":.*{.*\\"airQualityIndex\\":(.*),\\"airQualityCategory\\":\\"(.*)\\",.*,\\"primaryPollutant\\":\\"(.*)\\"

PollutantNO2=(?siU)\\"getSunV3GlobalAirQualityUrlConfig\\":.*{.*\\"pollutants\\":{\\"NO2\\":{\\"name\\":\\"(.*)\\",\\"phrase\\":\\"(.*)\\",\\"amount\\":(.*),\\"unit\\":\\"(.*)\\",\\"category\\":\\"(.*)\\",.*}

PollutantO3=(?siU)\\"getSunV3GlobalAirQualityUrlConfig\\":.*{.*\\"pollutants\\":{.*\\"O3\\":{\\"name\\":\\"(.*)\\",\\"phrase\\":\\"(.*)\\",\\"amount\\":(.*),\\"unit\\":\\"(.*)\\",\\"category\\":\\"(.*)\\",.*}

PollutantSO2=(?siU)\\"getSunV3GlobalAirQualityUrlConfig\\":.*{.*\\"pollutants\\":{.*\\"SO2\\":{\\"name\\":\\"(.*)\\",\\"phrase\\":\\"(.*)\\",\\"amount\\":(.*),\\"unit\\":\\"(.*)\\",\\"category\\":\\"(.*)\\",.*}

PollutantPM2.5=(?siU)\\"getSunV3GlobalAirQualityUrlConfig\\":.*{.*\\"pollutants\\":{.*\\"PM2.5\\":{\\"name\\":\\"(.*)\\",\\"phrase\\":\\"(.*)\\",\\"amount\\":(.*),\\"unit\\":\\"(.*)\\",\\"category\\":\\"(.*)\\",.*}

PollutantPM10=(?siU)\\"getSunV3GlobalAirQualityUrlConfig\\":.*{.*\\"pollutants\\":{.*\\"PM10\\":{\\"name\\":\\"(.*)\\",\\"phrase\\":\\"(.*)\\",\\"amount\\":(.*),\\"unit\\":\\"(.*)\\",\\"category\\":\\"(.*)\\",.*}

PollutantCO=(?siU)\\"getSunV3GlobalAirQualityUrlConfig\\":.*{.*\\"pollutants\\":{.*\\"CO\\":{\\"name\\":\\"(.*)\\",\\"phrase\\":\\"(.*)\\",\\"amount\\":(.*),\\"unit\\":\\"(.*)\\",\\"category\\":\\"(.*)\\",.*}

AirQualitySensitiveGroupMessage=(?siU)\\"getSunV3GlobalAirQualityUrlConfig\\":.*{.*\\"messages\\":{\\"Sensitive Group\\":{\\"title\\":\\"(.*)\\",\\"text\\":\\"(.*)\\"}

AirQualityGeneralMessage=(?siU)\\"getSunV3GlobalAirQualityUrlConfig\\":.*{.*\\"messages\\":.*\\"General\\":{\\"title\\":\\"(.*)\\",\\"text\\":\\"(.*)\\"}

WeatherParametersLabels=(?siU)\\"wxu-today-details\\":{.*,\\"feelsLike\\":\\"(.*)\\",\\"highLow\\":\\"(.*)\\",\\"wind\\":\\"(.*)\\",\\"humidity\\":\\"(.*)\\",\\"dewPoint\\":\\"(.*)\\",\\"pressure\\":\\"(.*)\\",\\"uvIndex\\":\\"(.*)\\",\\"visibility\\":\\"(.*)\\",\\"moonPhase\\":\\"(.*)\\".*}

AirQualityLabels=(?siU)\\"wxu-air-quality\\":{\\"airQuality\\":\\"(.*)\\".*}

PollenLabels=(?siU)\\"wxu-allergy-pollen\\":{.*,\\"grassPollen\\":\\"(.*)\\",\\"ragweedPollen\\":\\"(.*)\\",\\"treePollen\\":\\"(.*)\\",.*}

WeatherParametersUnits=(?siU)\\"wxu-general\\":{\\"noData\\":\\".*\\",\\"mph\\":\\"(.*)\\",\\"km.*h\\":\\"(.*)\\",\\"in\\":\\"(.*)\\",\\"mb\\":\\"(.*)\\",\\"mi\\":\\"(.*)\\",\\"km\\":\\"(.*)\\",.*}




; © 2020 by xxenium
User avatar
jsmorley
Developer
Posts: 22628
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, 3:22 pm Hmmm. I don't see any RegExp file bundled in that zip. Looking in those files I see nothing that looks like the RegExp file I'm using. To use these files may take a full rewrite of my output file I'm thinking. :confused:

Coding for RegExp file I'm using by author xxenium:
I don't know, you will need to contact xxenium about this. That particular skin you are using is not using the @Include .inc files I developed, and yeah, to use them would require a complete re-write of the skin for sure.

One thing that everyone needs to be aware of is that we haven't yet figured out how to get some of the information like "hourly forecast", "air quality", "pollen levels" from the API yet, and that stuff won't be available in the short term.

"hourly forecast" I think I see how to get, and will likely create a new .inc file at some point for that information. The others are still a mystery.
SCR
Posts: 60
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: July 31st, 2020, 5:49 pm Ok, I think I have fully addressed the new issues with the weather.com site.

Please get the .rmskin at: https://forum.rainmeter.net/viewtopic.php?f=118&t=34628#p171501

Alternatively, if you have a skin that YOU wrote that was based on the @Include .inc files that come with this skin, you can simply get this:

@Includes.zip


And copy all the .inc files from that .zip into the @Resources folder of your skin.

ONE IMPORTANT NOTE!

The new approach of using the API for the weather.com JSON requires a change to how you access a particular location.

All of the location "codes", like USVA0944 or bbd510e73cb5870f973cea9253bb1f9bfe239a129dfc2b89589cbb6d2d46b4bc or 22308 and such are NO LONGER SUPPORTED.

The new approach requires that you provide a Latitude and Longitude in the WeatherComJSONVariables.inc file. See that file for details on how you can get that for your location.

Please read WeatherCOMJSONVariables.inc carefully, it HAS changed.
Wow, you sure have been busy. I downloaded your new Weather.com skin, I like to make the changes to the WeatherComJSONVariables.inc there so I have a way to check my skin, copied all the needed *.inc files in to my skin and everything worked perfectly with one exception. I had to add two measures to my SpecialMeasures.inc file. The [@CurrentVisibilityDistance] was showing a result of 10.0000. I passed it through a calc measure and it's now showing 10.

Here is the code I added:

Code: Select all

[Visibility]
Measure=WebParser
URL=[@CurrentConditionsParent]
StringIndex=18
RegExpSubstitute=1
Substitute=#CommonSubstitute#

[VisibilityDistance]
Measure=Calc
Formula=Visibility
Thanks to you and everyone else that has contributed to this on going project. Obviously it's something I would never be able to do. I appreciate all your hard work.
DougS2K
Posts: 13
Joined: July 26th, 2020, 6:33 pm

Re: Weather Skins Not Working

Post by DougS2K »

jsmorley wrote: August 1st, 2020, 3:30 pm I don't know, you will need to contact xxenium about this. That particular skin you are using is not using the @Include .inc files I developed, and yeah, to use them would require a complete re-write of the skin for sure.

One thing that everyone needs to be aware of is that we haven't yet figured out how to get some of the information like "hourly forecast", "air quality", "pollen levels" from the API yet, and that stuff won't be available in the short term.
Ok thanks anyways. The worst part is I just finished this skin about a week ago. :lol: I may try to rewrite the skin or just wait and see if xxenium fix the regexp in the near future.
User avatar
jsmorley
Developer
Posts: 22628
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

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

Post by jsmorley »

SCR wrote: August 1st, 2020, 3:35 pm Wow, you sure have been busy. I downloaded your new Weather.com skin, I like to make the changes to the WeatherComJSONVariables.inc there so I have a way to check my skin, copied all the needed *.inc files in to my skin and everything worked perfectly with one exception. I had to add two measures to my SpecialMeasures.inc file. The [@CurrentVisibilityDistance] was showing a result of 10.0000. I passed it through a calc measure and it's now showing 10.

Here is the code I added:

Code: Select all

[Visibility]
Measure=WebParser
URL=[@CurrentConditionsParent]
StringIndex=18
RegExpSubstitute=1
Substitute=#CommonSubstitute#

[VisibilityDistance]
Measure=Calc
Formula=Visibility
Thanks to you and everyone else that has contributed to this on going project. Obviously it's something I would never be able to do. I appreciate all your hard work.
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","^([\d]+)$":"\1.0"
Now that is "truncating", not "rounding", (or adding a ".0" to the end of a whole number) 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 consistency in "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'd be tempted to show at least one decimal place.

This behavior by the API is a bit puzzling really. I don't really understand why they return a string of "10.000", when that is clearly just 10. While I consider this bad programming, I'd be less confused by it if Wind Speed did the same thing, but it doesn't... mph and km/h are both in whole numbers.
User avatar
jsmorley
Developer
Posts: 22628
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, 3:37 pm Ok thanks anyways. The worst part is I just finished this skin about a week ago. :lol: I may try to rewrite the skin or just wait and see if xxenium fix the regexp in the near future.
My advice is to re-write it. Use this:

https://forum.rainmeter.net/viewtopic.php?f=118&t=34628

As the starting point, then write your skin around the @Include .inc files I provide. I don't know what route xxenium is taking as he fixes the skins he distributes, but from my own personal perspective, I can only recommend that all weather skins that want weather.com consider using the .inc files I provide. To each his own, and there are more ways than one to skin a cat, but I can't help at all with any other approach. Only the author can do that.
User avatar
Yincognito
Rainmeter Sage
Posts: 7023
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: Weather Skins Not Working

Post by Yincognito »

jsmorley wrote: August 1st, 2020, 3:30 pmOne thing that everyone needs to be aware of is that we haven't yet figured out how to get some of the information like "hourly forecast", "air quality", "pollen levels" from the API yet, and that stuff won't be available in the short term.

"hourly forecast" I think I see how to get, and will likely create a new .inc file at some point for that information. The others are still a mystery.
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.
Post Reply