implemented roundTemperature in weather modules

This commit is contained in:
Olexandr Savchuk
2016-12-02 17:17:58 +01:00
parent c949548150
commit 3c33969d23
4 changed files with 31 additions and 3 deletions

View File

@@ -15,6 +15,7 @@ Module.register("weatherforecast",{
locationID: false,
appid: "",
units: config.units,
roundTemperature: false,
maxNumberOfDays: 7,
showRainAmount: false,
updateInterval: 10 * 60 * 1000, // every 10 minutes
@@ -133,13 +134,20 @@ Module.register("weatherforecast",{
icon.className = "wi weathericon " + forecast.icon;
iconCell.appendChild(icon);
var maxTemp = forecast.maxTemp;
var minTemp = forecast.minTemp;
if (this.config.roundTemperature) {
maxTemp = Math.round(maxTemp);
minTemp = Math.round(minTemp);
}
var maxTempCell = document.createElement("td");
maxTempCell.innerHTML = forecast.maxTemp;
maxTempCell.innerHTML = maxTemp;
maxTempCell.className = "align-right bright max-temp";
row.appendChild(maxTempCell);
var minTempCell = document.createElement("td");
minTempCell.innerHTML = forecast.minTemp;
minTempCell.innerHTML = minTemp;
minTempCell.className = "align-right min-temp";
row.appendChild(minTempCell);
@@ -352,3 +360,4 @@ Module.register("weatherforecast",{
return parseFloat(temperature).toFixed(1);
}
});