Xiaomi Vacuum: keep error state active after erroring (#16562)

* Check for got_error to keep consistent error reporting

* reword a comment
This commit is contained in:
Teemu R 2018-10-10 12:16:32 +02:00 committed by Paulus Schoutsen
parent 670c75e844
commit 78c38749ab
1 changed files with 4 additions and 0 deletions

View File

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