From 46b2c776dba5bd48ea2b1d0db6f6c298a7d084bb Mon Sep 17 00:00:00 2001 From: Teemu R Date: Tue, 6 Oct 2020 15:26:59 +0200 Subject: [PATCH] Fetch timers separately for xiaomi vacuums (#41330) --- homeassistant/components/xiaomi_miio/vacuum.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/homeassistant/components/xiaomi_miio/vacuum.py b/homeassistant/components/xiaomi_miio/vacuum.py index 3e414016fc5..53fc458c50d 100644 --- a/homeassistant/components/xiaomi_miio/vacuum.py +++ b/homeassistant/components/xiaomi_miio/vacuum.py @@ -484,14 +484,21 @@ class MiroboVacuum(StateVacuumEntity): self.last_clean = self._vacuum.last_clean_details() self.dnd_state = self._vacuum.dnd_status() - self._timers = self._vacuum.timer() - self._available = True except OSError as exc: _LOGGER.error("Got OSError while fetching the state: %s", exc) except DeviceException as exc: _LOGGER.warning("Got exception while fetching the state: %s", exc) + # Fetch timers separately, see #38285 + try: + self._timers = self._vacuum.timer() + except DeviceException as exc: + _LOGGER.debug( + "Unable to fetch timers, this may happen on some devices: %s", exc + ) + self._timers = [] + async def async_clean_zone(self, zone, repeats=1): """Clean selected area for the number of repeats indicated.""" for _zone in zone: