Add missing ToggleEntity type hints in fans (#73887)
parent
a3ce80baed
commit
48bd7cf5e1
|
@ -208,7 +208,7 @@ class DemoPercentageFan(BaseDemoFan, FanEntity):
|
||||||
|
|
||||||
self.set_percentage(percentage)
|
self.set_percentage(percentage)
|
||||||
|
|
||||||
def turn_off(self, **kwargs) -> None:
|
def turn_off(self, **kwargs: Any) -> None:
|
||||||
"""Turn off the entity."""
|
"""Turn off the entity."""
|
||||||
self.set_percentage(0)
|
self.set_percentage(0)
|
||||||
|
|
||||||
|
@ -278,7 +278,7 @@ class AsyncDemoPercentageFan(BaseDemoFan, FanEntity):
|
||||||
|
|
||||||
await self.async_set_percentage(percentage)
|
await self.async_set_percentage(percentage)
|
||||||
|
|
||||||
async def async_turn_off(self, **kwargs) -> None:
|
async def async_turn_off(self, **kwargs: Any) -> None:
|
||||||
"""Turn off the entity."""
|
"""Turn off the entity."""
|
||||||
await self.async_oscillate(False)
|
await self.async_oscillate(False)
|
||||||
await self.async_set_percentage(0)
|
await self.async_set_percentage(0)
|
||||||
|
|
|
@ -135,7 +135,7 @@ class Fan(CoordinatorEntity[Coordinator], FanEntity):
|
||||||
else:
|
else:
|
||||||
raise UnsupportedPreset(f"The preset {preset_mode} is unsupported")
|
raise UnsupportedPreset(f"The preset {preset_mode} is unsupported")
|
||||||
|
|
||||||
async def async_turn_off(self, **kwargs) -> None:
|
async def async_turn_off(self, **kwargs: Any) -> None:
|
||||||
"""Turn the entity off."""
|
"""Turn the entity off."""
|
||||||
await self._device.send_command(COMMAND_STOP_FAN)
|
await self._device.send_command(COMMAND_STOP_FAN)
|
||||||
self.coordinator.async_set_updated_data(self._device.state)
|
self.coordinator.async_set_updated_data(self._device.state)
|
||||||
|
|
|
@ -70,7 +70,7 @@ class InsteonFanEntity(InsteonEntity, FanEntity):
|
||||||
"""Turn on the fan."""
|
"""Turn on the fan."""
|
||||||
await self.async_set_percentage(percentage or 67)
|
await self.async_set_percentage(percentage or 67)
|
||||||
|
|
||||||
async def async_turn_off(self, **kwargs) -> None:
|
async def async_turn_off(self, **kwargs: Any) -> None:
|
||||||
"""Turn off the fan."""
|
"""Turn off the fan."""
|
||||||
await self._insteon_device.async_fan_off()
|
await self._insteon_device.async_fan_off()
|
||||||
|
|
||||||
|
|
|
@ -70,7 +70,7 @@ class LutronCasetaFan(LutronCasetaDeviceUpdatableEntity, FanEntity):
|
||||||
|
|
||||||
await self.async_set_percentage(percentage)
|
await self.async_set_percentage(percentage)
|
||||||
|
|
||||||
async def async_turn_off(self, **kwargs):
|
async def async_turn_off(self, **kwargs: Any) -> None:
|
||||||
"""Turn the fan off."""
|
"""Turn the fan off."""
|
||||||
await self.async_set_percentage(0)
|
await self.async_set_percentage(0)
|
||||||
|
|
||||||
|
|
|
@ -568,7 +568,7 @@ class MqttFan(MqttEntity, FanEntity):
|
||||||
self._state = True
|
self._state = True
|
||||||
self.async_write_ha_state()
|
self.async_write_ha_state()
|
||||||
|
|
||||||
async def async_turn_off(self, **kwargs) -> None:
|
async def async_turn_off(self, **kwargs: Any) -> None:
|
||||||
"""Turn off the entity.
|
"""Turn off the entity.
|
||||||
|
|
||||||
This method is a coroutine.
|
This method is a coroutine.
|
||||||
|
|
|
@ -78,7 +78,7 @@ class SmartThingsFan(SmartThingsEntity, FanEntity):
|
||||||
"""Turn the fan on."""
|
"""Turn the fan on."""
|
||||||
await self._async_set_percentage(percentage)
|
await self._async_set_percentage(percentage)
|
||||||
|
|
||||||
async def async_turn_off(self, **kwargs) -> None:
|
async def async_turn_off(self, **kwargs: Any) -> None:
|
||||||
"""Turn the fan off."""
|
"""Turn the fan off."""
|
||||||
await self._device.switch_off(set_status=True)
|
await self._device.switch_off(set_status=True)
|
||||||
# State is set optimistically in the command above, therefore update
|
# State is set optimistically in the command above, therefore update
|
||||||
|
|
|
@ -107,7 +107,7 @@ class SmartyFan(FanEntity):
|
||||||
_LOGGER.debug("Turning on fan. percentage is %s", percentage)
|
_LOGGER.debug("Turning on fan. percentage is %s", percentage)
|
||||||
self.set_percentage(percentage or DEFAULT_ON_PERCENTAGE)
|
self.set_percentage(percentage or DEFAULT_ON_PERCENTAGE)
|
||||||
|
|
||||||
def turn_off(self, **kwargs):
|
def turn_off(self, **kwargs: Any) -> None:
|
||||||
"""Turn off the fan."""
|
"""Turn off the fan."""
|
||||||
_LOGGER.debug("Turning off fan")
|
_LOGGER.debug("Turning off fan")
|
||||||
if not self._smarty.turn_off():
|
if not self._smarty.turn_off():
|
||||||
|
|
|
@ -130,6 +130,6 @@ class WiLightFan(WiLightDevice, FanEntity):
|
||||||
wl_direction = WL_DIRECTION_FORWARD
|
wl_direction = WL_DIRECTION_FORWARD
|
||||||
await self._client.set_fan_direction(self._index, wl_direction)
|
await self._client.set_fan_direction(self._index, wl_direction)
|
||||||
|
|
||||||
async def async_turn_off(self, **kwargs):
|
async def async_turn_off(self, **kwargs: Any) -> None:
|
||||||
"""Turn the fan off."""
|
"""Turn the fan off."""
|
||||||
await self._client.set_fan_direction(self._index, WL_DIRECTION_OFF)
|
await self._client.set_fan_direction(self._index, WL_DIRECTION_OFF)
|
||||||
|
|
|
@ -334,7 +334,7 @@ class XiaomiGenericDevice(XiaomiCoordinatedMiioEntity, FanEntity):
|
||||||
self._state = True
|
self._state = True
|
||||||
self.async_write_ha_state()
|
self.async_write_ha_state()
|
||||||
|
|
||||||
async def async_turn_off(self, **kwargs) -> None:
|
async def async_turn_off(self, **kwargs: Any) -> None:
|
||||||
"""Turn the device off."""
|
"""Turn the device off."""
|
||||||
result = await self._try_command(
|
result = await self._try_command(
|
||||||
"Turning the miio device off failed.", self._device.off
|
"Turning the miio device off failed.", self._device.off
|
||||||
|
|
|
@ -99,7 +99,7 @@ class BaseFan(FanEntity):
|
||||||
percentage = DEFAULT_ON_PERCENTAGE
|
percentage = DEFAULT_ON_PERCENTAGE
|
||||||
await self.async_set_percentage(percentage)
|
await self.async_set_percentage(percentage)
|
||||||
|
|
||||||
async def async_turn_off(self, **kwargs) -> None:
|
async def async_turn_off(self, **kwargs: Any) -> None:
|
||||||
"""Turn the entity off."""
|
"""Turn the entity off."""
|
||||||
await self.async_set_percentage(0)
|
await self.async_set_percentage(0)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue