Remove entity description mixin in WeatherFlow (#112971)

This commit is contained in:
Joost Lekkerkerker 2024-03-11 11:16:29 +01:00 committed by GitHub
parent 716a163f5f
commit e696afabe7
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -47,13 +47,6 @@ from homeassistant.util.unit_system import METRIC_SYSTEM
from .const import DOMAIN, LOGGER, format_dispatch_call from .const import DOMAIN, LOGGER, format_dispatch_call
@dataclass(frozen=True)
class WeatherFlowSensorRequiredKeysMixin:
"""Mixin for required keys."""
raw_data_conv_fn: Callable[[WeatherFlowDevice], datetime | StateType]
def precipitation_raw_conversion_fn(raw_data: Enum): def precipitation_raw_conversion_fn(raw_data: Enum):
"""Parse parse precipitation type.""" """Parse parse precipitation type."""
if raw_data.name.lower() == "unknown": if raw_data.name.lower() == "unknown":
@ -61,14 +54,14 @@ def precipitation_raw_conversion_fn(raw_data: Enum):
return raw_data.name.lower() return raw_data.name.lower()
@dataclass(frozen=True) @dataclass(frozen=True, kw_only=True)
class WeatherFlowSensorEntityDescription( class WeatherFlowSensorEntityDescription(SensorEntityDescription):
SensorEntityDescription, WeatherFlowSensorRequiredKeysMixin
):
"""Describes WeatherFlow sensor entity.""" """Describes WeatherFlow sensor entity."""
raw_data_conv_fn: Callable[[WeatherFlowDevice], datetime | StateType]
event_subscriptions: list[str] = field(default_factory=lambda: [EVENT_OBSERVATION]) event_subscriptions: list[str] = field(default_factory=lambda: [EVENT_OBSERVATION])
imperial_suggested_unit: None | str = None imperial_suggested_unit: str | None = None
def get_native_value(self, device: WeatherFlowDevice) -> datetime | StateType: def get_native_value(self, device: WeatherFlowDevice) -> datetime | StateType:
"""Return the parsed sensor value.""" """Return the parsed sensor value."""