From 230ce1d7400205167e946b1a5d3bc3b7f26b61b8 Mon Sep 17 00:00:00 2001 From: Sebastian Muszynski Date: Tue, 13 Aug 2024 20:17:18 +0200 Subject: [PATCH] Use async_add_executor_job instead of async_add_job --- custom_components/xiaomi_miio_fan/fan.py | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/custom_components/xiaomi_miio_fan/fan.py b/custom_components/xiaomi_miio_fan/fan.py index 4231a7f..14040b6 100644 --- a/custom_components/xiaomi_miio_fan/fan.py +++ b/custom_components/xiaomi_miio_fan/fan.py @@ -614,7 +614,7 @@ def _extract_value_from_attribute(state, attribute): async def _try_command(self, mask_error, func, *args, **kwargs): """Call a miio device command handling error messages.""" try: - result = await self.hass.async_add_job(partial(func, *args, **kwargs)) + result = await self.hass.async_add_executor_job(partial(func, *args, **kwargs)) _LOGGER.debug("Response received from miio device: %s", result) @@ -735,7 +735,7 @@ async def async_update(self): return try: - state = await self.hass.async_add_job(self._device.status) + state = await self.hass.async_add_executor_job(self._device.status) _LOGGER.debug("Got new state: %s", state) self._available = True @@ -956,7 +956,7 @@ async def async_update(self): return try: - state = await self.hass.async_add_job(self._device.status) + state = await self.hass.async_add_executor_job(self._device.status) _LOGGER.debug("Got new state: %s", state) self._available = True @@ -1109,7 +1109,7 @@ async def async_update(self): return try: - state = await self.hass.async_add_job(self._device.status) + state = await self.hass.async_add_executor_job(self._device.status) _LOGGER.debug("Got new state: %s", state) self._available = True @@ -1253,7 +1253,7 @@ async def async_update(self): return try: - state = await self.hass.async_add_job(self._device.status) + state = await self.hass.async_add_executor_job(self._device.status) _LOGGER.debug("Got new state: %s", state) self._available = True @@ -1433,7 +1433,7 @@ async def async_update(self): return try: - state = await self.hass.async_add_job(self._device.status) + state = await self.hass.async_add_executor_job(self._device.status) _LOGGER.debug("Got new state: %s", state) self._available = True @@ -1883,7 +1883,7 @@ async def async_update(self): return try: - state = await self.hass.async_add_job(self._device.status) + state = await self.hass.async_add_executor_job(self._device.status) _LOGGER.debug("Got new state: %s", state) self._available = True @@ -2185,7 +2185,7 @@ async def async_update(self): return try: - state = await self.hass.async_add_job(self._device.status) + state = await self.hass.async_add_executor_job(self._device.status) _LOGGER.debug("Got new state: %s", state) self._available = True