mirror of
https://github.com/home-assistant/core.git
synced 2025-07-13 08:17:08 +00:00
Remove entity description mixin in Vodafone Station (#112967)
This commit is contained in:
parent
afa69cca38
commit
5d231ed61f
@ -21,21 +21,14 @@ from .const import _LOGGER, DOMAIN
|
|||||||
from .coordinator import VodafoneStationRouter
|
from .coordinator import VodafoneStationRouter
|
||||||
|
|
||||||
|
|
||||||
@dataclass(frozen=True)
|
@dataclass(frozen=True, kw_only=True)
|
||||||
class VodafoneStationBaseEntityDescriptionMixin:
|
class VodafoneStationEntityDescription(ButtonEntityDescription):
|
||||||
"""Mixin to describe a Button entity."""
|
"""Vodafone Station entity description."""
|
||||||
|
|
||||||
press_action: Callable[[VodafoneStationRouter], Any]
|
press_action: Callable[[VodafoneStationRouter], Any]
|
||||||
is_suitable: Callable[[dict], bool]
|
is_suitable: Callable[[dict], bool]
|
||||||
|
|
||||||
|
|
||||||
@dataclass(frozen=True)
|
|
||||||
class VodafoneStationEntityDescription(
|
|
||||||
ButtonEntityDescription, VodafoneStationBaseEntityDescriptionMixin
|
|
||||||
):
|
|
||||||
"""Vodafone Station entity description."""
|
|
||||||
|
|
||||||
|
|
||||||
BUTTON_TYPES: Final = (
|
BUTTON_TYPES: Final = (
|
||||||
VodafoneStationEntityDescription(
|
VodafoneStationEntityDescription(
|
||||||
key="reboot",
|
key="reboot",
|
||||||
|
@ -25,9 +25,9 @@ from .coordinator import VodafoneStationRouter
|
|||||||
NOT_AVAILABLE: list = ["", "N/A", "0.0.0.0"]
|
NOT_AVAILABLE: list = ["", "N/A", "0.0.0.0"]
|
||||||
|
|
||||||
|
|
||||||
@dataclass(frozen=True)
|
@dataclass(frozen=True, kw_only=True)
|
||||||
class VodafoneStationBaseEntityDescription:
|
class VodafoneStationEntityDescription(SensorEntityDescription):
|
||||||
"""Vodafone Station entity base description."""
|
"""Vodafone Station entity description."""
|
||||||
|
|
||||||
value: Callable[[Any, Any], Any] = (
|
value: Callable[[Any, Any], Any] = (
|
||||||
lambda coordinator, key: coordinator.data.sensors[key]
|
lambda coordinator, key: coordinator.data.sensors[key]
|
||||||
@ -35,13 +35,6 @@ class VodafoneStationBaseEntityDescription:
|
|||||||
is_suitable: Callable[[dict], bool] = lambda val: True
|
is_suitable: Callable[[dict], bool] = lambda val: True
|
||||||
|
|
||||||
|
|
||||||
@dataclass(frozen=True, kw_only=True)
|
|
||||||
class VodafoneStationEntityDescription(
|
|
||||||
VodafoneStationBaseEntityDescription, SensorEntityDescription
|
|
||||||
):
|
|
||||||
"""Vodafone Station entity description."""
|
|
||||||
|
|
||||||
|
|
||||||
def _calculate_uptime(coordinator: VodafoneStationRouter, key: str) -> datetime:
|
def _calculate_uptime(coordinator: VodafoneStationRouter, key: str) -> datetime:
|
||||||
"""Calculate device uptime."""
|
"""Calculate device uptime."""
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user