This fixes a few bugs in the noaa.gov based weather plugins and adds a new one for humidity.
There was an issue with the read function of urllib returning an object, which got handled as a string afterwards. This caused issues:
Traceback (most recent call last):
File "/tmp/weather/./weather_press_LOWW", line 43, in <module>
hpa = re_hpa.findall(txt)[0]
TypeError: cannot use a string pattern on a bytes-like object
While implicit string casting might work, it's better to do so explicitly. This avoids said bug.
There was another bug in the temperature plugin, that didn't occur every time. It caused the temperature be set to the same value as the dew point. Turned out that, for some reasons, linebreaks were handled differently from time to time. Improving the RegEx to be more specific helped with that.
While at it, I changed the URL to include TLS connections. It's 2023 and https should really be the norm, rather than be the exception.
There's also a new plugin weather_hum_ that monitors the humidity. It is basically a copy&paste from the other two plugins and works quite the same way. While working on the other plugins, I just saw the opportunity for scoring an additional metric without much work.
Changes:
Fix bug by casting url-read object to string in weather_press_ and weather_temp_ plugins
Use https connections instead of insecure http
Fix big in weather_temp_ causing temperature to be the same as dew point
This fixes a few bugs in the noaa.gov based weather plugins and adds a new one for humidity.
There was an issue with the read function of urllib returning an object, which got handled as a string afterwards. This caused issues:
While implicit string casting might work, it's better to do so explicitly. This avoids said bug.
There was another bug in the temperature plugin, that didn't occur every time. It caused the temperature be set to the same value as the dew point. Turned out that, for some reasons, linebreaks were handled differently from time to time. Improving the RegEx to be more specific helped with that.
While at it, I changed the URL to include TLS connections. It's 2023 and
https
should really be the norm, rather than be the exception.There's also a new plugin
weather_hum_
that monitors the humidity. It is basically a copy&paste from the other two plugins and works quite the same way. While working on the other plugins, I just saw the opportunity for scoring an additional metric without much work.Changes:
weather_press_
andweather_temp_
pluginshttps
connections instead of insecurehttp
weather_temp_
causing temperature to be the same as dew pointweather_hum_
to monitor humidity