diff --git a/CHANGELOG.md b/CHANGELOG.md index bcb7b9b7..39902b38 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -19,6 +19,7 @@ This project adheres to [Semantic Versioning](http://semver.org/). - Module API: Option to define the minimumn MagicMirror version to run a module. [See documentation](https://github.com/MichMich/MagicMirror/tree/develop/modules#requiresversion) for more information. - Calendar module now broadcasts the event list to all other modules using the notification system. [See documentation](https://github.com/MichMich/MagicMirror/tree/develop/modules/default/calendar) for more information. - Possibility to use the the calendar feed as the source for the weather (currentweather & weatherforecast) location data. [See documentation](https://github.com/MichMich/MagicMirror/tree/develop/modules/default/weatherforecast) for more information. +- Added option to show rain amount in the weatherforecast default module ### Updated - Modified translations for Frysk. diff --git a/modules/default/weatherforecast/README.md b/modules/default/weatherforecast/README.md index a1df57c1..0d321aa3 100644 --- a/modules/default/weatherforecast/README.md +++ b/modules/default/weatherforecast/README.md @@ -72,6 +72,14 @@ The following properties can be configured:
This value is optional. By default the weatherforecast module will return 7 days. + + showRainAmount + Should the predicted rain amount be displayed?
+
Possible values: true or false +
Default value: false +
This value is optional. By default the weatherforecast module will not display the predicted amount of rain. + + updateInterval How often does the content needs to be fetched? (Milliseconds)
diff --git a/modules/default/weatherforecast/weatherforecast.css b/modules/default/weatherforecast/weatherforecast.css index 7b12c42d..62c9767f 100644 --- a/modules/default/weatherforecast/weatherforecast.css +++ b/modules/default/weatherforecast/weatherforecast.css @@ -12,3 +12,8 @@ padding-left: 20px; padding-right: 0; } + +.weatherforecast .rain { + padding-left: 20px; + padding-right: 0; +} diff --git a/modules/default/weatherforecast/weatherforecast.js b/modules/default/weatherforecast/weatherforecast.js index 7119f79e..7f3ef71d 100644 --- a/modules/default/weatherforecast/weatherforecast.js +++ b/modules/default/weatherforecast/weatherforecast.js @@ -16,6 +16,7 @@ Module.register("weatherforecast",{ appid: "", units: config.units, maxNumberOfDays: 7, + showRainAmount: false, updateInterval: 10 * 60 * 1000, // every 10 minutes animationSpeed: 1000, timeFormat: config.timeFormat, @@ -142,6 +143,17 @@ Module.register("weatherforecast",{ minTempCell.className = "align-right min-temp"; 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.fadePoint < 0) { this.config.fadePoint = 0; @@ -280,7 +292,8 @@ Module.register("weatherforecast",{ day: moment(forecast.dt, "X").format("ddd"), icon: this.config.iconTable[forecast.weather[0].icon], maxTemp: this.roundValue(forecast.temp.max), - minTemp: this.roundValue(forecast.temp.min) + minTemp: this.roundValue(forecast.temp.min), + rain: this.roundValue(forecast.rain) }); }