mirror of
https://github.com/MichMich/MagicMirror.git
synced 2025-06-27 11:50:00 +00:00
add function to switch units
This commit is contained in:
parent
3c27fd10b6
commit
9056abaf4a
@ -24,8 +24,20 @@ WeatherProvider.register("weatherflow", {
|
||||
},
|
||||
|
||||
units: {
|
||||
imperial: "us",
|
||||
metric: "si"
|
||||
imperial: {
|
||||
temp: "f",
|
||||
wind: "mph",
|
||||
pressure: "hpa",
|
||||
precip: "in",
|
||||
distance: "mi"
|
||||
},
|
||||
metric: {
|
||||
temp: "c",
|
||||
wind: "kph",
|
||||
pressure: "mb",
|
||||
precip: "mm",
|
||||
distance: "km"
|
||||
}
|
||||
},
|
||||
|
||||
fetchCurrentWeather() {
|
||||
@ -76,6 +88,22 @@ WeatherProvider.register("weatherflow", {
|
||||
|
||||
// Create a URL from the config and base URL.
|
||||
getUrl() {
|
||||
return this.config.apiBase + "better_forecast?station_id=" + this.config.stationid + "&token=" + this.config.token;
|
||||
return (
|
||||
this.config.apiBase +
|
||||
"better_forecast?station_id=" +
|
||||
this.config.stationid +
|
||||
"&units_temp=" +
|
||||
this.units[this.config.units].temp +
|
||||
"&units_wind=" +
|
||||
this.units[this.config.units].wind +
|
||||
"&units_pressure=" +
|
||||
this.units[this.config.units].pressure +
|
||||
"&units_precip=" +
|
||||
this.units[this.config.units].precip +
|
||||
"&units_distance=" +
|
||||
this.units[this.config.units].distance +
|
||||
"&token=" +
|
||||
this.config.token
|
||||
);
|
||||
}
|
||||
});
|
||||
|
Loading…
x
Reference in New Issue
Block a user