diff --git a/homeassistant/components/google_assistant/trait.py b/homeassistant/components/google_assistant/trait.py index 8790c3c7402..b5dc2afd3e2 100644 --- a/homeassistant/components/google_assistant/trait.py +++ b/homeassistant/components/google_assistant/trait.py @@ -648,7 +648,14 @@ class StartStopTrait(_Trait): """Execute a StartStop command.""" if command == COMMAND_STARTSTOP: if params["start"] is False: - if self.state.state in (cover.STATE_CLOSING, cover.STATE_OPENING): + if ( + self.state.state + in ( + cover.STATE_CLOSING, + cover.STATE_OPENING, + ) + or self.state.attributes.get(ATTR_ASSUMED_STATE) + ): await self.hass.services.async_call( self.state.domain, cover.SERVICE_STOP_COVER, diff --git a/tests/components/google_assistant/test_trait.py b/tests/components/google_assistant/test_trait.py index b7034f927b4..9b573f1cf71 100644 --- a/tests/components/google_assistant/test_trait.py +++ b/tests/components/google_assistant/test_trait.py @@ -384,8 +384,8 @@ async def test_startstop_vacuum(hass): assert unpause_calls[0].data == {ATTR_ENTITY_ID: "vacuum.bla"} -async def test_startstop_covert(hass): - """Test startStop trait support for vacuum domain.""" +async def test_startstop_cover(hass): + """Test startStop trait support for cover domain.""" assert helpers.get_google_type(cover.DOMAIN, None) is not None assert trait.StartStopTrait.supported(cover.DOMAIN, cover.SUPPORT_STOP, None) @@ -429,6 +429,24 @@ async def test_startstop_covert(hass): await trt.execute(trait.COMMAND_PAUSEUNPAUSE, BASIC_DATA, {"start": True}, {}) +async def test_startstop_cover_assumed(hass): + """Test startStop trait support for cover domain of assumed state.""" + trt = trait.StartStopTrait( + hass, + State( + "cover.bla", + cover.STATE_CLOSED, + {ATTR_SUPPORTED_FEATURES: cover.SUPPORT_STOP, ATTR_ASSUMED_STATE: True}, + ), + BASIC_CONFIG, + ) + + stop_calls = async_mock_service(hass, cover.DOMAIN, cover.SERVICE_STOP_COVER) + await trt.execute(trait.COMMAND_STARTSTOP, BASIC_DATA, {"start": False}, {}) + assert len(stop_calls) == 1 + assert stop_calls[0].data == {ATTR_ENTITY_ID: "cover.bla"} + + async def test_color_setting_color_light(hass): """Test ColorSpectrum trait support for light domain.""" assert helpers.get_google_type(light.DOMAIN, None) is not None