From a7f71eaa3550699687cdfe36caaa3335b2caa2d3 Mon Sep 17 00:00:00 2001 From: Joost Lekkerkerker Date: Sun, 10 Mar 2024 21:45:06 +0100 Subject: [PATCH] Remove entity description mixin in Tractive (#112952) Remove entity description mixin in Tractive --- homeassistant/components/tractive/sensor.py | 13 +++---------- homeassistant/components/tractive/switch.py | 13 +++---------- 2 files changed, 6 insertions(+), 20 deletions(-) diff --git a/homeassistant/components/tractive/sensor.py b/homeassistant/components/tractive/sensor.py index 928d52c29df..b73b5faba05 100644 --- a/homeassistant/components/tractive/sensor.py +++ b/homeassistant/components/tractive/sensor.py @@ -44,19 +44,12 @@ from .const import ( from .entity import TractiveEntity -@dataclass(frozen=True) -class TractiveRequiredKeysMixin: - """Mixin for required keys.""" +@dataclass(frozen=True, kw_only=True) +class TractiveSensorEntityDescription(SensorEntityDescription): + """Class describing Tractive sensor entities.""" signal_prefix: str - -@dataclass(frozen=True) -class TractiveSensorEntityDescription( - SensorEntityDescription, TractiveRequiredKeysMixin -): - """Class describing Tractive sensor entities.""" - hardware_sensor: bool = False value_fn: Callable[[StateType], StateType] = lambda state: state diff --git a/homeassistant/components/tractive/switch.py b/homeassistant/components/tractive/switch.py index 9b8e6002d80..52aa9f1e901 100644 --- a/homeassistant/components/tractive/switch.py +++ b/homeassistant/components/tractive/switch.py @@ -29,20 +29,13 @@ from .entity import TractiveEntity _LOGGER = logging.getLogger(__name__) -@dataclass(frozen=True) -class TractiveRequiredKeysMixin: - """Mixin for required keys.""" +@dataclass(frozen=True, kw_only=True) +class TractiveSwitchEntityDescription(SwitchEntityDescription): + """Class describing Tractive switch entities.""" method: Literal["async_set_buzzer", "async_set_led", "async_set_live_tracking"] -@dataclass(frozen=True) -class TractiveSwitchEntityDescription( - SwitchEntityDescription, TractiveRequiredKeysMixin -): - """Class describing Tractive switch entities.""" - - SWITCH_TYPES: tuple[TractiveSwitchEntityDescription, ...] = ( TractiveSwitchEntityDescription( key=ATTR_BUZZER,