mirror of
https://github.com/home-assistant/core.git
synced 2025-07-21 12:17:07 +00:00
Remove HomeWizard entity descriptions required fields mixins (#103994)
This commit is contained in:
parent
8df7291abb
commit
cfac6d18f3
@ -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, ...]] = (
|
||||
|
@ -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 = [
|
||||
|
Loading…
x
Reference in New Issue
Block a user