diff --git a/modules/default/weather/current.njk b/modules/default/weather/current.njk index c838c1e9..240dcdc5 100755 --- a/modules/default/weather/current.njk +++ b/modules/default/weather/current.njk @@ -9,7 +9,11 @@ {% if config.useBeaufort %} {{ current.beaufortWindSpeed() | round }} {% else %} - {{ current.windSpeed | round }} + {% if config.useKmh %} + {{ current.kmhWindSpeed() | round }} + {% else %} + {{ current.windSpeed | round }} + {% endif %} {% endif %} {% if config.showWindDirection %} diff --git a/modules/default/weather/weather.js b/modules/default/weather/weather.js index b5a68a52..c195e7af 100644 --- a/modules/default/weather/weather.js +++ b/modules/default/weather/weather.js @@ -18,6 +18,7 @@ Module.register("weather", { location: false, locationID: false, units: config.units, + useKmh: false, tempUnits: config.units, windUnits: config.units, diff --git a/modules/default/weather/weatherobject.js b/modules/default/weather/weatherobject.js index 0ee42123..3b145b3d 100755 --- a/modules/default/weather/weatherobject.js +++ b/modules/default/weather/weatherobject.js @@ -77,6 +77,11 @@ class WeatherObject { return 12; } + kmhWindSpeed() { + const windInKmh = this.windUnits === "imperial" ? this.windSpeed * 1.609344 : (this.windSpeed * 60 * 60) / 1000; + return windInKmh; + } + nextSunAction() { return moment().isBetween(this.sunrise, this.sunset) ? "sunset" : "sunrise"; }