Remove unnecessary RainMachine entity description mixins (#108190)
parent
9bbf098901
commit
d5c1049bfe
|
@ -13,10 +13,7 @@ from homeassistant.helpers.entity_platform import AddEntitiesCallback
|
|||
|
||||
from . import RainMachineData, RainMachineEntity
|
||||
from .const import DATA_PROVISION_SETTINGS, DATA_RESTRICTIONS_CURRENT, DOMAIN
|
||||
from .model import (
|
||||
RainMachineEntityDescription,
|
||||
RainMachineEntityDescriptionMixinDataKey,
|
||||
)
|
||||
from .model import RainMachineEntityDescription
|
||||
from .util import (
|
||||
EntityDomainReplacementStrategy,
|
||||
async_finish_entity_domain_replacements,
|
||||
|
@ -32,14 +29,14 @@ TYPE_RAINSENSOR = "rainsensor"
|
|||
TYPE_WEEKDAY = "weekday"
|
||||
|
||||
|
||||
@dataclass(frozen=True)
|
||||
@dataclass(frozen=True, kw_only=True)
|
||||
class RainMachineBinarySensorDescription(
|
||||
BinarySensorEntityDescription,
|
||||
RainMachineEntityDescription,
|
||||
RainMachineEntityDescriptionMixinDataKey,
|
||||
BinarySensorEntityDescription, RainMachineEntityDescription
|
||||
):
|
||||
"""Describe a RainMachine binary sensor."""
|
||||
|
||||
data_key: str
|
||||
|
||||
|
||||
BINARY_SENSOR_DESCRIPTIONS = (
|
||||
RainMachineBinarySensorDescription(
|
||||
|
|
|
@ -24,21 +24,14 @@ from .const import DATA_PROVISION_SETTINGS, DOMAIN
|
|||
from .model import RainMachineEntityDescription
|
||||
|
||||
|
||||
@dataclass(frozen=True)
|
||||
class RainMachineButtonDescriptionMixin:
|
||||
"""Define an entity description mixin for RainMachine buttons."""
|
||||
|
||||
push_action: Callable[[Controller], Awaitable]
|
||||
|
||||
|
||||
@dataclass(frozen=True)
|
||||
@dataclass(frozen=True, kw_only=True)
|
||||
class RainMachineButtonDescription(
|
||||
ButtonEntityDescription,
|
||||
RainMachineEntityDescription,
|
||||
RainMachineButtonDescriptionMixin,
|
||||
ButtonEntityDescription, RainMachineEntityDescription
|
||||
):
|
||||
"""Describe a RainMachine button description."""
|
||||
|
||||
push_action: Callable[[Controller], Awaitable]
|
||||
|
||||
|
||||
BUTTON_KIND_REBOOT = "reboot"
|
||||
|
||||
|
|
|
@ -4,29 +4,8 @@ from dataclasses import dataclass
|
|||
from homeassistant.helpers.entity import EntityDescription
|
||||
|
||||
|
||||
@dataclass(frozen=True)
|
||||
class RainMachineEntityDescriptionMixinApiCategory:
|
||||
"""Define an entity description mixin to include an API category."""
|
||||
@dataclass(frozen=True, kw_only=True)
|
||||
class RainMachineEntityDescription(EntityDescription):
|
||||
"""Describe a RainMachine entity."""
|
||||
|
||||
api_category: str
|
||||
|
||||
|
||||
@dataclass(frozen=True)
|
||||
class RainMachineEntityDescriptionMixinDataKey:
|
||||
"""Define an entity description mixin to include a data payload key."""
|
||||
|
||||
data_key: str
|
||||
|
||||
|
||||
@dataclass(frozen=True)
|
||||
class RainMachineEntityDescriptionMixinUid:
|
||||
"""Define an entity description mixin to include an activity UID."""
|
||||
|
||||
uid: int
|
||||
|
||||
|
||||
@dataclass(frozen=True)
|
||||
class RainMachineEntityDescription(
|
||||
EntityDescription, RainMachineEntityDescriptionMixinApiCategory
|
||||
):
|
||||
"""Describe a RainMachine entity."""
|
||||
|
|
|
@ -15,21 +15,18 @@ from homeassistant.util.unit_system import US_CUSTOMARY_SYSTEM, UnitSystem
|
|||
|
||||
from . import RainMachineData, RainMachineEntity
|
||||
from .const import DATA_RESTRICTIONS_UNIVERSAL, DOMAIN
|
||||
from .model import (
|
||||
RainMachineEntityDescription,
|
||||
RainMachineEntityDescriptionMixinDataKey,
|
||||
)
|
||||
from .model import RainMachineEntityDescription
|
||||
from .util import key_exists
|
||||
|
||||
|
||||
@dataclass(frozen=True)
|
||||
@dataclass(frozen=True, kw_only=True)
|
||||
class RainMachineSelectDescription(
|
||||
SelectEntityDescription,
|
||||
RainMachineEntityDescription,
|
||||
RainMachineEntityDescriptionMixinDataKey,
|
||||
SelectEntityDescription, RainMachineEntityDescription
|
||||
):
|
||||
"""Describe a generic RainMachine select."""
|
||||
|
||||
data_key: str
|
||||
|
||||
|
||||
@dataclass
|
||||
class FreezeProtectionSelectOption:
|
||||
|
@ -40,20 +37,13 @@ class FreezeProtectionSelectOption:
|
|||
metric_label: str
|
||||
|
||||
|
||||
@dataclass(frozen=True)
|
||||
class FreezeProtectionTemperatureMixin:
|
||||
"""Define an entity description mixin to include an options list."""
|
||||
@dataclass(frozen=True, kw_only=True)
|
||||
class FreezeProtectionSelectDescription(RainMachineSelectDescription):
|
||||
"""Describe a freeze protection temperature select."""
|
||||
|
||||
extended_options: list[FreezeProtectionSelectOption]
|
||||
|
||||
|
||||
@dataclass(frozen=True)
|
||||
class FreezeProtectionSelectDescription(
|
||||
RainMachineSelectDescription, FreezeProtectionTemperatureMixin
|
||||
):
|
||||
"""Describe a freeze protection temperature select."""
|
||||
|
||||
|
||||
TYPE_FREEZE_PROTECTION_TEMPERATURE = "freeze_protection_temperature"
|
||||
|
||||
SELECT_DESCRIPTIONS = (
|
||||
|
|
|
@ -21,11 +21,7 @@ from homeassistant.util.dt import utc_from_timestamp, utcnow
|
|||
|
||||
from . import RainMachineData, RainMachineEntity
|
||||
from .const import DATA_PROGRAMS, DATA_PROVISION_SETTINGS, DATA_ZONES, DOMAIN
|
||||
from .model import (
|
||||
RainMachineEntityDescription,
|
||||
RainMachineEntityDescriptionMixinDataKey,
|
||||
RainMachineEntityDescriptionMixinUid,
|
||||
)
|
||||
from .model import RainMachineEntityDescription
|
||||
from .util import (
|
||||
RUN_STATE_MAP,
|
||||
EntityDomainReplacementStrategy,
|
||||
|
@ -48,23 +44,23 @@ TYPE_RAIN_SENSOR_RAIN_START = "rain_sensor_rain_start"
|
|||
TYPE_ZONE_RUN_COMPLETION_TIME = "zone_run_completion_time"
|
||||
|
||||
|
||||
@dataclass(frozen=True)
|
||||
@dataclass(frozen=True, kw_only=True)
|
||||
class RainMachineSensorDataDescription(
|
||||
SensorEntityDescription,
|
||||
RainMachineEntityDescription,
|
||||
RainMachineEntityDescriptionMixinDataKey,
|
||||
SensorEntityDescription, RainMachineEntityDescription
|
||||
):
|
||||
"""Describe a RainMachine sensor."""
|
||||
|
||||
data_key: str
|
||||
|
||||
@dataclass(frozen=True)
|
||||
|
||||
@dataclass(frozen=True, kw_only=True)
|
||||
class RainMachineSensorCompletionTimerDescription(
|
||||
SensorEntityDescription,
|
||||
RainMachineEntityDescription,
|
||||
RainMachineEntityDescriptionMixinUid,
|
||||
SensorEntityDescription, RainMachineEntityDescription
|
||||
):
|
||||
"""Describe a RainMachine completion timer sensor."""
|
||||
|
||||
uid: int
|
||||
|
||||
|
||||
SENSOR_DESCRIPTIONS = (
|
||||
RainMachineSensorDataDescription(
|
||||
|
|
|
@ -31,11 +31,7 @@ from .const import (
|
|||
DEFAULT_ZONE_RUN,
|
||||
DOMAIN,
|
||||
)
|
||||
from .model import (
|
||||
RainMachineEntityDescription,
|
||||
RainMachineEntityDescriptionMixinDataKey,
|
||||
RainMachineEntityDescriptionMixinUid,
|
||||
)
|
||||
from .model import RainMachineEntityDescription
|
||||
from .util import RUN_STATE_MAP, key_exists
|
||||
|
||||
ATTR_AREA = "area"
|
||||
|
@ -134,27 +130,26 @@ def raise_on_request_error(
|
|||
return decorator
|
||||
|
||||
|
||||
@dataclass(frozen=True)
|
||||
@dataclass(frozen=True, kw_only=True)
|
||||
class RainMachineSwitchDescription(
|
||||
SwitchEntityDescription,
|
||||
RainMachineEntityDescription,
|
||||
SwitchEntityDescription, RainMachineEntityDescription
|
||||
):
|
||||
"""Describe a RainMachine switch."""
|
||||
|
||||
|
||||
@dataclass(frozen=True)
|
||||
class RainMachineActivitySwitchDescription(
|
||||
RainMachineSwitchDescription, RainMachineEntityDescriptionMixinUid
|
||||
):
|
||||
@dataclass(frozen=True, kw_only=True)
|
||||
class RainMachineActivitySwitchDescription(RainMachineSwitchDescription):
|
||||
"""Describe a RainMachine activity (program/zone) switch."""
|
||||
|
||||
uid: int
|
||||
|
||||
@dataclass(frozen=True)
|
||||
class RainMachineRestrictionSwitchDescription(
|
||||
RainMachineSwitchDescription, RainMachineEntityDescriptionMixinDataKey
|
||||
):
|
||||
|
||||
@dataclass(frozen=True, kw_only=True)
|
||||
class RainMachineRestrictionSwitchDescription(RainMachineSwitchDescription):
|
||||
"""Describe a RainMachine restriction switch."""
|
||||
|
||||
data_key: str
|
||||
|
||||
|
||||
TYPE_RESTRICTIONS_FREEZE_PROTECT_ENABLED = "freeze_protect_enabled"
|
||||
TYPE_RESTRICTIONS_HOT_DAYS_EXTRA_WATERING = "hot_days_extra_watering"
|
||||
|
|
Loading…
Reference in New Issue