mirror of
https://github.com/home-assistant/core.git
synced 2025-07-18 10:47:10 +00:00
Remove entity description mixin in WeatherFlow (#112971)
This commit is contained in:
parent
716a163f5f
commit
e696afabe7
@ -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."""
|
||||||
|
Loading…
x
Reference in New Issue
Block a user