mirror of
https://github.com/home-assistant/core.git
synced 2025-07-21 20:27:08 +00:00
Remove entity description mixin in Electric Kiwi (#112411)
This commit is contained in:
parent
85edafa887
commit
ff21a2fcca
@ -34,20 +34,13 @@ ATTR_NEXT_BILLING_DATE = "next_billing_date"
|
|||||||
ATTR_HOP_PERCENTAGE = "hop_percentage"
|
ATTR_HOP_PERCENTAGE = "hop_percentage"
|
||||||
|
|
||||||
|
|
||||||
@dataclass(frozen=True)
|
@dataclass(frozen=True, kw_only=True)
|
||||||
class ElectricKiwiAccountRequiredKeysMixin:
|
class ElectricKiwiAccountSensorEntityDescription(SensorEntityDescription):
|
||||||
"""Mixin for required keys."""
|
"""Describes Electric Kiwi sensor entity."""
|
||||||
|
|
||||||
value_func: Callable[[AccountBalance], float | datetime]
|
value_func: Callable[[AccountBalance], float | datetime]
|
||||||
|
|
||||||
|
|
||||||
@dataclass(frozen=True)
|
|
||||||
class ElectricKiwiAccountSensorEntityDescription(
|
|
||||||
SensorEntityDescription, ElectricKiwiAccountRequiredKeysMixin
|
|
||||||
):
|
|
||||||
"""Describes Electric Kiwi sensor entity."""
|
|
||||||
|
|
||||||
|
|
||||||
ACCOUNT_SENSOR_TYPES: tuple[ElectricKiwiAccountSensorEntityDescription, ...] = (
|
ACCOUNT_SENSOR_TYPES: tuple[ElectricKiwiAccountSensorEntityDescription, ...] = (
|
||||||
ElectricKiwiAccountSensorEntityDescription(
|
ElectricKiwiAccountSensorEntityDescription(
|
||||||
key=ATTR_TOTAL_RUNNING_BALANCE,
|
key=ATTR_TOTAL_RUNNING_BALANCE,
|
||||||
@ -85,21 +78,13 @@ ACCOUNT_SENSOR_TYPES: tuple[ElectricKiwiAccountSensorEntityDescription, ...] = (
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
@dataclass(frozen=True)
|
@dataclass(frozen=True, kw_only=True)
|
||||||
class ElectricKiwiHOPRequiredKeysMixin:
|
class ElectricKiwiHOPSensorEntityDescription(SensorEntityDescription):
|
||||||
"""Mixin for required HOP keys."""
|
"""Describes Electric Kiwi HOP sensor entity."""
|
||||||
|
|
||||||
value_func: Callable[[Hop], datetime]
|
value_func: Callable[[Hop], datetime]
|
||||||
|
|
||||||
|
|
||||||
@dataclass(frozen=True)
|
|
||||||
class ElectricKiwiHOPSensorEntityDescription(
|
|
||||||
SensorEntityDescription,
|
|
||||||
ElectricKiwiHOPRequiredKeysMixin,
|
|
||||||
):
|
|
||||||
"""Describes Electric Kiwi HOP sensor entity."""
|
|
||||||
|
|
||||||
|
|
||||||
def _check_and_move_time(hop: Hop, time: str) -> datetime:
|
def _check_and_move_time(hop: Hop, time: str) -> datetime:
|
||||||
"""Return the time a day forward if HOP end_time is in the past."""
|
"""Return the time a day forward if HOP end_time is in the past."""
|
||||||
date_time = datetime.combine(
|
date_time = datetime.combine(
|
||||||
|
Loading…
x
Reference in New Issue
Block a user