From bd5bab9dedac3f9f5cc390e8520bbaa45515f716 Mon Sep 17 00:00:00 2001 From: Robert Binns Date: Mon, 17 Feb 2020 17:12:02 -0500 Subject: [PATCH] Add function to receive latitude and longitude --- MMM-DarkSkyForecast.js | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/MMM-DarkSkyForecast.js b/MMM-DarkSkyForecast.js index bf012cd..a796c07 100644 --- a/MMM-DarkSkyForecast.js +++ b/MMM-DarkSkyForecast.js @@ -266,6 +266,26 @@ Module.register("MMM-DarkSkyForecast", { }, + +/* +Receive notifications from other modules to update the latitude and longitude. Update the module when complete. +*/ + + notificationReceived: function(notification, payload, sender) { + if (notification == "update-weather-location") { + + Log.log(this.name + " received a module notification: " + notification + " from sender: " + sender.name + ": lat: " + payload['lat'] + ", lon: " + payload['lon']); + + this.config.latitude = payload['lat']; + this.config.longitude = payload['lon']; + + this.getData(); + + this.updateDom(); + + } + }, + /* This prepares the data to be used by the Nunjucks template. The template does not do any logic other