diff --git a/homeassistant/components/esphome/fan.py b/homeassistant/components/esphome/fan.py index f2440465e77..41d7e418673 100644 --- a/homeassistant/components/esphome/fan.py +++ b/homeassistant/components/esphome/fan.py @@ -67,8 +67,11 @@ class EsphomeFan(EsphomeEntity[FanInfo, FanState], FanEntity): api_version = self._api_version return api_version.major == 1 and api_version.minor > 3 - async def async_set_percentage(self, percentage: int | None) -> None: + async def async_set_percentage(self, percentage: int) -> None: """Set the speed percentage of the fan.""" + await self._async_set_percentage(percentage) + + async def _async_set_percentage(self, percentage: int | None) -> None: if percentage == 0: await self.async_turn_off() return @@ -95,7 +98,7 @@ class EsphomeFan(EsphomeEntity[FanInfo, FanState], FanEntity): **kwargs: Any, ) -> None: """Turn on the fan.""" - await self.async_set_percentage(percentage) + await self._async_set_percentage(percentage) async def async_turn_off(self, **kwargs: Any) -> None: """Turn off the fan.""" diff --git a/homeassistant/components/smartthings/fan.py b/homeassistant/components/smartthings/fan.py index d3f3affa358..36d47533bbb 100644 --- a/homeassistant/components/smartthings/fan.py +++ b/homeassistant/components/smartthings/fan.py @@ -52,8 +52,11 @@ class SmartThingsFan(SmartThingsEntity, FanEntity): _attr_supported_features = FanEntityFeature.SET_SPEED - async def async_set_percentage(self, percentage: int | None) -> None: + async def async_set_percentage(self, percentage: int) -> None: """Set the speed percentage of the fan.""" + await self._async_set_percentage(percentage) + + async def _async_set_percentage(self, percentage: int | None) -> None: if percentage is None: await self._device.switch_on(set_status=True) elif percentage == 0: @@ -72,7 +75,7 @@ class SmartThingsFan(SmartThingsEntity, FanEntity): **kwargs, ) -> None: """Turn the fan on.""" - await self.async_set_percentage(percentage) + await self._async_set_percentage(percentage) async def async_turn_off(self, **kwargs) -> None: """Turn the fan off.""" diff --git a/homeassistant/components/wemo/fan.py b/homeassistant/components/wemo/fan.py index d24827bee96..81065cf8108 100644 --- a/homeassistant/components/wemo/fan.py +++ b/homeassistant/components/wemo/fan.py @@ -136,15 +136,18 @@ class WemoHumidifier(WemoBinaryStateEntity, FanEntity): **kwargs: Any, ) -> None: """Turn the fan on.""" - self.set_percentage(percentage) + self._set_percentage(percentage) def turn_off(self, **kwargs: Any) -> None: """Turn the switch off.""" with self._wemo_call_wrapper("turn off"): self.wemo.set_state(FanMode.Off) - def set_percentage(self, percentage: int | None) -> None: + def set_percentage(self, percentage: int) -> None: """Set the fan_mode of the Humidifier.""" + self._set_percentage(percentage) + + def _set_percentage(self, percentage: int | None) -> None: if percentage is None: named_speed = self._last_fan_on_mode elif percentage == 0: