From 11eba84cdbb8876a8e8eca73723786aa9a7fbbd0 Mon Sep 17 00:00:00 2001 From: Matt Walsh Date: Fri, 27 Jun 2025 22:29:56 -0500 Subject: [PATCH] fix for calm/0mph wind close #121 --- server/scripts/modules/currentweather.mjs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/server/scripts/modules/currentweather.mjs b/server/scripts/modules/currentweather.mjs index b09d216..a4a746d 100644 --- a/server/scripts/modules/currentweather.mjs +++ b/server/scripts/modules/currentweather.mjs @@ -112,7 +112,7 @@ class CurrentWeather extends WeatherDisplay { condition = shortConditions(condition); } - const wind = (typeof this.data.WindSpeed === 'number') ? this.data.WindDirection.padEnd(3, '') + this.data.WindSpeed.toString().padStart(3, ' ') : '-'; + const wind = (typeof this.data.WindSpeed === 'number') ? this.data.WindDirection.padEnd(3, '') + this.data.WindSpeed.toString().padStart(3, ' ') : this.data.WindSpeed; const fill = { temp: this.data.Temperature + String.fromCharCode(176), @@ -210,6 +210,9 @@ const parseData = (data) => { data.PressureDirection = ''; data.TextConditions = observations.textDescription; + // set wind speed of 0 as calm + if (data.WindSpeed === 0) data.WindSpeed = 'Calm'; + // difference since last measurement (pascals, looking for difference of more than 150) const pressureDiff = (observations.barometricPressure.value - data.features[1].properties.barometricPressure.value); if (pressureDiff > 150) data.PressureDirection = 'R';