mirror of
https://github.com/home-assistant/core.git
synced 2025-07-09 22:37:11 +00:00
Remove entity description mixin in Roborock (#112930)
This commit is contained in:
parent
b837a969d8
commit
3c217d737e
@ -23,20 +23,13 @@ from .coordinator import RoborockDataUpdateCoordinator
|
||||
from .device import RoborockCoordinatedEntity
|
||||
|
||||
|
||||
@dataclass(frozen=True)
|
||||
class RoborockBinarySensorDescriptionMixin:
|
||||
"""A class that describes binary sensor entities."""
|
||||
@dataclass(frozen=True, kw_only=True)
|
||||
class RoborockBinarySensorDescription(BinarySensorEntityDescription):
|
||||
"""A class that describes Roborock binary sensors."""
|
||||
|
||||
value_fn: Callable[[DeviceProp], bool | int | None]
|
||||
|
||||
|
||||
@dataclass(frozen=True)
|
||||
class RoborockBinarySensorDescription(
|
||||
BinarySensorEntityDescription, RoborockBinarySensorDescriptionMixin
|
||||
):
|
||||
"""A class that describes Roborock binary sensors."""
|
||||
|
||||
|
||||
BINARY_SENSOR_DESCRIPTIONS = [
|
||||
RoborockBinarySensorDescription(
|
||||
key="dry_status",
|
||||
|
@ -18,21 +18,14 @@ from .coordinator import RoborockDataUpdateCoordinator
|
||||
from .device import RoborockEntity
|
||||
|
||||
|
||||
@dataclass(frozen=True)
|
||||
class RoborockButtonDescriptionMixin:
|
||||
"""Define an entity description mixin for button entities."""
|
||||
@dataclass(frozen=True, kw_only=True)
|
||||
class RoborockButtonDescription(ButtonEntityDescription):
|
||||
"""Describes a Roborock button entity."""
|
||||
|
||||
command: RoborockCommand
|
||||
param: list | dict | None
|
||||
|
||||
|
||||
@dataclass(frozen=True)
|
||||
class RoborockButtonDescription(
|
||||
ButtonEntityDescription, RoborockButtonDescriptionMixin
|
||||
):
|
||||
"""Describes a Roborock button entity."""
|
||||
|
||||
|
||||
CONSUMABLE_BUTTON_DESCRIPTIONS = [
|
||||
RoborockButtonDescription(
|
||||
key="reset_sensor_consumable",
|
||||
|
@ -24,9 +24,9 @@ from .device import RoborockEntity
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
|
||||
|
||||
@dataclass(frozen=True)
|
||||
class RoborockNumberDescriptionMixin:
|
||||
"""Define an entity description mixin for button entities."""
|
||||
@dataclass(frozen=True, kw_only=True)
|
||||
class RoborockNumberDescription(NumberEntityDescription):
|
||||
"""Class to describe a Roborock number entity."""
|
||||
|
||||
# Gets the status of the switch
|
||||
cache_key: CacheableAttribute
|
||||
@ -34,13 +34,6 @@ class RoborockNumberDescriptionMixin:
|
||||
update_value: Callable[[AttributeCache, float], Coroutine[Any, Any, dict]]
|
||||
|
||||
|
||||
@dataclass(frozen=True)
|
||||
class RoborockNumberDescription(
|
||||
NumberEntityDescription, RoborockNumberDescriptionMixin
|
||||
):
|
||||
"""Class to describe an Roborock number entity."""
|
||||
|
||||
|
||||
NUMBER_DESCRIPTIONS: list[RoborockNumberDescription] = [
|
||||
RoborockNumberDescription(
|
||||
key="volume",
|
||||
|
@ -19,9 +19,9 @@ from .coordinator import RoborockDataUpdateCoordinator
|
||||
from .device import RoborockCoordinatedEntity
|
||||
|
||||
|
||||
@dataclass(frozen=True)
|
||||
class RoborockSelectDescriptionMixin:
|
||||
"""Define an entity description mixin for select entities."""
|
||||
@dataclass(frozen=True, kw_only=True)
|
||||
class RoborockSelectDescription(SelectEntityDescription):
|
||||
"""Class to describe a Roborock select entity."""
|
||||
|
||||
# The command that the select entity will send to the api.
|
||||
api_command: RoborockCommand
|
||||
@ -29,16 +29,9 @@ class RoborockSelectDescriptionMixin:
|
||||
value_fn: Callable[[Status], str | None]
|
||||
# Gets all options of the select entity.
|
||||
options_lambda: Callable[[Status], list[str] | None]
|
||||
# Takes the value from the select entiy and converts it for the api.
|
||||
# Takes the value from the select entity and converts it for the api.
|
||||
parameter_lambda: Callable[[str, Status], list[int]]
|
||||
|
||||
|
||||
@dataclass(frozen=True)
|
||||
class RoborockSelectDescription(
|
||||
SelectEntityDescription, RoborockSelectDescriptionMixin
|
||||
):
|
||||
"""Class to describe an Roborock select entity."""
|
||||
|
||||
protocol_listener: RoborockDataProtocol | None = None
|
||||
|
||||
|
||||
|
@ -37,19 +37,12 @@ from .coordinator import RoborockDataUpdateCoordinator
|
||||
from .device import RoborockCoordinatedEntity
|
||||
|
||||
|
||||
@dataclass(frozen=True)
|
||||
class RoborockSensorDescriptionMixin:
|
||||
"""A class that describes sensor entities."""
|
||||
@dataclass(frozen=True, kw_only=True)
|
||||
class RoborockSensorDescription(SensorEntityDescription):
|
||||
"""A class that describes Roborock sensors."""
|
||||
|
||||
value_fn: Callable[[DeviceProp], StateType | datetime.datetime]
|
||||
|
||||
|
||||
@dataclass(frozen=True)
|
||||
class RoborockSensorDescription(
|
||||
SensorEntityDescription, RoborockSensorDescriptionMixin
|
||||
):
|
||||
"""A class that describes Roborock sensors."""
|
||||
|
||||
protocol_listener: RoborockDataProtocol | None = None
|
||||
|
||||
|
||||
|
@ -25,9 +25,9 @@ from .device import RoborockEntity
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
|
||||
|
||||
@dataclass(frozen=True)
|
||||
class RoborockSwitchDescriptionMixin:
|
||||
"""Define an entity description mixin for switch entities."""
|
||||
@dataclass(frozen=True, kw_only=True)
|
||||
class RoborockSwitchDescription(SwitchEntityDescription):
|
||||
"""Class to describe a Roborock switch entity."""
|
||||
|
||||
# Gets the status of the switch
|
||||
cache_key: CacheableAttribute
|
||||
@ -37,13 +37,6 @@ class RoborockSwitchDescriptionMixin:
|
||||
attribute: str
|
||||
|
||||
|
||||
@dataclass(frozen=True)
|
||||
class RoborockSwitchDescription(
|
||||
SwitchEntityDescription, RoborockSwitchDescriptionMixin
|
||||
):
|
||||
"""Class to describe an Roborock switch entity."""
|
||||
|
||||
|
||||
SWITCH_DESCRIPTIONS: list[RoborockSwitchDescription] = [
|
||||
RoborockSwitchDescription(
|
||||
cache_key=CacheableAttribute.child_lock_status,
|
||||
|
@ -26,9 +26,9 @@ from .device import RoborockEntity
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
|
||||
|
||||
@dataclass(frozen=True)
|
||||
class RoborockTimeDescriptionMixin:
|
||||
"""Define an entity description mixin for time entities."""
|
||||
@dataclass(frozen=True, kw_only=True)
|
||||
class RoborockTimeDescription(TimeEntityDescription):
|
||||
"""Class to describe a Roborock time entity."""
|
||||
|
||||
# Gets the status of the switch
|
||||
cache_key: CacheableAttribute
|
||||
@ -38,11 +38,6 @@ class RoborockTimeDescriptionMixin:
|
||||
get_value: Callable[[AttributeCache], datetime.time]
|
||||
|
||||
|
||||
@dataclass(frozen=True)
|
||||
class RoborockTimeDescription(TimeEntityDescription, RoborockTimeDescriptionMixin):
|
||||
"""Class to describe an Roborock time entity."""
|
||||
|
||||
|
||||
TIME_DESCRIPTIONS: list[RoborockTimeDescription] = [
|
||||
RoborockTimeDescription(
|
||||
key="dnd_start_time",
|
||||
|
Loading…
x
Reference in New Issue
Block a user