From 78c38749ab309227da6491310e0963710c730175 Mon Sep 17 00:00:00 2001 From: Teemu R Date: Wed, 10 Oct 2018 12:16:32 +0200 Subject: [PATCH] Xiaomi Vacuum: keep error state active after erroring (#16562) * Check for got_error to keep consistent error reporting * reword a comment --- homeassistant/components/vacuum/xiaomi_miio.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/homeassistant/components/vacuum/xiaomi_miio.py b/homeassistant/components/vacuum/xiaomi_miio.py index abfbb342418f..97a285f90f50 100644 --- a/homeassistant/components/vacuum/xiaomi_miio.py +++ b/homeassistant/components/vacuum/xiaomi_miio.py @@ -179,6 +179,10 @@ class MiroboVacuum(StateVacuumDevice): def state(self): """Return the status of the vacuum cleaner.""" if self.vacuum_state is not None: + # The vacuum reverts back to an idle state after erroring out. + # We want to keep returning an error until it has been cleared. + if self.vacuum_state.got_error: + return STATE_ERROR try: return STATE_CODE_TO_STATE[int(self.vacuum_state.state_code)] except KeyError: