mirror of
https://github.com/home-assistant/developers.home-assistant.git
synced 2025-07-16 05:46:30 +00:00
Use kw_only in entity description example (#1979)
This commit is contained in:
parent
130b81efd8
commit
32fbbb42bd
@ -270,20 +270,13 @@ from homeassistant.helpers.typing import StateType
|
|||||||
|
|
||||||
from .const import DOMAIN, LOGGER
|
from .const import DOMAIN, LOGGER
|
||||||
|
|
||||||
@dataclass
|
|
||||||
class ExampleSensorEntityDescriptionMixin:
|
|
||||||
"""Mixin for required keys."""
|
|
||||||
|
|
||||||
value_fn: Callable[[ExampleDevice], StateType]
|
@dataclass(kw_only=True)
|
||||||
|
class ExampleSensorEntityDescription(SensorEntityDescription):
|
||||||
|
|
||||||
@dataclass
|
|
||||||
class ExampleSensorEntityDescription(
|
|
||||||
SensorEntityDescription, ExampleSensorEntityDescriptionMixin
|
|
||||||
):
|
|
||||||
"""Describes Example sensor entity."""
|
"""Describes Example sensor entity."""
|
||||||
|
|
||||||
exists_fn: Callable[[ExampleDevice], bool] = lambda _: True
|
exists_fn: Callable[[ExampleDevice], bool] = lambda _: True
|
||||||
|
value_fn: Callable[[ExampleDevice], StateType]
|
||||||
|
|
||||||
|
|
||||||
SENSORS: tuple[ExampleSensorEntityDescription, ...] = (
|
SENSORS: tuple[ExampleSensorEntityDescription, ...] = (
|
||||||
|
Loading…
x
Reference in New Issue
Block a user