Remove Rituals Parfume Genie entity descriptions required fields mixins (#103999)

pull/104014/head
Franck Nijhof 2023-11-15 03:48:31 +01:00 committed by GitHub
parent 1a079d7c6f
commit 76ccad40ff
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 12 additions and 41 deletions

View File

@ -21,21 +21,14 @@ from .coordinator import RitualsDataUpdateCoordinator
from .entity import DiffuserEntity
@dataclass
class RitualsentityDescriptionMixin:
"""Mixin values for Rituals entities."""
@dataclass(kw_only=True)
class RitualsBinarySensorEntityDescription(BinarySensorEntityDescription):
"""Class describing Rituals binary sensor entities."""
is_on_fn: Callable[[Diffuser], bool]
has_fn: Callable[[Diffuser], bool]
@dataclass
class RitualsBinarySensorEntityDescription(
BinarySensorEntityDescription, RitualsentityDescriptionMixin
):
"""Class describing Rituals binary sensor entities."""
ENTITY_DESCRIPTIONS = (
RitualsBinarySensorEntityDescription(
key="charging",

View File

@ -17,21 +17,14 @@ from .coordinator import RitualsDataUpdateCoordinator
from .entity import DiffuserEntity
@dataclass
class RitualsNumberEntityDescriptionMixin:
"""Mixin for required keys."""
@dataclass(kw_only=True)
class RitualsNumberEntityDescription(NumberEntityDescription):
"""Class describing Rituals number entities."""
value_fn: Callable[[Diffuser], int]
set_value_fn: Callable[[Diffuser, int], Awaitable[Any]]
@dataclass
class RitualsNumberEntityDescription(
NumberEntityDescription, RitualsNumberEntityDescriptionMixin
):
"""Class describing Rituals number entities."""
ENTITY_DESCRIPTIONS = (
RitualsNumberEntityDescription(
key="perfume_amount",

View File

@ -17,21 +17,14 @@ from .coordinator import RitualsDataUpdateCoordinator
from .entity import DiffuserEntity
@dataclass
class RitualsEntityDescriptionMixin:
"""Mixin for required keys."""
@dataclass(kw_only=True)
class RitualsSelectEntityDescription(SelectEntityDescription):
"""Class describing Rituals select entities."""
current_fn: Callable[[Diffuser], str]
select_fn: Callable[[Diffuser, str], Awaitable[None]]
@dataclass
class RitualsSelectEntityDescription(
SelectEntityDescription, RitualsEntityDescriptionMixin
):
"""Class describing Rituals select entities."""
ENTITY_DESCRIPTIONS = (
RitualsSelectEntityDescription(
key="room_size_square_meter",

View File

@ -21,20 +21,12 @@ from .coordinator import RitualsDataUpdateCoordinator
from .entity import DiffuserEntity
@dataclass
class RitualsEntityDescriptionMixin:
"""Mixin values for Rituals entities."""
value_fn: Callable[[Diffuser], int | str]
@dataclass
class RitualsSensorEntityDescription(
SensorEntityDescription, RitualsEntityDescriptionMixin
):
@dataclass(kw_only=True)
class RitualsSensorEntityDescription(SensorEntityDescription):
"""Class describing Rituals sensor entities."""
has_fn: Callable[[Diffuser], bool] = lambda _: True
value_fn: Callable[[Diffuser], int | str]
ENTITY_DESCRIPTIONS = (