Update metofficedatahub.js

This commit is contained in:
CreepinJesus 2020-06-28 12:09:16 +01:00
parent d911b075ab
commit b91fccc0e3

View File

@ -21,7 +21,7 @@
* apiKey: "[YOUR API KEY]", * apiKey: "[YOUR API KEY]",
* apiSecret: "[YOUR API SECRET]]", * apiSecret: "[YOUR API SECRET]]",
* lat: [LATITUDE (DECIMAL)], * lat: [LATITUDE (DECIMAL)],
* long: [LONGITUDE (DECIMAL)], * lon: [LONGITUDE (DECIMAL)],
* windUnits: "mps" | "kph" | "mph" (default) * windUnits: "mps" | "kph" | "mph" (default)
* tempUnits: "imperial" | "metric" (default) * tempUnits: "imperial" | "metric" (default)
* *
@ -48,7 +48,7 @@ WeatherProvider.register("ukmetofficedatahub", {
getUrl(forecastType) { getUrl(forecastType) {
let queryStrings = "?"; let queryStrings = "?";
queryStrings += "latitude=" + this.config.lat; queryStrings += "latitude=" + this.config.lat;
queryStrings += "&longitude=" + this.config.long; queryStrings += "&longitude=" + this.config.lon;
if (this.config.appendLocationNameToHeader) { if (this.config.appendLocationNameToHeader) {
queryStrings += "&includeLocationName=" + true; queryStrings += "&includeLocationName=" + true;
} }
@ -64,7 +64,7 @@ WeatherProvider.register("ukmetofficedatahub", {
let headers = { let headers = {
accept: "application/json", accept: "application/json",
"x-ibm-client-id": this.config.apiKey, "x-ibm-client-id": this.config.apiKey,
"x-ibm-client-secret": this.config.apiSecret, "x-ibm-client-secret": this.config.apiSecret
}; };
return headers; return headers;
@ -295,9 +295,9 @@ WeatherProvider.register("ukmetofficedatahub", {
27: "snow", 27: "snow",
28: "night-alt-thunderstorm", 28: "night-alt-thunderstorm",
29: "day-thunderstorm", 29: "day-thunderstorm",
30: "thunderstorm", 30: "thunderstorm"
}; };
return weatherTypes.hasOwnProperty(weatherType) ? weatherTypes[weatherType] : null; return weatherTypes.hasOwnProperty(weatherType) ? weatherTypes[weatherType] : null;
}, }
}); });