Improve select type hints (#76446)
parent
3026a70f96
commit
fe9c101817
|
@ -46,11 +46,11 @@ class AdvantageAirMyZone(AdvantageAirAcEntity, SelectEntity):
|
|||
self._attr_options.append(zone["name"])
|
||||
|
||||
@property
|
||||
def current_option(self):
|
||||
def current_option(self) -> str:
|
||||
"""Return the current MyZone."""
|
||||
return self._number_to_name[self._ac["myZone"]]
|
||||
|
||||
async def async_select_option(self, option):
|
||||
async def async_select_option(self, option: str) -> None:
|
||||
"""Set the MyZone."""
|
||||
await self.async_change(
|
||||
{self.ac_key: {"info": {"myZone": self._name_to_number[option]}}}
|
||||
|
|
|
@ -164,7 +164,7 @@ class XiaomiAirHumidifierSelector(XiaomiSelector):
|
|||
self.async_write_ha_state()
|
||||
|
||||
@property
|
||||
def current_option(self):
|
||||
def current_option(self) -> str:
|
||||
"""Return the current option."""
|
||||
return self.led_brightness.lower()
|
||||
|
||||
|
|
|
@ -52,11 +52,11 @@ class SelectableCapapility(MusicCastCapabilityEntity, SelectEntity):
|
|||
return DEVICE_CLASS_MAPPING.get(self.capability.id)
|
||||
|
||||
@property
|
||||
def options(self):
|
||||
def options(self) -> list[str]:
|
||||
"""Return the list possible options."""
|
||||
return list(self.capability.options.values())
|
||||
|
||||
@property
|
||||
def current_option(self):
|
||||
def current_option(self) -> str | None:
|
||||
"""Return the currently selected option."""
|
||||
return self.capability.options.get(self.capability.current)
|
||||
|
|
Loading…
Reference in New Issue