mirror of
https://github.com/MichMich/MagicMirror.git
synced 2025-07-03 06:15:59 +00:00
Merge pull request #1592 from MichMich/revert-1564-develop
Revert "Added autoLocation and autoTimezone option for weather modules and clock respectively."
This commit is contained in:
commit
ce9a61622e
@ -15,8 +15,6 @@ This project adheres to [Semantic Versioning](http://semver.org/).
|
|||||||
- Italian translation for "Feels"
|
- Italian translation for "Feels"
|
||||||
- Disabled the screensaver on raspbian with installation script
|
- 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 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"
|
- Danish translation for "Feels" and "Weeks"
|
||||||
- Added option to split multiple day events in calendar to separate numbered events
|
- Added option to split multiple day events in calendar to separate numbered events
|
||||||
- Slovakian translation
|
- Slovakian translation
|
||||||
|
@ -26,7 +26,6 @@ Module.register("clock",{
|
|||||||
analogShowDate: "top", // options: false, 'top', or 'bottom'
|
analogShowDate: "top", // options: false, 'top', or 'bottom'
|
||||||
secondsColor: "#888888",
|
secondsColor: "#888888",
|
||||||
timezone: null,
|
timezone: null,
|
||||||
autoTimezone: false
|
|
||||||
},
|
},
|
||||||
// Define required scripts.
|
// Define required scripts.
|
||||||
getScripts: function() {
|
getScripts: function() {
|
||||||
@ -40,31 +39,16 @@ Module.register("clock",{
|
|||||||
start: function() {
|
start: function() {
|
||||||
Log.info("Starting module: " + this.name);
|
Log.info("Starting module: " + this.name);
|
||||||
|
|
||||||
if (this.config.autoTimezone) {
|
|
||||||
this.sendSocketNotification("AUTO_TIMEZONE");
|
|
||||||
} else {
|
|
||||||
// Schedule update interval.
|
// Schedule update interval.
|
||||||
var self = this;
|
var self = this;
|
||||||
setInterval(function() {
|
setInterval(function() {
|
||||||
self.updateDom();
|
self.updateDom();
|
||||||
}, 1000);
|
}, 1000);
|
||||||
}
|
|
||||||
|
|
||||||
// Set locale.
|
// Set locale.
|
||||||
moment.locale(config.language);
|
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.
|
// Override dom generator.
|
||||||
getDom: function() {
|
getDom: function() {
|
||||||
|
|
||||||
|
@ -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);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
@ -11,7 +11,6 @@ Module.register("currentweather",{
|
|||||||
|
|
||||||
// Default module config.
|
// Default module config.
|
||||||
defaults: {
|
defaults: {
|
||||||
autoLocation: false,
|
|
||||||
location: false,
|
location: false,
|
||||||
locationID: false,
|
locationID: false,
|
||||||
appid: "",
|
appid: "",
|
||||||
@ -110,19 +109,8 @@ Module.register("currentweather",{
|
|||||||
this.weatherType = null;
|
this.weatherType = null;
|
||||||
this.feelsLike = null;
|
this.feelsLike = null;
|
||||||
this.loaded = false;
|
this.loaded = false;
|
||||||
|
|
||||||
if (this.config.autoLocation) {
|
|
||||||
this.sendSocketNotification("AUTO_LOCATION");
|
|
||||||
} else {
|
|
||||||
this.scheduleUpdate(this.config.initialLoadDelay);
|
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
|
// add extra information of current weather
|
||||||
|
@ -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);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
@ -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);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
@ -11,7 +11,6 @@ Module.register("weatherforecast",{
|
|||||||
|
|
||||||
// Default module config.
|
// Default module config.
|
||||||
defaults: {
|
defaults: {
|
||||||
autoLocation: false,
|
|
||||||
location: false,
|
location: false,
|
||||||
locationID: false,
|
locationID: false,
|
||||||
appid: "",
|
appid: "",
|
||||||
@ -96,20 +95,10 @@ Module.register("weatherforecast",{
|
|||||||
|
|
||||||
this.forecast = [];
|
this.forecast = [];
|
||||||
this.loaded = false;
|
this.loaded = false;
|
||||||
|
this.scheduleUpdate(this.config.initialLoadDelay);
|
||||||
|
|
||||||
this.updateTimer = null;
|
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.
|
// Override dom generator.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user