Remove entity description mixin in V2C (#112960)
parent
b914ac3185
commit
4b84954d17
|
@ -21,20 +21,13 @@ from .coordinator import V2CUpdateCoordinator
|
|||
from .entity import V2CBaseEntity
|
||||
|
||||
|
||||
@dataclass(frozen=True)
|
||||
class V2CRequiredKeysMixin:
|
||||
"""Mixin for required keys."""
|
||||
@dataclass(frozen=True, kw_only=True)
|
||||
class V2CBinarySensorEntityDescription(BinarySensorEntityDescription):
|
||||
"""Describes an EVSE binary sensor entity."""
|
||||
|
||||
value_fn: Callable[[Trydan], bool]
|
||||
|
||||
|
||||
@dataclass(frozen=True)
|
||||
class V2CBinarySensorEntityDescription(
|
||||
BinarySensorEntityDescription, V2CRequiredKeysMixin
|
||||
):
|
||||
"""Describes an EVSE binary sensor entity."""
|
||||
|
||||
|
||||
TRYDAN_SENSORS = (
|
||||
V2CBinarySensorEntityDescription(
|
||||
key="connected",
|
||||
|
|
|
@ -25,21 +25,14 @@ MIN_INTENSITY = 6
|
|||
MAX_INTENSITY = 32
|
||||
|
||||
|
||||
@dataclass(frozen=True)
|
||||
class V2CSettingsRequiredKeysMixin:
|
||||
"""Mixin for required keys."""
|
||||
@dataclass(frozen=True, kw_only=True)
|
||||
class V2CSettingsNumberEntityDescription(NumberEntityDescription):
|
||||
"""Describes V2C EVSE number entity."""
|
||||
|
||||
value_fn: Callable[[TrydanData], int]
|
||||
update_fn: Callable[[Trydan, int], Coroutine[Any, Any, None]]
|
||||
|
||||
|
||||
@dataclass(frozen=True)
|
||||
class V2CSettingsNumberEntityDescription(
|
||||
NumberEntityDescription, V2CSettingsRequiredKeysMixin
|
||||
):
|
||||
"""Describes V2C EVSE number entity."""
|
||||
|
||||
|
||||
TRYDAN_NUMBER_SETTINGS = (
|
||||
V2CSettingsNumberEntityDescription(
|
||||
key="intensity",
|
||||
|
|
|
@ -26,18 +26,13 @@ from .entity import V2CBaseEntity
|
|||
_LOGGER = logging.getLogger(__name__)
|
||||
|
||||
|
||||
@dataclass(frozen=True)
|
||||
class V2CRequiredKeysMixin:
|
||||
"""Mixin for required keys."""
|
||||
@dataclass(frozen=True, kw_only=True)
|
||||
class V2CSensorEntityDescription(SensorEntityDescription):
|
||||
"""Describes an EVSE Power sensor entity."""
|
||||
|
||||
value_fn: Callable[[TrydanData], float]
|
||||
|
||||
|
||||
@dataclass(frozen=True)
|
||||
class V2CSensorEntityDescription(SensorEntityDescription, V2CRequiredKeysMixin):
|
||||
"""Describes an EVSE Power sensor entity."""
|
||||
|
||||
|
||||
TRYDAN_SENSORS = (
|
||||
V2CSensorEntityDescription(
|
||||
key="charge_power",
|
||||
|
|
|
@ -28,20 +28,15 @@ from .entity import V2CBaseEntity
|
|||
_LOGGER = logging.getLogger(__name__)
|
||||
|
||||
|
||||
@dataclass(frozen=True)
|
||||
class V2CRequiredKeysMixin:
|
||||
"""Mixin for required keys."""
|
||||
@dataclass(frozen=True, kw_only=True)
|
||||
class V2CSwitchEntityDescription(SwitchEntityDescription):
|
||||
"""Describes a V2C EVSE switch entity."""
|
||||
|
||||
value_fn: Callable[[TrydanData], bool]
|
||||
turn_on_fn: Callable[[Trydan], Coroutine[Any, Any, Any]]
|
||||
turn_off_fn: Callable[[Trydan], Coroutine[Any, Any, Any]]
|
||||
|
||||
|
||||
@dataclass(frozen=True)
|
||||
class V2CSwitchEntityDescription(SwitchEntityDescription, V2CRequiredKeysMixin):
|
||||
"""Describes a V2C EVSE switch entity."""
|
||||
|
||||
|
||||
TRYDAN_SWITCHES = (
|
||||
V2CSwitchEntityDescription(
|
||||
key="paused",
|
||||
|
|
Loading…
Reference in New Issue