Fix roomba not reporting error ()

pull/35000/head
Xiaonan Shen 2020-04-30 21:13:45 -07:00 committed by GitHub
parent bb08959131
commit 225059f8ea
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 7 additions and 1 deletions
homeassistant/components/roomba

View File

@ -3,6 +3,7 @@ import asyncio
import logging
from homeassistant.components.vacuum import (
ATTR_STATUS,
STATE_CLEANING,
STATE_DOCKED,
STATE_ERROR,
@ -16,6 +17,7 @@ from homeassistant.components.vacuum import (
SUPPORT_SEND_COMMAND,
SUPPORT_START,
SUPPORT_STATE,
SUPPORT_STATUS,
SUPPORT_STOP,
StateVacuumEntity,
)
@ -40,6 +42,7 @@ SUPPORT_IROBOT = (
| SUPPORT_SEND_COMMAND
| SUPPORT_START
| SUPPORT_STATE
| SUPPORT_STATUS
| SUPPORT_STOP
| SUPPORT_LOCATE
)
@ -143,7 +146,7 @@ class IRobotVacuum(IRobotEntity, StateVacuumEntity):
state = STATE_MAP[phase]
except KeyError:
return STATE_ERROR
if cycle != "none" and state != STATE_CLEANING and state != STATE_RETURNING:
if cycle != "none" and (state == STATE_IDLE or state == STATE_DOCKED):
state = STATE_PAUSED
return state
@ -173,6 +176,9 @@ class IRobotVacuum(IRobotEntity, StateVacuumEntity):
# Set properties that are to appear in the GUI
state_attrs = {ATTR_SOFTWARE_VERSION: software_version}
# Set legacy status to avoid break changes
state_attrs[ATTR_STATUS] = self.vacuum.current_state
# Only add cleaning time and cleaned area attrs when the vacuum is
# currently on
if self.state == STATE_CLEANING: