diff --git a/MMM-OpenWeatherForecast.js b/MMM-OpenWeatherForecast.js index 04f7b4c..40e24c9 100644 --- a/MMM-OpenWeatherForecast.js +++ b/MMM-OpenWeatherForecast.js @@ -276,29 +276,29 @@ Module.register("MMM-OpenWeatherForecast", { socketNotificationReceived(notification, payload) { if (notification == "OPENWEATHER_FORECAST_DATA" && payload.instanceId == this.identifier) { + if (typeof payload.current !== "undefined"){ + //clear animated icon cache + if (this.config.useAnimatedIcons) { + this.clearIcons(); + } - //clear animated icon cache - if (this.config.useAnimatedIcons) { - this.clearIcons(); - } - - //process weather data - this.weatherData = payload; - this.formattedWeatherData = this.processWeatherData(); - - this.updateDom(this.config.updateFadeSpeed); + //process weather data + this.weatherData = payload; + this.formattedWeatherData = this.processWeatherData(); - //broadcast weather update - this.sendNotification("OPENWEATHER_FORECAST_WEATHER_UPDATE", payload); + this.updateDom(this.config.updateFadeSpeed); - //start icon playback - if (this.config.useAnimatedIcons) { - var self = this; - setTimeout(function () { - self.playIcons(self); - }, this.config.updateFadeSpeed + this.config.animatedIconStartDelay); - } + //broadcast weather update + this.sendNotification("OPENWEATHER_FORECAST_WEATHER_UPDATE", payload); + //start icon playback + if (this.config.useAnimatedIcons) { + var self = this; + setTimeout(function () { + self.playIcons(self); + }, this.config.updateFadeSpeed + this.config.animatedIconStartDelay); + } + } } diff --git a/node_helper.js b/node_helper.js index a68611c..202d10a 100644 --- a/node_helper.js +++ b/node_helper.js @@ -66,7 +66,9 @@ module.exports = NodeHelper.create({ self.sendSocketNotification("OPENWEATHER_FORECAST_DATA", data); } }) - .catch(error => Log.error("[MMM-OpenWeatherForecast] " + moment().format("D-MMM-YY HH:mm") + " ** ERROR ** " + error+"\n"+error.stack)); + .catch(error => { + Log.error("[MMM-OpenWeatherForecast] " + moment().format("D-MMM-YY HH:mm") + " ** ERROR ** " + error+"\n"+error.stack) + }); } } else if (notification === "CONFIG") { self.config = payload