Support google assistant stopping for assumed state covers (#44266)

* Support stopping for assumed state covers

* Adjust black formatting
This commit is contained in:
Joakim Plate 2021-01-02 23:01:20 +01:00 committed by GitHub
parent 067f2d0098
commit 3de0610909
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 28 additions and 3 deletions

View file

@ -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,