From bd8baed731cfa4bcbb11bd52b78b72ad594f3a67 Mon Sep 17 00:00:00 2001 From: Lennart Weller Date: Mon, 8 Jul 2024 19:15:09 +0000 Subject: [PATCH] fix: add vendor identifier to weatherstation --- aiocloudweather/station.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/aiocloudweather/station.py b/aiocloudweather/station.py index 635939b..160b949 100644 --- a/aiocloudweather/station.py +++ b/aiocloudweather/station.py @@ -1,6 +1,7 @@ """The module parses incoming weather data from various sources into a common format.""" from dataclasses import dataclass, field, fields +from enum import Enum import logging from typing import Final @@ -32,6 +33,11 @@ _LOGGER = logging.getLogger(__name__) +class WeatherstationVendor(Enum): + """""" + WUNDERGROUND = "wunderground" + WEATHERCLOUD = "weathercloud" + @dataclass class WundergroundRawSensor: """Wunderground sensor parsed from query string.""" @@ -197,6 +203,8 @@ class WeatherStation: station_id: str station_key: str + vendor: WeatherstationVendor + station_sw_version: str = field(default=None) station_client_ip: str = field(default=None) update_time: float = field(default=None) @@ -289,7 +297,7 @@ def from_wunderground(data: WundergroundRawSensor) -> "WeatherStation": imperial_unit=unit, ) return WeatherStation( - station_id=data.station_id, station_key=data.station_key, **sensor_data + station_id=data.station_id, station_key=data.station_key, vendor=WeatherstationVendor.WUNDERGROUND, **sensor_data ) @staticmethod @@ -353,5 +361,6 @@ def from_weathercloud(data: WeathercloudRawSensor) -> "WeatherStation": return WeatherStation( station_id=str(data.station_id), station_key=str(data.station_key), + vendor=WeatherstationVendor.WEATHERCLOUD, **sensor_data, )