From 07bda0973e37fc7dd051f5f6e689d425f2aad6b2 Mon Sep 17 00:00:00 2001 From: ondras12345 Date: Tue, 6 Jul 2021 16:03:54 +0200 Subject: [PATCH] Fix update of Xiaomi Miio vacuum taking too long (#52539) Home assistant log would get spammed with messages like Update of vacuum.vacuum_name is taking over 10 seconds every 20 seconds if the vacuum was not reachable through the network. See #52353 --- homeassistant/components/xiaomi_miio/vacuum.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/homeassistant/components/xiaomi_miio/vacuum.py b/homeassistant/components/xiaomi_miio/vacuum.py index d0bfc148594..cdd53e784b3 100644 --- a/homeassistant/components/xiaomi_miio/vacuum.py +++ b/homeassistant/components/xiaomi_miio/vacuum.py @@ -507,7 +507,11 @@ class MiroboVacuum(XiaomiMiioEntity, StateVacuumEntity): # Fetch timers separately, see #38285 try: - self._timers = self._device.timer() + # Do not try this if the first fetch timed out. + # Two timeouts take longer than 10 seconds and trigger a warning. + # See #52353 + if self._available: + self._timers = self._device.timer() except DeviceException as exc: _LOGGER.debug( "Unable to fetch timers, this may happen on some devices: %s", exc