mirror of
https://github.com/MichMich/MagicMirror.git
synced 2025-06-29 12:39:45 +00:00
typo and bug fixes
This commit is contained in:
parent
a4df38d963
commit
f73520559e
@ -146,12 +146,20 @@ WeatherProvider.register("openweathermap", {
|
|||||||
current.temperature = data.current.temp;
|
current.temperature = data.current.temp;
|
||||||
current.weatherType = this.convertWeatherType(data.current.weather[0].icon);
|
current.weatherType = this.convertWeatherType(data.current.weather[0].icon);
|
||||||
current.humidity = data.current.humidity;
|
current.humidity = data.current.humidity;
|
||||||
if (!isNaN(data.current.rain)) {
|
if (current.hasOwnProperty("rain") && !isNaN(current.rain["1h"])) {
|
||||||
current.rain = data.current.rain.1h;
|
if (this.config.units === "imperial") {
|
||||||
|
weather.rain = current.rain["1h"] / 25.4;
|
||||||
|
} else {
|
||||||
|
weather.rain = current.rain["1h"];
|
||||||
|
}
|
||||||
precip = true;
|
precip = true;
|
||||||
}
|
}
|
||||||
if (!isNaN(data.current.snow)) {
|
if (current.hasOwnProperty("snow") && !isNaN(current.snow["1h"])) {
|
||||||
current.snow = data.current.snow.1h;
|
if (this.config.units === "imperial") {
|
||||||
|
weather.snow = current.snow["1h"] / 25.4;
|
||||||
|
} else {
|
||||||
|
weather.snow = current.snow["1h"];
|
||||||
|
}
|
||||||
precip = true;
|
precip = true;
|
||||||
}
|
}
|
||||||
if (precip) {
|
if (precip) {
|
||||||
@ -193,19 +201,19 @@ WeatherProvider.register("openweathermap", {
|
|||||||
weather.windDirection = hour.wind_deg;
|
weather.windDirection = hour.wind_deg;
|
||||||
weather.weatherType = this.convertWeatherType(hour.weather[0].icon);
|
weather.weatherType = this.convertWeatherType(hour.weather[0].icon);
|
||||||
precip = false;
|
precip = false;
|
||||||
if (!isNaN(hour.rain)) {
|
if (hour.hasOwnProperty("rain") && !isNaN(hour.rain["1h"])) {
|
||||||
if (this.config.units === "imperial") {
|
if (this.config.units === "imperial") {
|
||||||
weather.rain = hour.rain.1h / 25.4;
|
weather.rain = hour.rain["1h"] / 25.4;
|
||||||
} else {
|
} else {
|
||||||
weather.rain = hour.rain.1h;
|
weather.rain = hour.rain["1h"];
|
||||||
}
|
}
|
||||||
precip = true;
|
precip = true;
|
||||||
}
|
}
|
||||||
if (!isNaN(hour.snow)) {
|
if (hour.hasOwnProperty("snow") && !isNaN(hour.snow["1h"])) {
|
||||||
if (this.config.units === "imperial") {
|
if (this.config.units === "imperial") {
|
||||||
weather.snow = hour.snow.1h / 25.4;
|
weather.snow = hour.snow["1h"] / 25.4;
|
||||||
} else {
|
} else {
|
||||||
weather.snow = hour.snow.1h;
|
weather.snow = hour.snow["1h"];
|
||||||
}
|
}
|
||||||
precip = true;
|
precip = true;
|
||||||
}
|
}
|
||||||
@ -451,7 +459,7 @@ WeatherProvider.register("openweathermap", {
|
|||||||
|
|
||||||
params += "&units=" + this.config.units;
|
params += "&units=" + this.config.units;
|
||||||
params += "&lang=" + this.config.lang;
|
params += "&lang=" + this.config.lang;
|
||||||
params += "&APPID=" + this.config.apiKey;
|
params += "&APPID=" + this.config.appid;
|
||||||
|
|
||||||
return params;
|
return params;
|
||||||
}
|
}
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
{% set hours = wData.hours.slice(0, numSteps) %}
|
{% set hours = wData.hours.slice(0, numSteps) %}
|
||||||
{% for hour in hours %}
|
{% for hour in hours %}
|
||||||
<tr {% if config.colored %}class="colored"{% endif %} {% if config.fade %}style="opacity: {{ currentStep | opacity(numSteps) }};"{% endif %}>
|
<tr {% if config.colored %}class="colored"{% endif %} {% if config.fade %}style="opacity: {{ currentStep | opacity(numSteps) }};"{% endif %}>
|
||||||
<td class="time">{{ hour.date | formatTimeMoment }}</td>
|
<td class="day">{{ hour.date | formatTimeMoment }}</td>
|
||||||
<td class="bright weather-icon"><span class="wi weathericon wi-{{ hour.weatherType }}"></span></td>
|
<td class="bright weather-icon"><span class="wi weathericon wi-{{ hour.weatherType }}"></span></td>
|
||||||
<td class="align-right bright max-temp">
|
<td class="align-right bright max-temp">
|
||||||
{{ hour.temperature | roundValue | unit("temperature") }}
|
{{ hour.temperature | roundValue | unit("temperature") }}
|
||||||
|
@ -97,7 +97,6 @@ var WeatherProvider = Class.extend({
|
|||||||
|
|
||||||
// Set the weatherDataObject and notify the delegate that new information is available.
|
// Set the weatherDataObject and notify the delegate that new information is available.
|
||||||
setWeatherData: function (weatherDataObject) {
|
setWeatherData: function (weatherDataObject) {
|
||||||
// We should check here if we are passing a WeatherDay
|
|
||||||
this.weatherDataObject = weatherDataObject;
|
this.weatherDataObject = weatherDataObject;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user