mirror of
https://github.com/home-assistant/core.git
synced 2025-07-25 22:27:07 +00:00
Add xiaomi vacuum -9999 fix back (#57473)
This commit is contained in:
parent
cadbf7f6a9
commit
30154763f8
@ -235,12 +235,23 @@ def _async_update_data_vacuum(hass, device: Vacuum):
|
|||||||
|
|
||||||
async def update_async():
|
async def update_async():
|
||||||
"""Fetch data from the device using async_add_executor_job."""
|
"""Fetch data from the device using async_add_executor_job."""
|
||||||
try:
|
|
||||||
|
async def execute_update():
|
||||||
async with async_timeout.timeout(10):
|
async with async_timeout.timeout(10):
|
||||||
state = await hass.async_add_executor_job(update)
|
state = await hass.async_add_executor_job(update)
|
||||||
_LOGGER.debug("Got new vacuum state: %s", state)
|
_LOGGER.debug("Got new vacuum state: %s", state)
|
||||||
return state
|
return state
|
||||||
|
|
||||||
|
try:
|
||||||
|
return await execute_update()
|
||||||
|
except DeviceException as ex:
|
||||||
|
if getattr(ex, "code", None) != -9999:
|
||||||
|
raise UpdateFailed(ex) from ex
|
||||||
|
_LOGGER.info("Got exception while fetching the state, trying again: %s", ex)
|
||||||
|
|
||||||
|
# Try to fetch the data a second time after error code -9999
|
||||||
|
try:
|
||||||
|
return await execute_update()
|
||||||
except DeviceException as ex:
|
except DeviceException as ex:
|
||||||
raise UpdateFailed(ex) from ex
|
raise UpdateFailed(ex) from ex
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user