mirror of
https://github.com/home-assistant/core.git
synced 2025-07-19 03:07:37 +00:00
Remove WLED entity descriptions required fields mixins (#103996)
This commit is contained in:
parent
aecfa67265
commit
e9c6da9803
@ -39,18 +39,13 @@ async def async_setup_entry(
|
|||||||
update_segments()
|
update_segments()
|
||||||
|
|
||||||
|
|
||||||
@dataclass
|
@dataclass(kw_only=True)
|
||||||
class WLEDNumberDescriptionMixin:
|
class WLEDNumberEntityDescription(NumberEntityDescription):
|
||||||
"""Mixin for WLED number."""
|
"""Class describing WLED number entities."""
|
||||||
|
|
||||||
value_fn: Callable[[Segment], float | None]
|
value_fn: Callable[[Segment], float | None]
|
||||||
|
|
||||||
|
|
||||||
@dataclass
|
|
||||||
class WLEDNumberEntityDescription(NumberEntityDescription, WLEDNumberDescriptionMixin):
|
|
||||||
"""Class describing WLED number entities."""
|
|
||||||
|
|
||||||
|
|
||||||
NUMBERS = [
|
NUMBERS = [
|
||||||
WLEDNumberEntityDescription(
|
WLEDNumberEntityDescription(
|
||||||
key=ATTR_SPEED,
|
key=ATTR_SPEED,
|
||||||
|
@ -31,20 +31,12 @@ from .coordinator import WLEDDataUpdateCoordinator
|
|||||||
from .models import WLEDEntity
|
from .models import WLEDEntity
|
||||||
|
|
||||||
|
|
||||||
@dataclass
|
@dataclass(kw_only=True)
|
||||||
class WLEDSensorEntityDescriptionMixin:
|
class WLEDSensorEntityDescription(SensorEntityDescription):
|
||||||
"""Mixin for required keys."""
|
|
||||||
|
|
||||||
value_fn: Callable[[WLEDDevice], datetime | StateType]
|
|
||||||
|
|
||||||
|
|
||||||
@dataclass
|
|
||||||
class WLEDSensorEntityDescription(
|
|
||||||
SensorEntityDescription, WLEDSensorEntityDescriptionMixin
|
|
||||||
):
|
|
||||||
"""Describes WLED sensor entity."""
|
"""Describes WLED sensor entity."""
|
||||||
|
|
||||||
exists_fn: Callable[[WLEDDevice], bool] = lambda _: True
|
exists_fn: Callable[[WLEDDevice], bool] = lambda _: True
|
||||||
|
value_fn: Callable[[WLEDDevice], datetime | StateType]
|
||||||
|
|
||||||
|
|
||||||
SENSORS: tuple[WLEDSensorEntityDescription, ...] = (
|
SENSORS: tuple[WLEDSensorEntityDescription, ...] = (
|
||||||
|
Loading…
x
Reference in New Issue
Block a user