mirror of
https://github.com/home-assistant/core.git
synced 2025-07-10 14:57:09 +00:00
Remove entity description mixin in BMW (#112391)
This commit is contained in:
parent
7cef704220
commit
cb397cecb1
@ -109,19 +109,11 @@ def _format_cbs_report(
|
||||
return result
|
||||
|
||||
|
||||
@dataclass(frozen=True)
|
||||
class BMWRequiredKeysMixin:
|
||||
"""Mixin for required keys."""
|
||||
|
||||
value_fn: Callable[[MyBMWVehicle], bool]
|
||||
|
||||
|
||||
@dataclass(frozen=True)
|
||||
class BMWBinarySensorEntityDescription(
|
||||
BinarySensorEntityDescription, BMWRequiredKeysMixin
|
||||
):
|
||||
@dataclass(frozen=True, kw_only=True)
|
||||
class BMWBinarySensorEntityDescription(BinarySensorEntityDescription):
|
||||
"""Describes BMW binary_sensor entity."""
|
||||
|
||||
value_fn: Callable[[MyBMWVehicle], bool]
|
||||
attr_fn: Callable[[MyBMWVehicle, UnitSystem], dict[str, Any]] | None = None
|
||||
|
||||
|
||||
|
@ -25,17 +25,11 @@ if TYPE_CHECKING:
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
|
||||
|
||||
@dataclass(frozen=True)
|
||||
class BMWRequiredKeysMixin:
|
||||
"""Mixin for required keys."""
|
||||
|
||||
remote_function: Callable[[MyBMWVehicle], Coroutine[Any, Any, RemoteServiceStatus]]
|
||||
|
||||
|
||||
@dataclass(frozen=True)
|
||||
class BMWButtonEntityDescription(ButtonEntityDescription, BMWRequiredKeysMixin):
|
||||
@dataclass(frozen=True, kw_only=True)
|
||||
class BMWButtonEntityDescription(ButtonEntityDescription):
|
||||
"""Class describing BMW button entities."""
|
||||
|
||||
remote_function: Callable[[MyBMWVehicle], Coroutine[Any, Any, RemoteServiceStatus]]
|
||||
enabled_when_read_only: bool = False
|
||||
is_available: Callable[[MyBMWVehicle], bool] = lambda _: True
|
||||
|
||||
|
@ -26,18 +26,12 @@ from .coordinator import BMWDataUpdateCoordinator
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
|
||||
|
||||
@dataclass(frozen=True)
|
||||
class BMWRequiredKeysMixin:
|
||||
"""Mixin for required keys."""
|
||||
@dataclass(frozen=True, kw_only=True)
|
||||
class BMWNumberEntityDescription(NumberEntityDescription):
|
||||
"""Describes BMW number entity."""
|
||||
|
||||
value_fn: Callable[[MyBMWVehicle], float | int | None]
|
||||
remote_service: Callable[[MyBMWVehicle, float | int], Coroutine[Any, Any, Any]]
|
||||
|
||||
|
||||
@dataclass(frozen=True)
|
||||
class BMWNumberEntityDescription(NumberEntityDescription, BMWRequiredKeysMixin):
|
||||
"""Describes BMW number entity."""
|
||||
|
||||
is_available: Callable[[MyBMWVehicle], bool] = lambda _: False
|
||||
dynamic_options: Callable[[MyBMWVehicle], list[str]] | None = None
|
||||
|
||||
|
@ -22,18 +22,12 @@ from .coordinator import BMWDataUpdateCoordinator
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
|
||||
|
||||
@dataclass(frozen=True)
|
||||
class BMWRequiredKeysMixin:
|
||||
"""Mixin for required keys."""
|
||||
@dataclass(frozen=True, kw_only=True)
|
||||
class BMWSelectEntityDescription(SelectEntityDescription):
|
||||
"""Describes BMW sensor entity."""
|
||||
|
||||
current_option: Callable[[MyBMWVehicle], str]
|
||||
remote_service: Callable[[MyBMWVehicle, str], Coroutine[Any, Any, Any]]
|
||||
|
||||
|
||||
@dataclass(frozen=True)
|
||||
class BMWSelectEntityDescription(SelectEntityDescription, BMWRequiredKeysMixin):
|
||||
"""Describes BMW sensor entity."""
|
||||
|
||||
is_available: Callable[[MyBMWVehicle], bool] = lambda _: False
|
||||
dynamic_options: Callable[[MyBMWVehicle], list[str]] | None = None
|
||||
|
||||
|
@ -22,19 +22,13 @@ from .coordinator import BMWDataUpdateCoordinator
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
|
||||
|
||||
@dataclass(frozen=True)
|
||||
class BMWRequiredKeysMixin:
|
||||
"""Mixin for required keys."""
|
||||
@dataclass(frozen=True, kw_only=True)
|
||||
class BMWSwitchEntityDescription(SwitchEntityDescription):
|
||||
"""Describes BMW switch entity."""
|
||||
|
||||
value_fn: Callable[[MyBMWVehicle], bool]
|
||||
remote_service_on: Callable[[MyBMWVehicle], Coroutine[Any, Any, Any]]
|
||||
remote_service_off: Callable[[MyBMWVehicle], Coroutine[Any, Any, Any]]
|
||||
|
||||
|
||||
@dataclass(frozen=True)
|
||||
class BMWSwitchEntityDescription(SwitchEntityDescription, BMWRequiredKeysMixin):
|
||||
"""Describes BMW switch entity."""
|
||||
|
||||
is_available: Callable[[MyBMWVehicle], bool] = lambda _: False
|
||||
dynamic_options: Callable[[MyBMWVehicle], list[str]] | None = None
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user