Support google assistant stopping for assumed state covers (#44266)
* Support stopping for assumed state covers * Adjust black formatting
This commit is contained in:
parent
067f2d0098
commit
3de0610909
2 changed files with 28 additions and 3 deletions
|
@ -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,
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue