mirror of
https://github.com/home-assistant/core.git
synced 2025-07-23 21:27:38 +00:00
Improve select type hints (#76446)
This commit is contained in:
parent
3026a70f96
commit
fe9c101817
@ -46,11 +46,11 @@ class AdvantageAirMyZone(AdvantageAirAcEntity, SelectEntity):
|
|||||||
self._attr_options.append(zone["name"])
|
self._attr_options.append(zone["name"])
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def current_option(self):
|
def current_option(self) -> str:
|
||||||
"""Return the current MyZone."""
|
"""Return the current MyZone."""
|
||||||
return self._number_to_name[self._ac["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."""
|
"""Set the MyZone."""
|
||||||
await self.async_change(
|
await self.async_change(
|
||||||
{self.ac_key: {"info": {"myZone": self._name_to_number[option]}}}
|
{self.ac_key: {"info": {"myZone": self._name_to_number[option]}}}
|
||||||
|
@ -164,7 +164,7 @@ class XiaomiAirHumidifierSelector(XiaomiSelector):
|
|||||||
self.async_write_ha_state()
|
self.async_write_ha_state()
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def current_option(self):
|
def current_option(self) -> str:
|
||||||
"""Return the current option."""
|
"""Return the current option."""
|
||||||
return self.led_brightness.lower()
|
return self.led_brightness.lower()
|
||||||
|
|
||||||
|
@ -52,11 +52,11 @@ class SelectableCapapility(MusicCastCapabilityEntity, SelectEntity):
|
|||||||
return DEVICE_CLASS_MAPPING.get(self.capability.id)
|
return DEVICE_CLASS_MAPPING.get(self.capability.id)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def options(self):
|
def options(self) -> list[str]:
|
||||||
"""Return the list possible options."""
|
"""Return the list possible options."""
|
||||||
return list(self.capability.options.values())
|
return list(self.capability.options.values())
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def current_option(self):
|
def current_option(self) -> str | None:
|
||||||
"""Return the currently selected option."""
|
"""Return the currently selected option."""
|
||||||
return self.capability.options.get(self.capability.current)
|
return self.capability.options.get(self.capability.current)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user