From e4891e699f2dfa8db2cd9359e66024b9a1dd04ad Mon Sep 17 00:00:00 2001 From: Michael Teeuw Date: Wed, 27 Feb 2019 13:33:14 +0100 Subject: [PATCH] Revert "Added autoLocation and autoTimezone option for weather modules and clock respectively." --- CHANGELOG.md | 2 -- modules/default/clock/clock.js | 26 ++++------------- modules/default/clock/node_helper.js | 29 ------------------- .../default/currentweather/currentweather.js | 14 +-------- modules/default/currentweather/node_helper.js | 29 ------------------- .../default/weatherforecast/node_helper.js | 29 ------------------- .../weatherforecast/weatherforecast.js | 15 ++-------- 7 files changed, 8 insertions(+), 136 deletions(-) delete mode 100644 modules/default/clock/node_helper.js delete mode 100644 modules/default/currentweather/node_helper.js delete mode 100644 modules/default/weatherforecast/node_helper.js diff --git a/CHANGELOG.md b/CHANGELOG.md index 6e7ae65d..b42a99c5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -15,8 +15,6 @@ This project adheres to [Semantic Versioning](http://semver.org/). - Italian translation for "Feels" - Disabled the screensaver on raspbian with installation script - Added option to truncate the number of vertical lines a calendar item can span if `wrapEvents` is enabled. -- Added autoLocation options for weather forcast and current weather modules. -- Added autoTimezone option for the default clock module. - Danish translation for "Feels" and "Weeks" - Added option to split multiple day events in calendar to separate numbered events - Slovakian translation diff --git a/modules/default/clock/clock.js b/modules/default/clock/clock.js index 03528bce..23b801d0 100644 --- a/modules/default/clock/clock.js +++ b/modules/default/clock/clock.js @@ -26,7 +26,6 @@ Module.register("clock",{ analogShowDate: "top", // options: false, 'top', or 'bottom' secondsColor: "#888888", timezone: null, - autoTimezone: false }, // Define required scripts. getScripts: function() { @@ -40,31 +39,16 @@ Module.register("clock",{ start: function() { Log.info("Starting module: " + this.name); - if (this.config.autoTimezone) { - this.sendSocketNotification("AUTO_TIMEZONE"); - } else { - // Schedule update interval. - var self = this; - setInterval(function() { - self.updateDom(); - }, 1000); - } + // Schedule update interval. + var self = this; + setInterval(function() { + self.updateDom(); + }, 1000); // Set locale. moment.locale(config.language); }, - - socketNotificationReceived: function (notification, payload) { - if (notification === "UPDATE_TIMEZONE") { - var self = this; - self.config.timezone = payload.timezone; - setInterval(function() { - self.updateDom(); - }, 1000); - } - }, - // Override dom generator. getDom: function() { diff --git a/modules/default/clock/node_helper.js b/modules/default/clock/node_helper.js deleted file mode 100644 index 68258b0a..00000000 --- a/modules/default/clock/node_helper.js +++ /dev/null @@ -1,29 +0,0 @@ -var http = require("http"); -var NodeHelper = require("node_helper"); - -module.exports = NodeHelper.create({ - start: function () { - }, - - socketNotificationReceived: function (notification, payload) { - var self = this; - - if (notification === "AUTO_TIMEZONE") { - console.log("Loading timezone..."); - http.get("http://ip-api.com/json", function (req) { - var data = ""; - req.on("data", function (d) { - data += d; - }); - req.on("end", function () { - var body = JSON.parse(data); - payload.timezone = body.timezone; - self.sendSocketNotification("UPDATE_TIMEZONE", payload); - }); - }).on("error", function () { - payload.error = "Could not figure out the timezone."; - self.sendSocketNotification("UPDATE_TIMEZONE", payload); - }); - } - } -}); diff --git a/modules/default/currentweather/currentweather.js b/modules/default/currentweather/currentweather.js index 0472b7a1..2a6d24b9 100644 --- a/modules/default/currentweather/currentweather.js +++ b/modules/default/currentweather/currentweather.js @@ -11,7 +11,6 @@ Module.register("currentweather",{ // Default module config. defaults: { - autoLocation: false, location: false, locationID: false, appid: "", @@ -110,19 +109,8 @@ Module.register("currentweather",{ this.weatherType = null; this.feelsLike = null; this.loaded = false; + this.scheduleUpdate(this.config.initialLoadDelay); - if (this.config.autoLocation) { - this.sendSocketNotification("AUTO_LOCATION"); - } else { - this.scheduleUpdate(this.config.initialLoadDelay); - } - }, - - socketNotificationReceived: function (notification, payload) { - if (notification === "UPDATE_LOCATION") { - this.config.location = payload.location; - this.scheduleUpdate(this.config.initialLoadDelay); - } }, // add extra information of current weather diff --git a/modules/default/currentweather/node_helper.js b/modules/default/currentweather/node_helper.js deleted file mode 100644 index 53956f62..00000000 --- a/modules/default/currentweather/node_helper.js +++ /dev/null @@ -1,29 +0,0 @@ -var http = require("http"); -var NodeHelper = require("node_helper"); - -module.exports = NodeHelper.create({ - start: function () { - }, - - socketNotificationReceived: function (notification, payload) { - var self = this; - - if (notification === "AUTO_LOCATION") { - console.log("Loading timezone..."); - http.get("http://ip-api.com/json", function (req) { - var data = ""; - req.on("data", function (d) { - data += d; - }); - req.on("end", function () { - var body = JSON.parse(data); - payload.location = body.city + ", " + body.regionName; - self.sendSocketNotification("UPDATE_LOCATION", payload); - }); - }).on("error", function () { - payload.error = "Could not figure out the timezone."; - self.sendSocketNotification("UPDATE_LOCATION", payload); - }); - } - } -}); diff --git a/modules/default/weatherforecast/node_helper.js b/modules/default/weatherforecast/node_helper.js deleted file mode 100644 index 53956f62..00000000 --- a/modules/default/weatherforecast/node_helper.js +++ /dev/null @@ -1,29 +0,0 @@ -var http = require("http"); -var NodeHelper = require("node_helper"); - -module.exports = NodeHelper.create({ - start: function () { - }, - - socketNotificationReceived: function (notification, payload) { - var self = this; - - if (notification === "AUTO_LOCATION") { - console.log("Loading timezone..."); - http.get("http://ip-api.com/json", function (req) { - var data = ""; - req.on("data", function (d) { - data += d; - }); - req.on("end", function () { - var body = JSON.parse(data); - payload.location = body.city + ", " + body.regionName; - self.sendSocketNotification("UPDATE_LOCATION", payload); - }); - }).on("error", function () { - payload.error = "Could not figure out the timezone."; - self.sendSocketNotification("UPDATE_LOCATION", payload); - }); - } - } -}); diff --git a/modules/default/weatherforecast/weatherforecast.js b/modules/default/weatherforecast/weatherforecast.js index c32821db..67193696 100644 --- a/modules/default/weatherforecast/weatherforecast.js +++ b/modules/default/weatherforecast/weatherforecast.js @@ -11,7 +11,6 @@ Module.register("weatherforecast",{ // Default module config. defaults: { - autoLocation: false, location: false, locationID: false, appid: "", @@ -96,20 +95,10 @@ Module.register("weatherforecast",{ this.forecast = []; this.loaded = false; + this.scheduleUpdate(this.config.initialLoadDelay); + this.updateTimer = null; - if (this.config.autoLocation) { - this.sendSocketNotification("AUTO_LOCATION"); - } else { - this.scheduleUpdate(this.config.initialLoadDelay); - } - }, - - socketNotificationReceived: function (notification, payload) { - if (notification === "UPDATE_LOCATION") { - this.config.location = payload.location; - this.scheduleUpdate(this.config.initialLoadDelay); - } }, // Override dom generator.