diff --git a/config/config.js.sample b/config/config.js.sample index 0b5f45d4..aedc2b75 100644 --- a/config/config.js.sample +++ b/config/config.js.sample @@ -41,6 +41,7 @@ var config = { position: 'top_right', config: { location: 'New York', + locationID: '', //ID from bulk.openweather.org/sample/ appid: 'YOUR_OPENWEATHER_API_KEY' } }, @@ -50,6 +51,7 @@ var config = { header: 'Weather Forecast', config: { location: 'New York', + locationID: '5128581', //ID from bulk.openweather.org/sample/ appid: 'YOUR_OPENWEATHER_API_KEY' } }, diff --git a/modules/default/currentweather/README.md b/modules/default/currentweather/README.md index 7e7d9fb4..2a6f7844 100644 --- a/modules/default/currentweather/README.md +++ b/modules/default/currentweather/README.md @@ -14,6 +14,7 @@ modules: [ config: { // See 'Configuration options' for more information. location: 'Amsterdam,Netherlands', + locationID: '', //Location ID from http://bulk.openweather.org/sample/ appid: 'abcde12345abcde12345abcde12345ab' //openweathermap.org API key. } } @@ -34,7 +35,7 @@ The following properties can be configured: - + location The location used for weather information.
@@ -42,6 +43,13 @@ The following properties can be configured:
Default value: New York + + locationID + Location ID from OpenWeather This will override anything you put in location.
Leave blank if you want to use location. +
Example: 1234567 +
Default value: + + appid The OpenWeatherMap API key, which can be obtained by creating an OpenWeatherMap account.
diff --git a/modules/default/currentweather/currentweather.js b/modules/default/currentweather/currentweather.js index 6c4983de..e00e738d 100644 --- a/modules/default/currentweather/currentweather.js +++ b/modules/default/currentweather/currentweather.js @@ -12,6 +12,7 @@ Module.register("currentweather",{ // Default module config. defaults: { location: "", + locationID: "", appid: "", units: config.units, updateInterval: 10 * 60 * 1000, // every 10 minutes @@ -198,7 +199,11 @@ Module.register("currentweather",{ */ getParams: function() { var params = "?"; - params += "q=" + this.config.location; + if(this.config.locationID !== "") { + params += "id=" + this.config.locationID; + } else { + params += "q=" + this.config.location; + } params += "&units=" + this.config.units; params += "&lang=" + this.config.lang; params += "&APPID=" + this.config.appid; diff --git a/modules/default/weatherforecast/README.md b/modules/default/weatherforecast/README.md index 9e93bd14..aba03a41 100644 --- a/modules/default/weatherforecast/README.md +++ b/modules/default/weatherforecast/README.md @@ -14,6 +14,7 @@ modules: [ config: { // See 'Configuration options' for more information. location: 'Amsterdam,Netherlands', + locationID: '', //Location ID from http://bulk.openweather.org/sample/ appid: 'abcde12345abcde12345abcde12345ab' //openweathermap.org API key. } } @@ -42,6 +43,13 @@ The following properties can be configured:
Default value: New York + + locationID + Location ID from OpenWeather This will override anything you put in location.
Leave blank if you want to use location. +
Example: 1234567 +
Default value: + + appid The OpenWeatherMap API key, which can be obtained by creating an OpenWeatherMap account.
diff --git a/modules/default/weatherforecast/weatherforecast.js b/modules/default/weatherforecast/weatherforecast.js index 98298489..dd8e0a46 100644 --- a/modules/default/weatherforecast/weatherforecast.js +++ b/modules/default/weatherforecast/weatherforecast.js @@ -12,6 +12,7 @@ Module.register("weatherforecast",{ // Default module config. defaults: { location: "", + locationID: "", appid: "", units: config.units, maxNumberOfDays: 7, @@ -195,7 +196,11 @@ Module.register("weatherforecast",{ */ getParams: function() { var params = "?"; - params += "q=" + this.config.location; + if(this.config.locationID !== "") { + params += "id=" + this.config.locationID; + } else { + params += "q=" + this.config.location; + } params += "&units=" + this.config.units; params += "&lang=" + this.config.lang; /*