Remove HomeWizard entity descriptions required fields mixins (#103994)

This commit is contained in:
Franck Nijhof 2023-11-15 09:00:28 +01:00 committed by GitHub
parent 8df7291abb
commit cfac6d18f3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 26 deletions

View File

@ -35,21 +35,13 @@ from .entity import HomeWizardEntity
PARALLEL_UPDATES = 1
@dataclass
class HomeWizardEntityDescriptionMixin:
"""Mixin values for HomeWizard entities."""
has_fn: Callable[[Data], bool]
value_fn: Callable[[Data], StateType]
@dataclass
class HomeWizardSensorEntityDescription(
SensorEntityDescription, HomeWizardEntityDescriptionMixin
):
@dataclass(kw_only=True)
class HomeWizardSensorEntityDescription(SensorEntityDescription):
"""Class describing HomeWizard sensor entities."""
enabled_fn: Callable[[Data], bool] = lambda data: True
has_fn: Callable[[Data], bool]
value_fn: Callable[[Data], StateType]
SENSORS: Final[tuple[HomeWizardSensorEntityDescription, ...]] = (

View File

@ -23,23 +23,15 @@ from .entity import HomeWizardEntity
from .helpers import homewizard_exception_handler
@dataclass
class HomeWizardEntityDescriptionMixin:
"""Mixin values for HomeWizard entities."""
create_fn: Callable[[HWEnergyDeviceUpdateCoordinator], bool]
available_fn: Callable[[DeviceResponseEntry], bool]
is_on_fn: Callable[[DeviceResponseEntry], bool | None]
set_fn: Callable[[HomeWizardEnergy, bool], Awaitable[Any]]
@dataclass
class HomeWizardSwitchEntityDescription(
SwitchEntityDescription, HomeWizardEntityDescriptionMixin
):
@dataclass(kw_only=True)
class HomeWizardSwitchEntityDescription(SwitchEntityDescription):
"""Class describing HomeWizard switch entities."""
available_fn: Callable[[DeviceResponseEntry], bool]
create_fn: Callable[[HWEnergyDeviceUpdateCoordinator], bool]
icon_off: str | None = None
is_on_fn: Callable[[DeviceResponseEntry], bool | None]
set_fn: Callable[[HomeWizardEnergy, bool], Awaitable[Any]]
SWITCHES = [