Add tilt support to basic homekit window covers (#33937)
* Add tilt support to basic homekit window covers * Add stop support to all window covers * protect supports_stop
This commit is contained in:
parent
e6a6c3ceb6
commit
c75d3ce8c7
3 changed files with 109 additions and 54 deletions
|
@ -9,6 +9,7 @@ from homeassistant.components.cover import (
|
|||
ATTR_POSITION,
|
||||
ATTR_TILT_POSITION,
|
||||
DOMAIN,
|
||||
SUPPORT_SET_POSITION,
|
||||
SUPPORT_SET_TILT_POSITION,
|
||||
SUPPORT_STOP,
|
||||
)
|
||||
|
@ -395,6 +396,30 @@ async def test_window_open_close_stop(hass, hk_driver, cls, events):
|
|||
assert events[-1].data[ATTR_VALUE] is None
|
||||
|
||||
|
||||
async def test_window_open_close_with_position_and_stop(hass, hk_driver, cls, events):
|
||||
"""Test if accessory and HA are updated accordingly."""
|
||||
entity_id = "cover.stop_window"
|
||||
|
||||
hass.states.async_set(
|
||||
entity_id,
|
||||
STATE_UNKNOWN,
|
||||
{ATTR_SUPPORTED_FEATURES: SUPPORT_STOP | SUPPORT_SET_POSITION},
|
||||
)
|
||||
acc = cls.window(hass, hk_driver, "Cover", entity_id, 2, None)
|
||||
await acc.run_handler()
|
||||
|
||||
# Set from HomeKit
|
||||
call_stop_cover = async_mock_service(hass, DOMAIN, "stop_cover")
|
||||
|
||||
await hass.async_add_executor_job(acc.char_hold_position.client_update_value, 1)
|
||||
await hass.async_block_till_done()
|
||||
assert call_stop_cover
|
||||
assert call_stop_cover[0].data[ATTR_ENTITY_ID] == entity_id
|
||||
assert acc.char_hold_position.value == 1
|
||||
assert len(events) == 1
|
||||
assert events[-1].data[ATTR_VALUE] is None
|
||||
|
||||
|
||||
async def test_window_basic_restore(hass, hk_driver, cls, events):
|
||||
"""Test setting up an entity from state in the event registry."""
|
||||
hass.state = CoreState.not_running
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue