File tree Expand file tree Collapse file tree 4 files changed +15
-5
lines changed
Expand file tree Collapse file tree 4 files changed +15
-5
lines changed Original file line number Diff line number Diff line change 11FROM alpine:3.23.2
22
33LABEL maintainer="Michael Oberdorf <info@oberdorf-itc.de>"
4- LABEL site.local.program.version="1.3.1 "
4+ LABEL site.local.program.version="1.3.2 "
55
66ENV TZ="UTC" \
77 REQUESTS_CA_BUNDLE=/etc/ssl/certs/ca-certificates.crt \
Original file line number Diff line number Diff line change @@ -26,7 +26,8 @@ Container image: [DockerHub](https://hub.docker.com/r/oitc/weather2mqtt)
2626
2727# Supported tags and respective ` Dockerfile ` links
2828
29- * [ ` latest ` , ` 1.3.1 ` ] ( https://github.com/cybcon/docker.weather2mqtt/blob/v1.3.1/Dockerfile )
29+ * [ ` latest ` , ` 1.3.2 ` ] ( https://github.com/cybcon/docker.weather2mqtt/blob/v1.3.2/Dockerfile )
30+ * [ ` 1.3.1 ` ] ( https://github.com/cybcon/docker.weather2mqtt/blob/v1.3.1/Dockerfile )
3031* [ ` 1.3.0 ` ] ( https://github.com/cybcon/docker.weather2mqtt/blob/v1.3.0/Dockerfile )
3132* [ ` 1.2.0 ` ] ( https://github.com/cybcon/docker.weather2mqtt/blob/v1.2.0/Dockerfile )
3233* [ ` 1.1.1 ` ] ( https://github.com/cybcon/docker.weather2mqtt/blob/v1.1.1/Dockerfile )
Original file line number Diff line number Diff line change 1313__author__ = "Michael Oberdorf <info@oberdorf-itc.de>"
1414__status__ = "production"
1515__date__ = "2026-01-11"
16- __version_info__ = ("1" , "0" , "0 " )
16+ __version_info__ = ("1" , "0" , "1 " )
1717__version__ = "." .join (__version_info__ )
1818
1919__all__ = ["WeatherCodes" ]
2020
2121import json
2222import logging
23+ import math
2324import os
2425
2526
@@ -53,7 +54,15 @@ def translate(self, code: int) -> str:
5354 :return: Human readable description
5455 """
5556 # transform the code to int and str to fit to the json keys
56- code = str (int (code ))
57+
58+ # Avoid "cannot convert float NaN to integer"
59+ if math .isnan (code ):
60+ self .logger .debug (f"Weather code { code } is NaN, returning 'Unknown weather code'" )
61+ return "Unknown weather code"
62+ if isinstance (code , float ):
63+ self .logger .debug (f"Weather code { code } is float, converting to int" )
64+ code = int (code )
65+ code = str (code )
5766 self .logger .debug (f"Translating weather code { code } " )
5867 translation = self .weather_codes .get (code , "Unknown weather code" )
5968 self .logger .debug (f"Weather code { code } translated to '{ translation } '" )
Original file line number Diff line number Diff line change 2929from lib .weather_codes import WeatherCodes
3030from retry_requests import retry # seeAlso: https://pypi.org/project/retry-requests/
3131
32- __version__ = "1.3.1 "
32+ __version__ = "1.3.2 "
3333__script_path__ = os .path .dirname (__file__ )
3434__config_path__ = os .path .join (os .path .dirname (__script_path__ ), "etc" )
3535__local_tz__ = pytz .timezone ("UTC" )
You can’t perform that action at this time.
0 commit comments