mirror of
https://github.com/MichMich/MagicMirror.git
synced 2025-08-21 12:55:22 +00:00
Added Override Notification Option to Weather Module (#3178)
Fixes #3126 Added the option `allowOverrideNotification` to `weather.js`. This allows the module to receive the `CURRENT_WEATHER_OVERRIDE` notification. The expected payload for this notification is a full/partial `weatherObject` that is used to supplement/replace the existing `weatherObject` returned by whichever weather provider is in use. No visual changes. First time contributing - let me know if I've missed something 🙂 --------- Co-authored-by: veeck <michael.veeck@nebenan.de>
This commit is contained in:
@@ -23,6 +23,7 @@ Module.register("weather", {
|
||||
showHumidity: false,
|
||||
showIndoorHumidity: false,
|
||||
showIndoorTemperature: false,
|
||||
allowOverrideNotification: false,
|
||||
showPeriod: true,
|
||||
showPeriodUpper: false,
|
||||
showPrecipitationAmount: false,
|
||||
@@ -61,7 +62,7 @@ Module.register("weather", {
|
||||
|
||||
// Return the scripts that are necessary for the weather module.
|
||||
getScripts: function () {
|
||||
return ["moment.js", this.file("../utils.js"), "weatherutils.js", "weatherprovider.js", "weatherobject.js", "suncalc.js", this.file(`providers/${this.config.weatherProvider.toLowerCase()}.js`)];
|
||||
return ["moment.js", this.file("../utils.js"), "weatherutils.js", "weatherobject.js", this.file("providers/overrideWrapper.js"), "weatherprovider.js", "suncalc.js", this.file(`providers/${this.config.weatherProvider.toLowerCase()}.js`)];
|
||||
},
|
||||
|
||||
// Override getHeader method.
|
||||
@@ -119,6 +120,8 @@ Module.register("weather", {
|
||||
} else if (notification === "INDOOR_HUMIDITY") {
|
||||
this.indoorHumidity = this.roundValue(payload);
|
||||
this.updateDom(300);
|
||||
} else if (notification === "CURRENT_WEATHER_OVERRIDE" && this.config.allowOverrideNotification) {
|
||||
this.weatherProvider.notificationReceived(payload);
|
||||
}
|
||||
},
|
||||
|
||||
|
Reference in New Issue
Block a user