mirror of
https://github.com/home-assistant/core.git
synced 2025-07-23 21:27:38 +00:00
Improve drop_connect typing (#106404)
This commit is contained in:
parent
1c96cf33b8
commit
0d2ec6cd5c
@ -49,7 +49,7 @@ SALT_LOW = "salt"
|
|||||||
class DROPBinarySensorEntityDescription(BinarySensorEntityDescription):
|
class DROPBinarySensorEntityDescription(BinarySensorEntityDescription):
|
||||||
"""Describes DROP binary sensor entity."""
|
"""Describes DROP binary sensor entity."""
|
||||||
|
|
||||||
value_fn: Callable[[DROPDeviceDataUpdateCoordinator], bool | None]
|
value_fn: Callable[[DROPDeviceDataUpdateCoordinator], int | None]
|
||||||
|
|
||||||
|
|
||||||
BINARY_SENSORS: list[DROPBinarySensorEntityDescription] = [
|
BINARY_SENSORS: list[DROPBinarySensorEntityDescription] = [
|
||||||
|
@ -15,7 +15,7 @@ from .const import CONF_COMMAND_TOPIC, DOMAIN
|
|||||||
_LOGGER = logging.getLogger(__name__)
|
_LOGGER = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
class DROPDeviceDataUpdateCoordinator(DataUpdateCoordinator):
|
class DROPDeviceDataUpdateCoordinator(DataUpdateCoordinator[None]):
|
||||||
"""DROP device object."""
|
"""DROP device object."""
|
||||||
|
|
||||||
config_entry: ConfigEntry
|
config_entry: ConfigEntry
|
||||||
|
@ -30,7 +30,7 @@ FLOOD_ICON = "mdi:home-flood"
|
|||||||
class DROPSelectEntityDescription(SelectEntityDescription):
|
class DROPSelectEntityDescription(SelectEntityDescription):
|
||||||
"""Describes DROP select entity."""
|
"""Describes DROP select entity."""
|
||||||
|
|
||||||
value_fn: Callable[[DROPDeviceDataUpdateCoordinator], str | None]
|
value_fn: Callable[[DROPDeviceDataUpdateCoordinator], int | None]
|
||||||
set_fn: Callable[[DROPDeviceDataUpdateCoordinator, str], Awaitable[Any]]
|
set_fn: Callable[[DROPDeviceDataUpdateCoordinator, str], Awaitable[Any]]
|
||||||
|
|
||||||
|
|
||||||
@ -88,7 +88,8 @@ class DROPSelect(DROPEntity, SelectEntity):
|
|||||||
@property
|
@property
|
||||||
def current_option(self) -> str | None:
|
def current_option(self) -> str | None:
|
||||||
"""Return the current selected option."""
|
"""Return the current selected option."""
|
||||||
return self.entity_description.value_fn(self.coordinator)
|
val = self.entity_description.value_fn(self.coordinator)
|
||||||
|
return str(val) if val else None
|
||||||
|
|
||||||
async def async_select_option(self, option: str) -> None:
|
async def async_select_option(self, option: str) -> None:
|
||||||
"""Update the current selected option."""
|
"""Update the current selected option."""
|
||||||
|
Loading…
x
Reference in New Issue
Block a user