diff --git a/homeassistant/components/roborock/vacuum.py b/homeassistant/components/roborock/vacuum.py index 4bf3c49a726..afdb3b19cb4 100644 --- a/homeassistant/components/roborock/vacuum.py +++ b/homeassistant/components/roborock/vacuum.py @@ -148,10 +148,14 @@ class RoborockVacuum(RoborockCoordinatedEntityV1, StateVacuumEntity): async def async_start(self) -> None: """Start the vacuum.""" - if self._device_status.in_cleaning == 2: + if self._device_status.in_returning == 1: + await self.send(RoborockCommand.APP_CHARGE) + elif self._device_status.in_cleaning == 2: await self.send(RoborockCommand.RESUME_ZONED_CLEAN) elif self._device_status.in_cleaning == 3: await self.send(RoborockCommand.RESUME_SEGMENT_CLEAN) + elif self._device_status.in_cleaning == 4: + await self.send(RoborockCommand.APP_RESUME_BUILD_MAP) else: await self.send(RoborockCommand.APP_START) diff --git a/tests/components/roborock/test_vacuum.py b/tests/components/roborock/test_vacuum.py index 5d6e7a599bd..aa7da07d499 100644 --- a/tests/components/roborock/test_vacuum.py +++ b/tests/components/roborock/test_vacuum.py @@ -142,12 +142,14 @@ async def test_cloud_command( @pytest.mark.parametrize( - ("in_cleaning_int", "expected_command"), + ("in_cleaning_int", "in_returning_int", "expected_command"), [ - (0, RoborockCommand.APP_START), - (1, RoborockCommand.APP_START), - (2, RoborockCommand.RESUME_ZONED_CLEAN), - (3, RoborockCommand.RESUME_SEGMENT_CLEAN), + (0, 1, RoborockCommand.APP_CHARGE), + (0, 0, RoborockCommand.APP_START), + (1, 0, RoborockCommand.APP_START), + (2, 0, RoborockCommand.RESUME_ZONED_CLEAN), + (3, 0, RoborockCommand.RESUME_SEGMENT_CLEAN), + (4, 0, RoborockCommand.APP_RESUME_BUILD_MAP), ], ) async def test_resume_cleaning( @@ -155,11 +157,13 @@ async def test_resume_cleaning( bypass_api_fixture, mock_roborock_entry: MockConfigEntry, in_cleaning_int: int, + in_returning_int: int, expected_command: RoborockCommand, ) -> None: """Test resuming clean on start button when a clean is paused.""" prop = copy.deepcopy(PROP) prop.status.in_cleaning = in_cleaning_int + prop.status.in_returning = in_returning_int with patch( "homeassistant.components.roborock.coordinator.RoborockLocalClientV1.get_prop", return_value=prop,