diff --git a/aprslib/parsing/weather.py b/aprslib/parsing/weather.py index 6754f1d..1ed140f 100644 --- a/aprslib/parsing/weather.py +++ b/aprslib/parsing/weather.py @@ -33,7 +33,7 @@ val_map = { 'r': lambda x: int(x) * rain_multiplier, 'p': lambda x: int(x) * rain_multiplier, 'P': lambda x: int(x) * rain_multiplier, - 'h': lambda x: int(x), + 'h': lambda x: 100 if int(x) == 0 else int(x), 'b': lambda x: float(x) / 10, 'l': lambda x: int(x) + 1000, 'L': lambda x: int(x), diff --git a/tests/test_parse_weather_data.py b/tests/test_parse_weather_data.py index 634ed5f..53c8251 100644 --- a/tests/test_parse_weather_data.py +++ b/tests/test_parse_weather_data.py @@ -113,11 +113,17 @@ class ParseCommentWeather(unittest.TestCase): def test_humidity(self): expected = "", { - "humidity": 0.0 + "humidity": 100 } result = parse_weather_data("h00") self.assertEqual(expected, result) + expected = "", { + "humidity": 1 + } + result = parse_weather_data("h01") + self.assertEqual(expected, result) + expected = "", { "humidity": 99 }