mirror of
https://github.com/MichMich/MagicMirror.git
synced 2025-08-21 12:55:22 +00:00
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:
@@ -18,7 +18,7 @@ class WeatherObject {
|
||||
constructor() {
|
||||
this.date = null;
|
||||
this.windSpeed = null;
|
||||
this.windDirection = null;
|
||||
this.windFromDirection = null;
|
||||
this.sunrise = null;
|
||||
this.sunset = null;
|
||||
this.temperature = null;
|
||||
@@ -34,35 +34,35 @@ class WeatherObject {
|
||||
}
|
||||
|
||||
cardinalWindDirection() {
|
||||
if (this.windDirection > 11.25 && this.windDirection <= 33.75) {
|
||||
if (this.windFromDirection > 11.25 && this.windFromDirection <= 33.75) {
|
||||
return "NNE";
|
||||
} else if (this.windDirection > 33.75 && this.windDirection <= 56.25) {
|
||||
} else if (this.windFromDirection > 33.75 && this.windFromDirection <= 56.25) {
|
||||
return "NE";
|
||||
} else if (this.windDirection > 56.25 && this.windDirection <= 78.75) {
|
||||
} else if (this.windFromDirection > 56.25 && this.windFromDirection <= 78.75) {
|
||||
return "ENE";
|
||||
} else if (this.windDirection > 78.75 && this.windDirection <= 101.25) {
|
||||
} else if (this.windFromDirection > 78.75 && this.windFromDirection <= 101.25) {
|
||||
return "E";
|
||||
} else if (this.windDirection > 101.25 && this.windDirection <= 123.75) {
|
||||
} else if (this.windFromDirection > 101.25 && this.windFromDirection <= 123.75) {
|
||||
return "ESE";
|
||||
} else if (this.windDirection > 123.75 && this.windDirection <= 146.25) {
|
||||
} else if (this.windFromDirection > 123.75 && this.windFromDirection <= 146.25) {
|
||||
return "SE";
|
||||
} else if (this.windDirection > 146.25 && this.windDirection <= 168.75) {
|
||||
} else if (this.windFromDirection > 146.25 && this.windFromDirection <= 168.75) {
|
||||
return "SSE";
|
||||
} else if (this.windDirection > 168.75 && this.windDirection <= 191.25) {
|
||||
} else if (this.windFromDirection > 168.75 && this.windFromDirection <= 191.25) {
|
||||
return "S";
|
||||
} else if (this.windDirection > 191.25 && this.windDirection <= 213.75) {
|
||||
} else if (this.windFromDirection > 191.25 && this.windFromDirection <= 213.75) {
|
||||
return "SSW";
|
||||
} else if (this.windDirection > 213.75 && this.windDirection <= 236.25) {
|
||||
} else if (this.windFromDirection > 213.75 && this.windFromDirection <= 236.25) {
|
||||
return "SW";
|
||||
} else if (this.windDirection > 236.25 && this.windDirection <= 258.75) {
|
||||
} else if (this.windFromDirection > 236.25 && this.windFromDirection <= 258.75) {
|
||||
return "WSW";
|
||||
} else if (this.windDirection > 258.75 && this.windDirection <= 281.25) {
|
||||
} else if (this.windFromDirection > 258.75 && this.windFromDirection <= 281.25) {
|
||||
return "W";
|
||||
} else if (this.windDirection > 281.25 && this.windDirection <= 303.75) {
|
||||
} else if (this.windFromDirection > 281.25 && this.windFromDirection <= 303.75) {
|
||||
return "WNW";
|
||||
} else if (this.windDirection > 303.75 && this.windDirection <= 326.25) {
|
||||
} else if (this.windFromDirection > 303.75 && this.windFromDirection <= 326.25) {
|
||||
return "NW";
|
||||
} else if (this.windDirection > 326.25 && this.windDirection <= 348.75) {
|
||||
} else if (this.windFromDirection > 326.25 && this.windFromDirection <= 348.75) {
|
||||
return "NNW";
|
||||
} else {
|
||||
return "N";
|
||||
|
Reference in New Issue
Block a user