mirror of
https://github.com/home-assistant/core.git
synced 2025-07-29 08:07:45 +00:00
Remove entity description mixin in Roku (#112931)
This commit is contained in:
parent
85bc72f9f1
commit
b59bba8951
@ -20,20 +20,13 @@ from .const import DOMAIN
|
|||||||
from .entity import RokuEntity
|
from .entity import RokuEntity
|
||||||
|
|
||||||
|
|
||||||
@dataclass(frozen=True)
|
@dataclass(frozen=True, kw_only=True)
|
||||||
class RokuBinarySensorEntityDescriptionMixin:
|
class RokuBinarySensorEntityDescription(BinarySensorEntityDescription):
|
||||||
"""Mixin for required keys."""
|
"""Describes a Roku binary sensor entity."""
|
||||||
|
|
||||||
value_fn: Callable[[RokuDevice], bool | None]
|
value_fn: Callable[[RokuDevice], bool | None]
|
||||||
|
|
||||||
|
|
||||||
@dataclass(frozen=True)
|
|
||||||
class RokuBinarySensorEntityDescription(
|
|
||||||
BinarySensorEntityDescription, RokuBinarySensorEntityDescriptionMixin
|
|
||||||
):
|
|
||||||
"""Describes a Roku binary sensor entity."""
|
|
||||||
|
|
||||||
|
|
||||||
BINARY_SENSORS: tuple[RokuBinarySensorEntityDescription, ...] = (
|
BINARY_SENSORS: tuple[RokuBinarySensorEntityDescription, ...] = (
|
||||||
RokuBinarySensorEntityDescription(
|
RokuBinarySensorEntityDescription(
|
||||||
key="headphones_connected",
|
key="headphones_connected",
|
||||||
|
@ -19,15 +19,6 @@ from .entity import RokuEntity
|
|||||||
from .helpers import format_channel_name, roku_exception_handler
|
from .helpers import format_channel_name, roku_exception_handler
|
||||||
|
|
||||||
|
|
||||||
@dataclass(frozen=True)
|
|
||||||
class RokuSelectEntityDescriptionMixin:
|
|
||||||
"""Mixin for required keys."""
|
|
||||||
|
|
||||||
options_fn: Callable[[RokuDevice], list[str]]
|
|
||||||
value_fn: Callable[[RokuDevice], str | None]
|
|
||||||
set_fn: Callable[[RokuDevice, Roku, str], Awaitable[None]]
|
|
||||||
|
|
||||||
|
|
||||||
def _get_application_name(device: RokuDevice) -> str | None:
|
def _get_application_name(device: RokuDevice) -> str | None:
|
||||||
if device.app is None or device.app.name is None:
|
if device.app is None or device.app.name is None:
|
||||||
return None
|
return None
|
||||||
@ -86,12 +77,14 @@ async def _tune_channel(device: RokuDevice, roku: Roku, value: str) -> None:
|
|||||||
await roku.tune(_channel.number)
|
await roku.tune(_channel.number)
|
||||||
|
|
||||||
|
|
||||||
@dataclass(frozen=True)
|
@dataclass(frozen=True, kw_only=True)
|
||||||
class RokuSelectEntityDescription(
|
class RokuSelectEntityDescription(SelectEntityDescription):
|
||||||
SelectEntityDescription, RokuSelectEntityDescriptionMixin
|
|
||||||
):
|
|
||||||
"""Describes Roku select entity."""
|
"""Describes Roku select entity."""
|
||||||
|
|
||||||
|
options_fn: Callable[[RokuDevice], list[str]]
|
||||||
|
value_fn: Callable[[RokuDevice], str | None]
|
||||||
|
set_fn: Callable[[RokuDevice, Roku, str], Awaitable[None]]
|
||||||
|
|
||||||
|
|
||||||
ENTITIES: tuple[RokuSelectEntityDescription, ...] = (
|
ENTITIES: tuple[RokuSelectEntityDescription, ...] = (
|
||||||
RokuSelectEntityDescription(
|
RokuSelectEntityDescription(
|
||||||
|
@ -18,20 +18,13 @@ from .coordinator import RokuDataUpdateCoordinator
|
|||||||
from .entity import RokuEntity
|
from .entity import RokuEntity
|
||||||
|
|
||||||
|
|
||||||
@dataclass(frozen=True)
|
@dataclass(frozen=True, kw_only=True)
|
||||||
class RokuSensorEntityDescriptionMixin:
|
class RokuSensorEntityDescription(SensorEntityDescription):
|
||||||
"""Mixin for required keys."""
|
"""Describes Roku sensor entity."""
|
||||||
|
|
||||||
value_fn: Callable[[RokuDevice], str | None]
|
value_fn: Callable[[RokuDevice], str | None]
|
||||||
|
|
||||||
|
|
||||||
@dataclass(frozen=True)
|
|
||||||
class RokuSensorEntityDescription(
|
|
||||||
SensorEntityDescription, RokuSensorEntityDescriptionMixin
|
|
||||||
):
|
|
||||||
"""Describes Roku sensor entity."""
|
|
||||||
|
|
||||||
|
|
||||||
SENSORS: tuple[RokuSensorEntityDescription, ...] = (
|
SENSORS: tuple[RokuSensorEntityDescription, ...] = (
|
||||||
RokuSensorEntityDescription(
|
RokuSensorEntityDescription(
|
||||||
key="active_app",
|
key="active_app",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user