Skip to content
This repository was archived by the owner on Dec 14, 2025. It is now read-only.

Commit 33f7bae

Browse files
authored
fix: add vendor identifier to weatherstation (#15)
1 parent 6905325 commit 33f7bae

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

aiocloudweather/station.py

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
"""The module parses incoming weather data from various sources into a common format."""
22

33
from dataclasses import dataclass, field, fields
4+
from enum import Enum
45
import logging
56
from typing import Final
67

@@ -32,6 +33,13 @@
3233
_LOGGER = logging.getLogger(__name__)
3334

3435

36+
class WeatherstationVendor(Enum):
37+
"""The weather station cloud vendor."""
38+
39+
WUNDERGROUND = "wunderground"
40+
WEATHERCLOUD = "weathercloud"
41+
42+
3543
@dataclass
3644
class WundergroundRawSensor:
3745
"""Wunderground sensor parsed from query string."""
@@ -197,6 +205,8 @@ class WeatherStation:
197205

198206
station_id: str
199207
station_key: str
208+
vendor: WeatherstationVendor
209+
200210
station_sw_version: str = field(default=None)
201211
station_client_ip: str = field(default=None)
202212
update_time: float = field(default=None)
@@ -289,7 +299,10 @@ def from_wunderground(data: WundergroundRawSensor) -> "WeatherStation":
289299
imperial_unit=unit,
290300
)
291301
return WeatherStation(
292-
station_id=data.station_id, station_key=data.station_key, **sensor_data
302+
station_id=data.station_id,
303+
station_key=data.station_key,
304+
vendor=WeatherstationVendor.WUNDERGROUND,
305+
**sensor_data,
293306
)
294307

295308
@staticmethod
@@ -353,5 +366,6 @@ def from_weathercloud(data: WeathercloudRawSensor) -> "WeatherStation":
353366
return WeatherStation(
354367
station_id=str(data.station_id),
355368
station_key=str(data.station_key),
369+
vendor=WeatherstationVendor.WEATHERCLOUD,
356370
**sensor_data,
357371
)

0 commit comments

Comments
 (0)