mirror of
https://github.com/MichMich/MagicMirror.git
synced 2025-06-29 12:39:45 +00:00
Merge pull request #274 from KirAsh4/v2-beta
V2 beta - weatherforecast maxNumberOfDays
This commit is contained in:
commit
3002a4f9b3
@ -55,6 +55,14 @@ The following properties can be configured:
|
||||
<br><b>Default value:</b> <code>config.units</code>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>maxNumberOfDays</code></td>
|
||||
<td>How many days of forecast to return. Specified by config.js<br>
|
||||
<br><b>Possible values:</b> <code>1</code> - <code>16</code>
|
||||
<br><b>Default value:</b> <code>7</code> (7 days)
|
||||
<br>This value is optional. By default the weatherforecast module will return 7 days.
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>updateInterval</code></td>
|
||||
<td>How often does the content needs to be fetched? (Milliseconds)<br>
|
||||
|
@ -14,6 +14,7 @@ Module.register("weatherforecast",{
|
||||
location: "",
|
||||
appid: "",
|
||||
units: config.units,
|
||||
maxNumberOfDays: 7,
|
||||
updateInterval: 10 * 60 * 1000, // every 10 minutes
|
||||
animationSpeed: 1000,
|
||||
timeFormat: config.timeFormat,
|
||||
@ -189,6 +190,12 @@ Module.register("weatherforecast",{
|
||||
params += "q=" + this.config.location;
|
||||
params += "&units=" + this.config.units;
|
||||
params += "&lang=" + this.config.lang;
|
||||
/*
|
||||
* Submit a specific number of days to forecast, between 1 to 16 days.
|
||||
* The OpenWeatherMap API properly handles values outside of the 1 - 16 range and returns 7 days by default.
|
||||
* This is simply being pedantic and doing it ourselves.
|
||||
*/
|
||||
params += "&cnt=" + (((this.config.maxNumberOfDays < 1) || (this.config.maxNumberOfDays > 16)) ? 7 : this.config.maxNumberOfDays);
|
||||
params += "&APPID=" + this.config.appid;
|
||||
|
||||
return params;
|
||||
|
Loading…
x
Reference in New Issue
Block a user