mirror of
https://github.com/home-assistant/core.git
synced 2025-04-25 09:47: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'])
|
card['content'])
|
||||||
|
|
||||||
if action is not None:
|
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())
|
handler.write_json(response.as_dict())
|
||||||
|
|
||||||
|
@ -71,8 +71,8 @@ def setUpModule(): # pylint: disable=invalid-name
|
|||||||
},
|
},
|
||||||
'action': {
|
'action': {
|
||||||
'service': 'test.alexa',
|
'service': 'test.alexa',
|
||||||
'data': {
|
'data_template': {
|
||||||
'hello': 1
|
'hello': '{{ ZodiacSign }}'
|
||||||
},
|
},
|
||||||
'entity_id': 'switch.test',
|
'entity_id': 'switch.test',
|
||||||
}
|
}
|
||||||
@ -278,6 +278,12 @@ class TestAlexa(unittest.TestCase):
|
|||||||
'timestamp': '2015-05-13T12:34:56Z',
|
'timestamp': '2015-05-13T12:34:56Z',
|
||||||
'intent': {
|
'intent': {
|
||||||
'name': 'CallServiceIntent',
|
'name': 'CallServiceIntent',
|
||||||
|
'slots': {
|
||||||
|
'ZodiacSign': {
|
||||||
|
'name': 'ZodiacSign',
|
||||||
|
'value': 'virgo',
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -289,7 +295,7 @@ class TestAlexa(unittest.TestCase):
|
|||||||
self.assertEqual('test', call.domain)
|
self.assertEqual('test', call.domain)
|
||||||
self.assertEqual('alexa', call.service)
|
self.assertEqual('alexa', call.service)
|
||||||
self.assertEqual(['switch.test'], call.data.get('entity_id'))
|
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):
|
def test_session_ended_request(self):
|
||||||
"""Test the request for ending the session."""
|
"""Test the request for ending the session."""
|
||||||
|
Loading…
x
Reference in New Issue
Block a user