diff --git a/CHANGELOG.md b/CHANGELOG.md index 0cc229c7..bf7f4d32 100755 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -19,6 +19,7 @@ This project adheres to [Semantic Versioning](http://semver.org/). ### Fixed - Updatenotification module: Properly handle race conditions, prevent crash. - Send `NEWS_FEED` notification also for the first news messages which are shown +- Fixed issue where weather module would not refresh data after a network or API outage [#1722](https://github.com/MichMich/MagicMirror/issues/1722) ## [2.8.0] - 2019-07-01 diff --git a/modules/default/weather/providers/darksky.js b/modules/default/weather/providers/darksky.js index 56d2e5be..b24c4794 100755 --- a/modules/default/weather/providers/darksky.js +++ b/modules/default/weather/providers/darksky.js @@ -32,7 +32,8 @@ WeatherProvider.register("darksky", { this.setCurrentWeather(currentWeather); }).catch(function(request) { Log.error("Could not load data ... ", request); - }); + }) + .finally(() => this.updateAvailable()) }, fetchWeatherForecast() { @@ -47,7 +48,8 @@ WeatherProvider.register("darksky", { this.setWeatherForecast(forecast); }).catch(function(request) { Log.error("Could not load data ... ", request); - }); + }) + .finally(() => this.updateAvailable()) }, // Create a URL from the config and base URL. diff --git a/modules/default/weather/providers/openweathermap.js b/modules/default/weather/providers/openweathermap.js index 60d82446..e99dc476 100755 --- a/modules/default/weather/providers/openweathermap.js +++ b/modules/default/weather/providers/openweathermap.js @@ -34,6 +34,7 @@ WeatherProvider.register("openweathermap", { .catch(function(request) { Log.error("Could not load data ... ", request); }) + .finally(() => this.updateAvailable()) }, // Overwrite the fetchCurrentWeather method. @@ -54,6 +55,7 @@ WeatherProvider.register("openweathermap", { .catch(function(request) { Log.error("Could not load data ... ", request); }) + .finally(() => this.updateAvailable()) }, /** OpenWeatherMap Specific Methods - These are not part of the default provider methods */ diff --git a/modules/default/weather/providers/ukmetoffice.js b/modules/default/weather/providers/ukmetoffice.js index 2dde2ddc..47785b3b 100755 --- a/modules/default/weather/providers/ukmetoffice.js +++ b/modules/default/weather/providers/ukmetoffice.js @@ -41,6 +41,7 @@ WeatherProvider.register("ukmetoffice", { .catch(function(request) { Log.error("Could not load data ... ", request); }) + .finally(() => this.updateAvailable()) }, // Overwrite the fetchCurrentWeather method. @@ -62,6 +63,7 @@ WeatherProvider.register("ukmetoffice", { .catch(function(request) { Log.error("Could not load data ... ", request); }) + .finally(() => this.updateAvailable()) }, diff --git a/modules/default/weather/providers/weathergov.js b/modules/default/weather/providers/weathergov.js index bfecaf24..74d95522 100755 --- a/modules/default/weather/providers/weathergov.js +++ b/modules/default/weather/providers/weathergov.js @@ -35,6 +35,7 @@ WeatherProvider.register("weathergov", { .catch(function(request) { Log.error("Could not load data ... ", request); }) + .finally(() => this.updateAvailable()) }, // Overwrite the fetchCurrentWeather method. @@ -53,6 +54,7 @@ WeatherProvider.register("weathergov", { .catch(function(request) { Log.error("Could not load data ... ", request); }) + .finally(() => this.updateAvailable()) }, /** Weather.gov Specific Methods - These are not part of the default provider methods */ diff --git a/modules/default/weather/weatherprovider.js b/modules/default/weather/weatherprovider.js index 8940763a..1789b95c 100644 --- a/modules/default/weather/weatherprovider.js +++ b/modules/default/weather/weatherprovider.js @@ -79,16 +79,12 @@ var WeatherProvider = Class.extend({ setCurrentWeather: function(currentWeatherObject) { // We should check here if we are passing a WeatherDay this.currentWeatherObject = currentWeatherObject; - - this.updateAvailable(); }, // Set the weatherForecastArray and notify the delegate that new information is available. setWeatherForecast: function(weatherForecastArray) { // We should check here if we are passing a WeatherDay this.weatherForecastArray = weatherForecastArray; - - this.updateAvailable(); }, // Set the fetched location name.