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