From b76f6304409cd682a1e82cae805454b9e9ba0575 Mon Sep 17 00:00:00 2001 From: HaseHarald Date: Sat, 22 Jul 2023 20:28:28 +0200 Subject: [PATCH] fix(weather_temp_): Better match temperature and dew point For whatever reason, sometimes linebreaks are only denoted as \n in the querry-result. This lead to the temperature RegEx matching the dew point. This caused the temperature to be reported the same as the dew point. These changes should make the RegEx more specific and work consistently, no matter if linebreaks are actual linebreaks or just \n. --- plugins/weather/weather_temp_ | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/plugins/weather/weather_temp_ b/plugins/weather/weather_temp_ index dd54e53f..fe4f64fd 100755 --- a/plugins/weather/weather_temp_ +++ b/plugins/weather/weather_temp_ @@ -18,8 +18,8 @@ import re url = 'https://tgftp.nws.noaa.gov/data/observations/metar/decoded/%s.TXT' -re_C = re.compile(r'Temperature:.*\((-?\d+\.?\d?) C\)') -re_DewC = re.compile(r'Dew.*\((-?\d+\.?\d?) C\)') +re_C = re.compile(r'Temperature:\s*[0-9]*\s*[F]*\s*\((-?\d+\.?\d?) C\)') +re_DewC = re.compile(r'Dew.*:\s*[0-9]*\s*[F]*\s*\((-?\d+\.?\d?) C\)') code = sys.argv[0][(sys.argv[0].rfind('_') + 1):]