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