From 0d9696997cc40302b0e37516fe7987807d837882 Mon Sep 17 00:00:00 2001 From: Lennart Weller Date: Thu, 11 Jul 2024 00:13:55 +0200 Subject: [PATCH] fix: duplicate field names (#16) * also fix vendor name --- aiocloudweather/station.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/aiocloudweather/station.py b/aiocloudweather/station.py index 9cf3155..703daa8 100644 --- a/aiocloudweather/station.py +++ b/aiocloudweather/station.py @@ -36,8 +36,8 @@ class WeatherstationVendor(Enum): """The weather station cloud vendor.""" - WUNDERGROUND = "wunderground" - WEATHERCLOUD = "weathercloud" + WUNDERGROUND = "Weather Underground" + WEATHERCLOUD = "Weathercloud.net" @dataclass @@ -292,7 +292,7 @@ def from_wunderground(data: WundergroundRawSensor) -> "WeatherStation": else f"{sensor_field.name}raw" ) sensor_data[field_name] = Sensor( - name=sensor_field.name, + name=field_name, metric=value, metric_unit=unit, imperial=value, @@ -333,9 +333,9 @@ def from_weathercloud(data: WeathercloudRawSensor) -> "WeatherStation": conversion_func = METRIC_TO_IMPERIAL.get(unit) if conversion_func: - value = float(value) / 10 # All values are shifted by 10 + value: float = float(value) / 10 # All values are shifted by 10 try: - converted_value = conversion_func(float(value)) + converted_value = conversion_func(value) except TypeError as e: _LOGGER.error( "Failed to convert %s from %s to %s: %s -> %s",