Fix yr weather direction (#3020)

Fixes so the Yr weather direction is not inverted. This error was
[reported in the
community](https://forum.magicmirror.builders/topic/17561/wind-direction-180-degrees-twisted-at-yr).

I misunderstood when developing the module because of the wind direction
arrow was pointing opposite to the arrow displayed on Yr.no. I renamed
the variable to help other developers in the future.

Co-authored-by: Magnus Marthinsen <magmar@online.no>
Co-authored-by: veeck <michael@veeck.de>
This commit is contained in:
Magnus
2023-01-21 22:40:08 +01:00
committed by GitHub
parent cd4ba428da
commit 2e2962d492
14 changed files with 39 additions and 38 deletions

View File

@@ -7,7 +7,7 @@
* By Magnus Marthinsen
* MIT Licensed
*
* This class is a provider for Yr.no, a norwegian sweather service.
* This class is a provider for Yr.no, a norwegian weather service.
*
* Terms of service: https://developer.yr.no/doc/TermsOfService/
*/
@@ -47,7 +47,7 @@ WeatherProvider.register("yr", {
const getRequests = [this.getWeatherData(), this.getStellarData()];
const [weatherData, stellarData] = await Promise.all(getRequests);
if (!stellarData) {
Log.warn("No stelar data available.");
Log.warn("No stellar data available.");
}
if (!weatherData.properties.timeseries || !weatherData.properties.timeseries[0]) {
Log.error("No weather data available.");
@@ -364,7 +364,7 @@ WeatherProvider.register("yr", {
weather.date = moment(forecast.time);
weather.windSpeed = forecast.data.instant.details.wind_speed;
weather.windDirection = (forecast.data.instant.details.wind_from_direction + 180) % 360;
weather.windFromDirection = forecast.data.instant.details.wind_from_direction;
weather.temperature = forecast.data.instant.details.air_temperature;
weather.minTemperature = forecast.minTemperature;
weather.maxTemperature = forecast.maxTemperature;
@@ -530,7 +530,7 @@ WeatherProvider.register("yr", {
return;
}
if (!stellarData) {
Log.warn("No stelar data available.");
Log.warn("No stellar data available.");
}
let forecasts;
switch (type) {