mirror of
https://github.com/home-assistant/core.git
synced 2025-07-19 11:17:21 +00:00
Always return lockState == LOCKED when handling Alexa.LockController (#12328)
This commit is contained in:
parent
5d15b257c4
commit
7059b6c6c1
@ -1065,7 +1065,16 @@ def async_api_lock(hass, config, request, entity):
|
|||||||
ATTR_ENTITY_ID: entity.entity_id
|
ATTR_ENTITY_ID: entity.entity_id
|
||||||
}, blocking=False)
|
}, blocking=False)
|
||||||
|
|
||||||
return api_message(request)
|
# Alexa expects a lockState in the response, we don't know the actual
|
||||||
|
# lockState at this point but assume it is locked. It is reported
|
||||||
|
# correctly later when ReportState is called. The alt. to this approach
|
||||||
|
# is to implement DeferredResponse
|
||||||
|
properties = [{
|
||||||
|
'name': 'lockState',
|
||||||
|
'namespace': 'Alexa.LockController',
|
||||||
|
'value': 'LOCKED'
|
||||||
|
}]
|
||||||
|
return api_message(request, context={'properties': properties})
|
||||||
|
|
||||||
|
|
||||||
# Not supported by Alexa yet
|
# Not supported by Alexa yet
|
||||||
|
@ -401,11 +401,17 @@ def test_lock(hass):
|
|||||||
assert appliance['friendlyName'] == "Test lock"
|
assert appliance['friendlyName'] == "Test lock"
|
||||||
assert_endpoint_capabilities(appliance, 'Alexa.LockController')
|
assert_endpoint_capabilities(appliance, 'Alexa.LockController')
|
||||||
|
|
||||||
yield from assert_request_calls_service(
|
_, msg = yield from assert_request_calls_service(
|
||||||
'Alexa.LockController', 'Lock', 'lock#test',
|
'Alexa.LockController', 'Lock', 'lock#test',
|
||||||
'lock.lock',
|
'lock.lock',
|
||||||
hass)
|
hass)
|
||||||
|
|
||||||
|
# always return LOCKED for now
|
||||||
|
properties = msg['context']['properties'][0]
|
||||||
|
assert properties['name'] == 'lockState'
|
||||||
|
assert properties['namespace'] == 'Alexa.LockController'
|
||||||
|
assert properties['value'] == 'LOCKED'
|
||||||
|
|
||||||
|
|
||||||
@asyncio.coroutine
|
@asyncio.coroutine
|
||||||
def test_media_player(hass):
|
def test_media_player(hass):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user