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
This commit is contained in:
ondras12345 2021-07-06 16:03:54 +02:00 committed by GitHub
parent 046eb1690a
commit 07bda0973e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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