diff --git a/modules/default/currentweather/README.md b/modules/default/currentweather/README.md
index 2a6f7844..e0bb392f 100644
--- a/modules/default/currentweather/README.md
+++ b/modules/default/currentweather/README.md
@@ -63,6 +63,13 @@ The following properties can be configured:
Default value: config.units
+
+ roundTemperature |
+ Round temperature value to nearest integer.
+ Possible values: true (round to integer) or false (display exact value with decimal point)
+ Default value: false
+ |
+
updateInterval |
How often does the content needs to be fetched? (Milliseconds)
diff --git a/modules/default/currentweather/currentweather.js b/modules/default/currentweather/currentweather.js
index 5265b099..ea548f80 100644
--- a/modules/default/currentweather/currentweather.js
+++ b/modules/default/currentweather/currentweather.js
@@ -15,6 +15,7 @@ Module.register("currentweather",{
locationID: "",
appid: "",
units: config.units,
+ roundTemperature: false,
updateInterval: 10 * 60 * 1000, // every 10 minutes
animationSpeed: 1000,
timeFormat: config.timeFormat,
@@ -149,9 +150,13 @@ Module.register("currentweather",{
weatherIcon.className = "wi weathericon " + this.weatherType;
large.appendChild(weatherIcon);
+ var temp = this.temperature;
+ if (this.config.roundTemperature) {
+ temp = Math.round(temp);
+ }
var temperature = document.createElement("span");
temperature.className = "bright";
- temperature.innerHTML = " " + this.temperature + "°";
+ temperature.innerHTML = " " + temp + "°";
large.appendChild(temperature);
wrapper.appendChild(small);
diff --git a/modules/default/weatherforecast/README.md b/modules/default/weatherforecast/README.md
index aba03a41..a2492f70 100644
--- a/modules/default/weatherforecast/README.md
+++ b/modules/default/weatherforecast/README.md
@@ -63,6 +63,13 @@ The following properties can be configured:
Default value: config.units
|
+
+ roundTemperature |
+ Round temperature values to nearest integer.
+ Possible values: true (round to integer) or false (display exact value with decimal point)
+ Default value: false
+ |
+
maxNumberOfDays |
How many days of forecast to return. Specified by config.js
diff --git a/modules/default/weatherforecast/weatherforecast.js b/modules/default/weatherforecast/weatherforecast.js
index a8a8ca6c..006dd685 100644
--- a/modules/default/weatherforecast/weatherforecast.js
+++ b/modules/default/weatherforecast/weatherforecast.js
@@ -15,6 +15,7 @@ Module.register("weatherforecast",{
locationID: "",
appid: "",
units: config.units,
+ roundTemperature: false,
maxNumberOfDays: 7,
updateInterval: 10 * 60 * 1000, // every 10 minutes
animationSpeed: 1000,
@@ -129,13 +130,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);
@@ -289,3 +297,4 @@ Module.register("weatherforecast",{
return parseFloat(temperature).toFixed(1);
}
});
+
|