Add Intent component (#8434)
* Add intent component * Add intent script component * Add shopping list component * Convert Snips to use intent component * Convert Alexa to use intent component * Lint * Fix Alexa tests * Update snips test * Add intent support to conversation * Add API to view shopping list contents * Lint * Fix demo test * Lint * lint * Remove type from slot schema * Add dependency to conversation * Move intent to be a helper * Fix conversation * Clean up intent helper * Fix Alexa * Snips to use new hass.components * Allow registering intents with conversation at any point in time * Shopping list to register sentences * Add HTTP endpoint to Conversation * Add async action option to intent_script * Update API.ai to use intents * Cleanup Alexa * Shopping list component to register built-in panel * Rename shopping list intent to inlude Hass name
This commit is contained in:
parent
7bea69ce83
commit
7edf14e55f
16 changed files with 970 additions and 396 deletions
|
@ -57,14 +57,15 @@ def setUpModule():
|
|||
|
||||
hass.services.register("test", "apiai", mock_service)
|
||||
|
||||
setup.setup_component(hass, apiai.DOMAIN, {
|
||||
# Key is here to verify we allow other keys in config too
|
||||
"homeassistant": {},
|
||||
"apiai": {
|
||||
"intents": {
|
||||
"WhereAreWeIntent": {
|
||||
"speech":
|
||||
"""
|
||||
assert setup.setup_component(hass, apiai.DOMAIN, {
|
||||
"apiai": {},
|
||||
})
|
||||
assert setup.setup_component(hass, "intent_script", {
|
||||
"intent_script": {
|
||||
"WhereAreWeIntent": {
|
||||
"speech": {
|
||||
"type": "plain",
|
||||
"text": """
|
||||
{%- if is_state("device_tracker.paulus", "home")
|
||||
and is_state("device_tracker.anne_therese",
|
||||
"home") -%}
|
||||
|
@ -77,19 +78,25 @@ def setUpModule():
|
|||
}}
|
||||
{% endif %}
|
||||
""",
|
||||
}
|
||||
},
|
||||
"GetZodiacHoroscopeIntent": {
|
||||
"speech": {
|
||||
"type": "plain",
|
||||
"text": "You told us your sign is {{ ZodiacSign }}.",
|
||||
}
|
||||
},
|
||||
"CallServiceIntent": {
|
||||
"speech": {
|
||||
"type": "plain",
|
||||
"text": "Service called",
|
||||
},
|
||||
"GetZodiacHoroscopeIntent": {
|
||||
"speech": "You told us your sign is {{ ZodiacSign }}.",
|
||||
},
|
||||
"CallServiceIntent": {
|
||||
"speech": "Service called",
|
||||
"action": {
|
||||
"service": "test.apiai",
|
||||
"data_template": {
|
||||
"hello": "{{ ZodiacSign }}"
|
||||
},
|
||||
"entity_id": "switch.test",
|
||||
}
|
||||
"action": {
|
||||
"service": "test.apiai",
|
||||
"data_template": {
|
||||
"hello": "{{ ZodiacSign }}"
|
||||
},
|
||||
"entity_id": "switch.test",
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -509,5 +516,4 @@ class TestApiai(unittest.TestCase):
|
|||
self.assertEqual(200, req.status_code)
|
||||
text = req.json().get("speech")
|
||||
self.assertEqual(
|
||||
"Intent 'unknown' is not yet configured within Home Assistant.",
|
||||
text)
|
||||
"This intent is not yet configured within Home Assistant.", text)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue