Skip to content

Commit

Permalink
Use async_add_executor_job instead of async_add_job
Browse files Browse the repository at this point in the history
  • Loading branch information
syssi committed Aug 13, 2024
1 parent e653827 commit 230ce1d
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions custom_components/xiaomi_miio_fan/fan.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 230ce1d

Please sign in to comment.