It is currently April 19th, 2024, 4:32 pm

Weather et DarkSky API

Get help with creating, editing & fixing problems with skins
PtitChat107
Posts: 126
Joined: December 31st, 2015, 6:40 pm

Weather et DarkSky API

Post by PtitChat107 »

For some days now I try in vain to finish my project of recovery the infos of the workshop of the site of DarkSky.net API. I wanted to mix the Illustro's model and the "VClouds Weather 2"'s project and I think it can give you something very interesting and very reliable.
It is possible to achieve 1000 calls per day with this API, which is more than enough to carry out a data update over a period of 15 minutes.

Data:
-- Currently
- Summary
- Temperature
- WindSpeed
- WindBearing
- Humidity
- UV Index
-- Daily
--- Data
---- 0
- TemperatureMin
- TemperatureMax

I hope someone can help me finish this project and correct any errors I might have made :oops:

On the other hand I would like to find a solution concerning the conversion of the "WindBearing" data (which is in degrees) directly in "direction" (N, NNE, E, etc.); And also the moisture content that will need to be multiplied by 100 to make it more readable.

I was thinking of something like this: WindBearing = X
If X: 0 included < x < 45 included also = NE
If X: 45 < x < 90 also = ENE
etc.

Image
User avatar
eclectic-tech
Rainmeter Sage
Posts: 5396
Joined: April 12th, 2012, 9:40 pm
Location: Cedar Point, Ohio, USA

Re: Weather et DarkSky API

Post by eclectic-tech »

I haven't look into your skin package, but I have used a scheme given by kaelri to obtain the cardinal directions from the wind direction given by sites.

This post has the details: https://forum.rainmeter.net/viewtopic.php?f=119&t=8970
PtitChat107
Posts: 126
Joined: December 31st, 2015, 6:40 pm

Re: Weather et DarkSky API

Post by PtitChat107 »

Thank you is exactly what I was looking for, provided in any case that my model can be useful to someone until it is finished :)
By adapting to my own version, that's what it gives:

Code: Select all

;WindBearing
[measureW6]
Measure=Plugin
Plugin=WebParser.dll
Url=[measureW0]
StringIndex=3
Substitute="":"..."
[MeasureCardinal]
Measure=Calc
Formula=FLOOR(((measureW6/11.25)+1.5) < 33 ? ((measureW6/11.25)+1.5) : ((measureW6/11.25)+1.5)-32)
Substitute="10":"EbS","11":"ESE","12":"SEbE","13":"SE","14":"SEbS","15":"SSE","16":"SbE","17":"S","18":"SbW","19":"SSW","20":"SWbS","21":"SW","22":"SWbW","23":"WSW","24":"WbSW","25":"W","26":"WbN","27":"WNW","28":"NWbW","29":"NW","30":"NWbN","31":"NNW","32":"NbW","1":"N","2":"NbE","3":"NNE","4":"NEbN","5":"NE","6":"NEbE","7":"ENE","8":"EbN","9":"E"

[meterValueWind]
Meter=STRING
MeterStyle=styleRightText
MeasureName=measureW5
MeasureName2=MeasureCardinal
X=200
Y=0r
W=190
H=14
Text="%1 km/h (%2)"
PtitChat107
Posts: 126
Joined: December 31st, 2015, 6:40 pm

Re: Weather et DarkSky API

Post by PtitChat107 »

I was able to find the capture line for the information but impossible to have a visual in Rainmeter :uhuh:

Code: Select all

;ConditionsWeather
[measureW0]
Measure=Plugin
Plugin=WebParser.dll
UpdateRate=900
Url=https://api.darksky.net/forecast/35d7c01cab2800226ab119e73cc03220/37.8267,-122.4233?lang=fr&units=ca&exclude=hourly,flags
RegExp=(?siU)summary":"(.*)".*temperature":"(.*)".*humidity":"(.*)".*windSpeed":"(.*)".*windBearing":"(.*)".*uvIndex":"(.*)".*temperatureMin":"(.*)".*temperatureMax":"(.*)"
User avatar
FreeRaider
Posts: 826
Joined: November 20th, 2012, 11:58 pm

