mirror of
https://github.com/MichMich/MagicMirror.git
synced 2025-06-28 12:12:20 +00:00
Updated weather to get a locationID
This commit is contained in:
parent
93abaed0c2
commit
b45899bf90
@ -41,6 +41,7 @@ var config = {
|
|||||||
position: 'top_right',
|
position: 'top_right',
|
||||||
config: {
|
config: {
|
||||||
location: 'New York',
|
location: 'New York',
|
||||||
|
locationID: '5128581', //ID from bulk.openweather.org/sample/
|
||||||
appid: 'YOUR_OPENWEATHER_API_KEY'
|
appid: 'YOUR_OPENWEATHER_API_KEY'
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@ -50,6 +51,7 @@ var config = {
|
|||||||
header: 'Weather Forecast',
|
header: 'Weather Forecast',
|
||||||
config: {
|
config: {
|
||||||
location: 'New York',
|
location: 'New York',
|
||||||
|
locationID: '5128581', //ID from bulk.openweather.org/sample/
|
||||||
appid: 'YOUR_OPENWEATHER_API_KEY'
|
appid: 'YOUR_OPENWEATHER_API_KEY'
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -12,6 +12,7 @@ Module.register("currentweather",{
|
|||||||
// Default module config.
|
// Default module config.
|
||||||
defaults: {
|
defaults: {
|
||||||
location: "",
|
location: "",
|
||||||
|
locationID: "",
|
||||||
appid: "",
|
appid: "",
|
||||||
units: config.units,
|
units: config.units,
|
||||||
updateInterval: 10 * 60 * 1000, // every 10 minutes
|
updateInterval: 10 * 60 * 1000, // every 10 minutes
|
||||||
@ -198,7 +199,11 @@ Module.register("currentweather",{
|
|||||||
*/
|
*/
|
||||||
getParams: function() {
|
getParams: function() {
|
||||||
var params = "?";
|
var params = "?";
|
||||||
|
if(this.config.locationID !== "") {
|
||||||
|
params += "id=" + this.config.locationID;
|
||||||
|
} else {
|
||||||
params += "q=" + this.config.location;
|
params += "q=" + this.config.location;
|
||||||
|
}
|
||||||
params += "&units=" + this.config.units;
|
params += "&units=" + this.config.units;
|
||||||
params += "&lang=" + this.config.lang;
|
params += "&lang=" + this.config.lang;
|
||||||
params += "&APPID=" + this.config.appid;
|
params += "&APPID=" + this.config.appid;
|
||||||
|
@ -12,6 +12,7 @@ Module.register("weatherforecast",{
|
|||||||
// Default module config.
|
// Default module config.
|
||||||
defaults: {
|
defaults: {
|
||||||
location: "",
|
location: "",
|
||||||
|
locationID: "",
|
||||||
appid: "",
|
appid: "",
|
||||||
units: config.units,
|
units: config.units,
|
||||||
maxNumberOfDays: 7,
|
maxNumberOfDays: 7,
|
||||||
@ -195,7 +196,11 @@ Module.register("weatherforecast",{
|
|||||||
*/
|
*/
|
||||||
getParams: function() {
|
getParams: function() {
|
||||||
var params = "?";
|
var params = "?";
|
||||||
|
if(this.config.locationID !== "") {
|
||||||
|
params += "id=" + this.config.locationID;
|
||||||
|
} else {
|
||||||
params += "q=" + this.config.location;
|
params += "q=" + this.config.location;
|
||||||
|
}
|
||||||
params += "&units=" + this.config.units;
|
params += "&units=" + this.config.units;
|
||||||
params += "&lang=" + this.config.lang;
|
params += "&lang=" + this.config.lang;
|
||||||
/*
|
/*
|
||||||
|
Loading…
x
Reference in New Issue
Block a user