diff --git a/CHANGELOG.md b/CHANGELOG.md index 082c8c9d..1a68603f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -17,6 +17,7 @@ This project adheres to [Semantic Versioning](http://semver.org/). - Add advanced filtering to the excludedEvents configuration of the default calendar module - New currentweather module config option: `showFeelsLike`: Shows how it actually feels like. (wind chill or heat index) - New currentweather module config option: `useKMPHwind`: adds an option to see wind speed in Kmph instead of just m/s or Beaufort. +- Add dc:date to parsing in newsfeed module, which allows parsing of more rss feeds. ### Changed - Add link to GitHub repository which contains the respective Dockerfile. @@ -26,7 +27,7 @@ This project adheres to [Semantic Versioning](http://semver.org/). ### Fixed - News article in fullscreen (iframe) is now shown in front of modules. -- Add dc:date to parsing in newsfeed module, which allows parsing of more rss feeds. +- Forecast respects maxNumberOfDays regardless of endpoint. *This release is scheduled to be released on 2018-04-01.* diff --git a/modules/default/weatherforecast/weatherforecast.js b/modules/default/weatherforecast/weatherforecast.js index 22322bf3..a95347d9 100644 --- a/modules/default/weatherforecast/weatherforecast.js +++ b/modules/default/weatherforecast/weatherforecast.js @@ -259,7 +259,6 @@ Module.register("weatherforecast",{ if (self.config.forecastEndpoint == "forecast/daily") { self.config.forecastEndpoint = "forecast"; - self.config.maxNumberOfDays = self.config.maxNumberOfDays * 8; Log.warn(self.name + ": Your AppID does not support long term forecasts. Switching to fallback endpoint."); } @@ -298,12 +297,6 @@ Module.register("weatherforecast",{ 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 * 8 : this.config.maxNumberOfDays); params += "&APPID=" + this.config.appid; return params; @@ -354,6 +347,11 @@ Module.register("weatherforecast",{ this.forecast.push(forecastData); lastDay = day; + + // Stop processing when maxNumberOfDays is reached + if (this.forecast.length === this.config.maxNumberOfDays) { + break; + } } else { //Log.log("Compare max: ", forecast.temp.max, parseFloat(forecastData.maxTemp)); forecastData.maxTemp = forecast.temp.max > parseFloat(forecastData.maxTemp) ? this.roundValue(forecast.temp.max) : forecastData.maxTemp;