From 225059f8eaf337d24ff5c2c1e81d6034990450f9 Mon Sep 17 00:00:00 2001 From: Xiaonan Shen Date: Thu, 30 Apr 2020 21:13:45 -0700 Subject: [PATCH] Fix roomba not reporting error (#34996) --- homeassistant/components/roomba/irobot_base.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/homeassistant/components/roomba/irobot_base.py b/homeassistant/components/roomba/irobot_base.py index cb422616e5a..86e9b0da6b5 100644 --- a/homeassistant/components/roomba/irobot_base.py +++ b/homeassistant/components/roomba/irobot_base.py @@ -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: