Improve drop_connect typing (#106404)
parent
1c96cf33b8
commit
0d2ec6cd5c
|
@ -49,7 +49,7 @@ SALT_LOW = "salt"
|
|||
class DROPBinarySensorEntityDescription(BinarySensorEntityDescription):
|
||||
"""Describes DROP binary sensor entity."""
|
||||
|
||||
value_fn: Callable[[DROPDeviceDataUpdateCoordinator], bool | None]
|
||||
value_fn: Callable[[DROPDeviceDataUpdateCoordinator], int | None]
|
||||
|
||||
|
||||
BINARY_SENSORS: list[DROPBinarySensorEntityDescription] = [
|
||||
|
|
|
@ -15,7 +15,7 @@ from .const import CONF_COMMAND_TOPIC, DOMAIN
|
|||
_LOGGER = logging.getLogger(__name__)
|
||||
|
||||
|
||||
class DROPDeviceDataUpdateCoordinator(DataUpdateCoordinator):
|
||||
class DROPDeviceDataUpdateCoordinator(DataUpdateCoordinator[None]):
|
||||
"""DROP device object."""
|
||||
|
||||
config_entry: ConfigEntry
|
||||
|
|
|
@ -30,7 +30,7 @@ FLOOD_ICON = "mdi:home-flood"
|
|||
class DROPSelectEntityDescription(SelectEntityDescription):
|
||||
"""Describes DROP select entity."""
|
||||
|
||||
value_fn: Callable[[DROPDeviceDataUpdateCoordinator], str | None]
|
||||
value_fn: Callable[[DROPDeviceDataUpdateCoordinator], int | None]
|
||||
set_fn: Callable[[DROPDeviceDataUpdateCoordinator, str], Awaitable[Any]]
|
||||
|
||||
|
||||
|
@ -88,7 +88,8 @@ class DROPSelect(DROPEntity, SelectEntity):
|
|||
@property
|
||||
def current_option(self) -> str | None:
|
||||
"""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:
|
||||
"""Update the current selected option."""
|
||||
|
|
Loading…
Reference in New Issue