Improve select type hints ()

pull/76460/head
epenet 2022-08-08 15:22:22 +02:00 committed by GitHub
parent 3026a70f96
commit fe9c101817
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 5 additions and 5 deletions
homeassistant/components
advantage_air
xiaomi_miio
yamaha_musiccast

View File

@ -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]}}}

View File

@ -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()

View File

@ -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)