mirror of
https://github.com/MichMich/MagicMirror.git
synced 2025-06-27 19:53:36 +00:00
Merge pull request #1489 from fewieden/feature/weather-module-improvements
WIP: weather module improvements
This commit is contained in:
commit
b9f75bf7d2
@ -14,6 +14,11 @@ WeatherProvider.register("darksky", {
|
|||||||
// Not strictly required, but helps for debugging.
|
// Not strictly required, but helps for debugging.
|
||||||
providerName: "Dark Sky",
|
providerName: "Dark Sky",
|
||||||
|
|
||||||
|
units: {
|
||||||
|
imperial: 'us',
|
||||||
|
metric: 'ca'
|
||||||
|
},
|
||||||
|
|
||||||
fetchCurrentWeather: function() {
|
fetchCurrentWeather: function() {
|
||||||
this.fetchData(this.getUrl())
|
this.fetchData(this.getUrl())
|
||||||
.then(data => {
|
.then(data => {
|
||||||
@ -46,7 +51,8 @@ WeatherProvider.register("darksky", {
|
|||||||
|
|
||||||
// Create a URL from the config and base URL.
|
// Create a URL from the config and base URL.
|
||||||
getUrl: function() {
|
getUrl: function() {
|
||||||
return `${this.config.apiBase}${this.config.weatherEndpoint}/${this.config.apiKey}/${this.config.lat},${this.config.lon}`;
|
var units = this.units[this.config.units] || 'auto';
|
||||||
|
return `${this.config.apiBase}${this.config.weatherEndpoint}/${this.config.apiKey}/${this.config.lat},${this.config.lon}?units=${units}&lang=${this.config.lang}`;
|
||||||
},
|
},
|
||||||
|
|
||||||
// Implement WeatherDay generator.
|
// Implement WeatherDay generator.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user