mirror of
https://github.com/home-assistant/developers.home-assistant.git
synced 2025-07-15 21:36:31 +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
|
||||
|
||||
@dataclass
|
||||
class ExampleSensorEntityDescriptionMixin:
|
||||
"""Mixin for required keys."""
|
||||
|
||||
value_fn: Callable[[ExampleDevice], StateType]
|
||||
|
||||
|
||||
@dataclass
|
||||
class ExampleSensorEntityDescription(
|
||||
SensorEntityDescription, ExampleSensorEntityDescriptionMixin
|
||||
):
|
||||
@dataclass(kw_only=True)
|
||||
class ExampleSensorEntityDescription(SensorEntityDescription):
|
||||
"""Describes Example sensor entity."""
|
||||
|
||||
exists_fn: Callable[[ExampleDevice], bool] = lambda _: True
|
||||
value_fn: Callable[[ExampleDevice], StateType]
|
||||
|
||||
|
||||
SENSORS: tuple[ExampleSensorEntityDescription, ...] = (
|
||||
|
Loading…
x
Reference in New Issue
Block a user