Re: Weather et DarkSky API

Post by FreeRaider »

Code: Select all

RexExp=(?siU).*summary":(.*),.*temperature":(.*),.*humidity":(.*),.*windSpeed":(.*),.*windBearing":(.*),.*uvIndex":(.*),.*temperatureMin":(.*),.*temperatureMax":(.*),
PtitChat107
Posts: 126
Joined: December 31st, 2015, 6:40 pm

Re: Weather et DarkSky API

Post by PtitChat107 »

You may not believe me but on my side it does not seem to work :(
User avatar
FreeRaider
Posts: 826
Joined: November 20th, 2012, 11:58 pm

Re: Weather et DarkSky API

Post by FreeRaider »

PtitChat107 wrote:You may not believe me but on my side it does not seem to work :(
Sorry it is REGEXP and not rexexp
User avatar
FreeRaider
Posts: 826
Joined: November 20th, 2012, 11:58 pm

Re: Weather et DarkSky API

Post by FreeRaider »

Example code:

Code: Select all

[Rainmeter]
Update=1000
AccurateText=1
DynamicWindowSize=1
BackgroundMode=2
SolidColor=0,0,0,255

[Metadata]
Name=
Author=FreeRaider
Information=
Version=
License=Creative Commons Attribution - Non - Commercial - Share Alike 3.0


[MeasureParent]
Measure=Plugin
Plugin=WebParser
Url=https://api.darksky.net/forecast/35d7c01cab2800226ab119e73cc03220/37.8267,-122.4233?lang=fr&units=ca&exclude=hourly,flags
RegExp=(?siU).*summary":(.*),.*temperature":(.*),.*humidity":(.*),.*windSpeed":(.*),.*windBearing":(.*),.*uvIndex":(.*),.*temperatureMin":(.*),.*temperatureMax":(.*),
UpdateRate=600
FinishAction=[!EnableMeasureGroup Measures][!UpdateMeasureGroup Measures]

[MeasureSummary]
Measure=Plugin
Plugin=WebParser
URL=[MeasureParent]
StringIndex=1
Disabled=1
Group=Measures

[MeasureTemperature]
Measure=Plugin
Plugin=WebParser
URL=[MeasureParent]
StringIndex=2
Disabled=1
Group=Measures

[MeasureHumidity]
Measure=Plugin
Plugin=WebParser
URL=[MeasureParent]
StringIndex=3
Disabled=1
Group=Measures

[MeterSummary]
Meter=String
MeasureName=MeasureSummary
FontSize=14
FontColor=222,255,227,255
StringStyle=Bold
AntiAlias=1

[MeterTemperature]
Meter=String
MeasureName=MeasureTemperature
Y=2R
FontSize=11
FontColor=255,255,255,255
StringStyle=Bold
AntiAlias=1
DynamicVariables=1

[MeterHumidity]
Meter=String
MeasureName=MeasureHumidity
Y=2R
FontSize=11
FontColor=255,255,255,255
StringStyle=Bold
AntiAlias=1
DynamicVariables=1
weather.PNG
You do not have the required permissions to view the files attached to this post.
PtitChat107
Posts: 126
Joined: December 31st, 2015, 6:40 pm

Re: Weather et DarkSky API

Post by PtitChat107 »

Thanks FreeRaider but in the meantime I managed to find an example for use with a JSON file and I was able to finish writing the project, I had just a few problems with the RegExp :oops: The only small detail that remains to me is about the moisture content that I have to multiply by 100 to have a more understandable display.
User avatar
FreeRaider
Posts: 826
Joined: November 20th, 2012, 11:58 pm

Re: Weather et DarkSky API

Post by FreeRaider »

Code: Select all

[MeterHumidity]
Meter=String
Y=2R
FontSize=11
FontColor=255,255,255,255
StringStyle=Bold
AntiAlias=1
Text="[MeasureHumidity:%]%"
DynamicVariables=1