mirror of
https://github.com/home-assistant/core.git
synced 2025-04-24 17:27:52 +00:00
Alexa: Expose intent variables to service calls
This commit is contained in:
parent
4acb121689
commit
c4913a87e4
@ -91,7 +91,7 @@ def _handle_alexa(handler, path_match, data):
|
||||
card['content'])
|
||||
|
||||
if action is not None:
|
||||
call_from_config(handler.server.hass, action, True)
|
||||
call_from_config(handler.server.hass, action, True, response.variables)
|
||||
|
||||
handler.write_json(response.as_dict())
|
||||
|
||||
|
@ -71,8 +71,8 @@ def setUpModule(): # pylint: disable=invalid-name
|
||||
},
|
||||
'action': {
|
||||
'service': 'test.alexa',
|
||||
'data': {
|
||||
'hello': 1
|
||||
'data_template': {
|
||||
'hello': '{{ ZodiacSign }}'
|
||||
},
|
||||
'entity_id': 'switch.test',
|
||||
}
|
||||
@ -278,6 +278,12 @@ class TestAlexa(unittest.TestCase):
|
||||
'timestamp': '2015-05-13T12:34:56Z',
|
||||
'intent': {
|
||||
'name': 'CallServiceIntent',
|
||||
'slots': {
|
||||
'ZodiacSign': {
|
||||
'name': 'ZodiacSign',
|
||||
'value': 'virgo',
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -289,7 +295,7 @@ class TestAlexa(unittest.TestCase):
|
||||
self.assertEqual('test', call.domain)
|
||||
self.assertEqual('alexa', call.service)
|
||||
self.assertEqual(['switch.test'], call.data.get('entity_id'))
|
||||
self.assertEqual(1, call.data.get('hello'))
|
||||
self.assertEqual('virgo', call.data.get('hello'))
|
||||
|
||||
def test_session_ended_request(self):
|
||||
"""Test the request for ending the session."""
|
||||
|
Loading…
x
Reference in New Issue
Block a user