mirror of
https://github.com/home-assistant/core.git
synced 2025-04-23 08:47:57 +00:00
Update Unlock directive for Alexa LockController (#27653)
* Update the Alexa.LockController Unlock directive to include the lockState property in the context of the response. * Added Test for Alexa.LockController Unlock directive to include the lockState property in the context of the response.
This commit is contained in:
parent
6c0efe9329
commit
a49dbb9718
@ -412,7 +412,6 @@ async def async_api_lock(hass, config, directive, context):
|
||||
return response
|
||||
|
||||
|
||||
# Not supported by Alexa yet
|
||||
@HANDLERS.register(("Alexa.LockController", "Unlock"))
|
||||
async def async_api_unlock(hass, config, directive, context):
|
||||
"""Process an unlock request."""
|
||||
@ -425,7 +424,12 @@ async def async_api_unlock(hass, config, directive, context):
|
||||
context=context,
|
||||
)
|
||||
|
||||
return directive.response()
|
||||
response = directive.response()
|
||||
response.add_context_property(
|
||||
{"namespace": "Alexa.LockController", "name": "lockState", "value": "UNLOCKED"}
|
||||
)
|
||||
|
||||
return response
|
||||
|
||||
|
||||
@HANDLERS.register(("Alexa.Speaker", "SetVolume"))
|
||||
|
@ -403,12 +403,20 @@ async def test_lock(hass):
|
||||
"Alexa.LockController", "Lock", "lock#test", "lock.lock", hass
|
||||
)
|
||||
|
||||
# always return LOCKED for now
|
||||
properties = msg["context"]["properties"][0]
|
||||
assert properties["name"] == "lockState"
|
||||
assert properties["namespace"] == "Alexa.LockController"
|
||||
assert properties["value"] == "LOCKED"
|
||||
|
||||
_, msg = await assert_request_calls_service(
|
||||
"Alexa.LockController", "Unlock", "lock#test", "lock.unlock", hass
|
||||
)
|
||||
|
||||
properties = msg["context"]["properties"][0]
|
||||
assert properties["name"] == "lockState"
|
||||
assert properties["namespace"] == "Alexa.LockController"
|
||||
assert properties["value"] == "UNLOCKED"
|
||||
|
||||
|
||||
async def test_media_player(hass):
|
||||
"""Test media player discovery."""
|
||||
|
Loading…
x
Reference in New Issue
Block a user