homekit_controller: Support cover stop (#23046)

This commit is contained in:
Jc2k 2019-04-17 18:02:04 +01:00 committed by Paulus Schoutsen
parent 7d4083cdd3
commit 88455a8a8b
2 changed files with 36 additions and 21 deletions

View file

@ -5,6 +5,7 @@ from tests.components.homekit_controller.common import (
POSITION_STATE = ('window-covering', 'position.state')
POSITION_CURRENT = ('window-covering', 'position.current')
POSITION_TARGET = ('window-covering', 'position.target')
POSITION_HOLD = ('window-covering', 'position.hold')
H_TILT_CURRENT = ('window-covering', 'horizontal-tilt.current')
H_TILT_TARGET = ('window-covering', 'horizontal-tilt.target')
@ -166,6 +167,17 @@ async def test_write_window_cover_tilt_vertical(hass, utcnow):
assert helper.characteristics[V_TILT_TARGET].value == 90
async def test_window_cover_stop(hass, utcnow):
"""Test that vertical tilt is written correctly."""
window_cover = create_window_covering_service_with_v_tilt()
helper = await setup_test_component(hass, [window_cover])
await hass.services.async_call('cover', 'stop_cover', {
'entity_id': helper.entity_id,
}, blocking=True)
assert helper.characteristics[POSITION_HOLD].value == 1
def create_garage_door_opener_service():
"""Define a garage-door-opener chars as per page 217 of HAP spec."""
service = FakeService('public.hap.service.garage-door-opener')