From c92e5c147a360175b964121525d20bc03cf4ef18 Mon Sep 17 00:00:00 2001 From: Eugenio Panadero Date: Sun, 13 Aug 2017 15:02:48 +0200 Subject: [PATCH] fix DeviceException handling when updating xiaomi vacuum (#8954) * Fix DeviceException handling when updating entity * add DeviceException error handling to generic request --- homeassistant/components/vacuum/xiaomi.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/homeassistant/components/vacuum/xiaomi.py b/homeassistant/components/vacuum/xiaomi.py index c5fb0d3c003..5e5081a2aa8 100644 --- a/homeassistant/components/vacuum/xiaomi.py +++ b/homeassistant/components/vacuum/xiaomi.py @@ -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