fix DeviceException handling when updating xiaomi vacuum (#8954)
* Fix DeviceException handling when updating entity * add DeviceException error handling to generic requestpull/8956/head
parent
73d6227021
commit
c92e5c147a
|
@ -219,12 +219,12 @@ class MiroboVacuum(VacuumDevice):
|
|||
@asyncio.coroutine
|
||||
def _try_command(self, mask_error, func, *args, **kwargs):
|
||||
"""Call a vacuum command handling error messages."""
|
||||
from mirobo import VacuumException
|
||||
from mirobo import DeviceException, VacuumException
|
||||
try:
|
||||
yield from self.hass.async_add_job(partial(func, *args, **kwargs))
|
||||
return True
|
||||
except VacuumException as ex:
|
||||
_LOGGER.error(mask_error, ex)
|
||||
except (DeviceException, VacuumException) as exc:
|
||||
_LOGGER.error(mask_error, exc)
|
||||
return False
|
||||
|
||||
@asyncio.coroutine
|
||||
|
@ -341,7 +341,7 @@ class MiroboVacuum(VacuumDevice):
|
|||
@asyncio.coroutine
|
||||
def async_update(self):
|
||||
"""Fetch state from the device."""
|
||||
from mirobo import VacuumException
|
||||
from mirobo import DeviceException
|
||||
try:
|
||||
state = yield from self.hass.async_add_job(self._vacuum.status)
|
||||
_LOGGER.debug("Got new state from the vacuum: %s", state.data)
|
||||
|
@ -351,6 +351,6 @@ class MiroboVacuum(VacuumDevice):
|
|||
except OSError as exc:
|
||||
_LOGGER.error("Got OSError while fetching the state: %s", exc)
|
||||
# self._available = False
|
||||
except VacuumException as exc:
|
||||
except DeviceException as exc:
|
||||
_LOGGER.warning("Got exception while fetching the state: %s", exc)
|
||||
# self._available = False
|
||||
|
|
Loading…
Reference in New Issue