Improve Google Assistant cover assumed state handling (#43255)

* Set command only cover
* No need for override position now that we support command only
* Return empty state response for assumed state

Fixes #43178
Reverts: #23498

Co-authored-by: Paulus Schoutsen <paulus@home-assistant.io>
This commit is contained in:
Joakim Plate 2020-11-17 21:55:46 +01:00 committed by GitHub
parent 212fb572e1
commit 1567fadda3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 16 additions and 27 deletions

View file

@ -1886,7 +1886,8 @@ async def test_openclose_cover_unknown_state(hass):
assert len(calls) == 1
assert calls[0].data == {ATTR_ENTITY_ID: "cover.bla"}
assert trt.query_attributes() == {"openPercent": 100}
with pytest.raises(helpers.SmartHomeError):
trt.query_attributes()
async def test_openclose_cover_assumed_state(hass):
@ -1909,18 +1910,15 @@ async def test_openclose_cover_assumed_state(hass):
BASIC_CONFIG,
)
assert trt.sync_attributes() == {}
assert trt.sync_attributes() == {"commandOnlyOpenClose": True}
with pytest.raises(helpers.SmartHomeError):
trt.query_attributes()
assert trt.query_attributes() == {}
calls = async_mock_service(hass, cover.DOMAIN, cover.SERVICE_SET_COVER_POSITION)
await trt.execute(trait.COMMAND_OPENCLOSE, BASIC_DATA, {"openPercent": 40}, {})
assert len(calls) == 1
assert calls[0].data == {ATTR_ENTITY_ID: "cover.bla", cover.ATTR_POSITION: 40}
assert trt.query_attributes() == {"openPercent": 40}
async def test_openclose_cover_no_position(hass):
"""Test OpenClose trait support for cover domain."""