diff --git a/homeassistant/components/fan/__init__.py b/homeassistant/components/fan/__init__.py index a4518b15f99..789299bd1ac 100644 --- a/homeassistant/components/fan/__init__.py +++ b/homeassistant/components/fan/__init__.py @@ -117,7 +117,7 @@ class FanEntity(ToggleEntity): if speed == SPEED_OFF: await self.async_turn_off() else: - await self.hass.async_add_job(self.set_speed, speed) + await self.hass.async_add_executor_job(self.set_speed, speed) def set_direction(self, direction: str) -> None: """Set the direction of the fan.""" @@ -125,7 +125,7 @@ class FanEntity(ToggleEntity): async def async_set_direction(self, direction: str): """Set the direction of the fan.""" - await self.hass.async_add_job(self.set_direction, direction) + await self.hass.async_add_executor_job(self.set_direction, direction) # pylint: disable=arguments-differ def turn_on(self, speed: Optional[str] = None, **kwargs) -> None: @@ -138,14 +138,16 @@ class FanEntity(ToggleEntity): if speed == SPEED_OFF: await self.async_turn_off() else: - await self.hass.async_add_job(ft.partial(self.turn_on, speed, **kwargs)) + await self.hass.async_add_executor_job( + ft.partial(self.turn_on, speed, **kwargs) + ) def oscillate(self, oscillating: bool) -> None: """Oscillate the fan.""" async def async_oscillate(self, oscillating: bool): """Oscillate the fan.""" - await self.hass.async_add_job(self.oscillate, oscillating) + await self.hass.async_add_executor_job(self.oscillate, oscillating) @property def is_on(self):