mirror of
https://github.com/MichMich/MagicMirror.git
synced 2025-06-29 04:29:41 +00:00
option to show rain amount
This commit is contained in:
parent
84dc1fa151
commit
bd49bd6e33
@ -72,6 +72,14 @@ The following properties can be configured:
|
|||||||
<br>This value is optional. By default the weatherforecast module will return 7 days.
|
<br>This value is optional. By default the weatherforecast module will return 7 days.
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td><code>showRainAmount</code></td>
|
||||||
|
<td>Should the predicted rain amount be displayed?<br>
|
||||||
|
<br><b>Possible values:</b> <code>true</code> or <code>false</code>
|
||||||
|
<br><b>Default value:</b> <code>false</code>
|
||||||
|
<br>This value is optional. By default the weatherforecast module will not display the predicted amount of rain.
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td><code>updateInterval</code></td>
|
<td><code>updateInterval</code></td>
|
||||||
<td>How often does the content needs to be fetched? (Milliseconds)<br>
|
<td>How often does the content needs to be fetched? (Milliseconds)<br>
|
||||||
|
@ -12,3 +12,8 @@
|
|||||||
padding-left: 20px;
|
padding-left: 20px;
|
||||||
padding-right: 0;
|
padding-right: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.weatherforecast .rain {
|
||||||
|
padding-left: 20px;
|
||||||
|
padding-right: 0;
|
||||||
|
}
|
||||||
|
@ -16,6 +16,7 @@ Module.register("weatherforecast",{
|
|||||||
appid: "",
|
appid: "",
|
||||||
units: config.units,
|
units: config.units,
|
||||||
maxNumberOfDays: 7,
|
maxNumberOfDays: 7,
|
||||||
|
showRainAmount: false,
|
||||||
updateInterval: 10 * 60 * 1000, // every 10 minutes
|
updateInterval: 10 * 60 * 1000, // every 10 minutes
|
||||||
animationSpeed: 1000,
|
animationSpeed: 1000,
|
||||||
timeFormat: config.timeFormat,
|
timeFormat: config.timeFormat,
|
||||||
@ -142,6 +143,17 @@ Module.register("weatherforecast",{
|
|||||||
minTempCell.className = "align-right min-temp";
|
minTempCell.className = "align-right min-temp";
|
||||||
row.appendChild(minTempCell);
|
row.appendChild(minTempCell);
|
||||||
|
|
||||||
|
if (this.config.showRainAmount) {
|
||||||
|
var rainCell = document.createElement("td");
|
||||||
|
if (isNaN(forecast.rain)) {
|
||||||
|
rainCell.innerHTML = "";
|
||||||
|
} else {
|
||||||
|
rainCell.innerHTML = forecast.rain + " mm";
|
||||||
|
}
|
||||||
|
rainCell.className = "align-right bright rain";
|
||||||
|
row.appendChild(rainCell);
|
||||||
|
}
|
||||||
|
|
||||||
if (this.config.fade && this.config.fadePoint < 1) {
|
if (this.config.fade && this.config.fadePoint < 1) {
|
||||||
if (this.config.fadePoint < 0) {
|
if (this.config.fadePoint < 0) {
|
||||||
this.config.fadePoint = 0;
|
this.config.fadePoint = 0;
|
||||||
@ -280,7 +292,8 @@ Module.register("weatherforecast",{
|
|||||||
day: moment(forecast.dt, "X").format("ddd"),
|
day: moment(forecast.dt, "X").format("ddd"),
|
||||||
icon: this.config.iconTable[forecast.weather[0].icon],
|
icon: this.config.iconTable[forecast.weather[0].icon],
|
||||||
maxTemp: this.roundValue(forecast.temp.max),
|
maxTemp: this.roundValue(forecast.temp.max),
|
||||||
minTemp: this.roundValue(forecast.temp.min)
|
minTemp: this.roundValue(forecast.temp.min),
|
||||||
|
rain: this.roundValue(forecast.rain)
|
||||||
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user