diff --git a/modules/default/compliments/compliments.js b/modules/default/compliments/compliments.js index 412fe170..6613a2c8 100644 --- a/modules/default/compliments/compliments.js +++ b/modules/default/compliments/compliments.js @@ -182,34 +182,14 @@ Module.register("compliments", { }, // From data currentweather set weather type - setCurrentWeatherType: function (data) { - var weatherIconTable = { - "01d": "day_sunny", - "02d": "day_cloudy", - "03d": "cloudy", - "04d": "cloudy_windy", - "09d": "showers", - "10d": "rain", - "11d": "thunderstorm", - "13d": "snow", - "50d": "fog", - "01n": "night_clear", - "02n": "night_cloudy", - "03n": "night_cloudy", - "04n": "night_cloudy", - "09n": "night_showers", - "10n": "night_rain", - "11n": "night_thunderstorm", - "13n": "night_snow", - "50n": "night_alt_cloudy_windy" - }; - this.currentWeatherType = weatherIconTable[data.weather[0].icon]; + setCurrentWeatherType: function (type) { + this.currentWeatherType = type; }, // Override notification handler. notificationReceived: function (notification, payload, sender) { - if (notification === "CURRENTWEATHER_DATA") { - this.setCurrentWeatherType(payload.data); + if (notification === "CURRENTWEATHER_TYPE") { + this.setCurrentWeatherType(payload.type); } } }); diff --git a/modules/default/currentweather/currentweather.js b/modules/default/currentweather/currentweather.js index aa9ad43e..ae29c8b7 100644 --- a/modules/default/currentweather/currentweather.js +++ b/modules/default/currentweather/currentweather.js @@ -47,24 +47,24 @@ Module.register("currentweather", { roundTemp: false, iconTable: { - "01d": "wi-day-sunny", - "02d": "wi-day-cloudy", - "03d": "wi-cloudy", - "04d": "wi-cloudy-windy", - "09d": "wi-showers", - "10d": "wi-rain", - "11d": "wi-thunderstorm", - "13d": "wi-snow", - "50d": "wi-fog", - "01n": "wi-night-clear", - "02n": "wi-night-cloudy", - "03n": "wi-night-cloudy", - "04n": "wi-night-cloudy", - "09n": "wi-night-showers", - "10n": "wi-night-rain", - "11n": "wi-night-thunderstorm", - "13n": "wi-night-snow", - "50n": "wi-night-alt-cloudy-windy" + "01d": "day-sunny", + "02d": "day-cloudy", + "03d": "cloudy", + "04d": "cloudy-windy", + "09d": "showers", + "10d": "rain", + "11d": "thunderstorm", + "13d": "snow", + "50d": "fog", + "01n": "night-clear", + "02n": "night-cloudy", + "03n": "night-cloudy", + "04n": "night-cloudy", + "09n": "night-showers", + "10n": "night-rain", + "11n": "night-thunderstorm", + "13n": "night-snow", + "50n": "night-alt-cloudy-windy" } }, @@ -219,7 +219,7 @@ Module.register("currentweather", { if (this.config.hideTemp === false) { var weatherIcon = document.createElement("span"); - weatherIcon.className = "wi weathericon " + this.weatherType; + weatherIcon.className = "wi weathericon wi-" + this.weatherType; large.appendChild(weatherIcon); var temperature = document.createElement("span"); @@ -502,6 +502,7 @@ Module.register("currentweather", { this.loaded = true; this.updateDom(this.config.animationSpeed); this.sendNotification("CURRENTWEATHER_DATA", { data: data }); + this.sendNotification("CURRENTWEATHER_TYPE", { type: this.config.iconTable[data.weather[0].icon].replace("-", "_") }); }, /* scheduleUpdate() diff --git a/modules/default/weather/weather.js b/modules/default/weather/weather.js index 83ab9f18..8a4810fd 100644 --- a/modules/default/weather/weather.js +++ b/modules/default/weather/weather.js @@ -152,6 +152,7 @@ Module.register("weather", { // What to do when the weather provider has new information available? updateAvailable: function () { Log.log("New weather information available."); + this.sendNotification("CURRENTWEATHER_TYPE", { type: this.weatherProvider.currentWeather().weatherType.replace("-", "_") }); this.updateDom(0); this.scheduleUpdate(); },