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:
Paulus Schoutsen authored and GitHub committed 2017-07-21 21:38:53 -07:00
1 parent 7bea69ce83
commit 7edf14e55f
16 files changed
+970 -396

No files matched your search

+11 -19
View File
@@ -2,7 +2,7 @@
import asyncio
from homeassistant.bootstrap import async_setup_component
from tests.common import async_fire_mqtt_message, async_mock_service
from tests.common import async_fire_mqtt_message, async_mock_intent
EXAMPLE_MSG = """
{
@@ -16,7 +16,7 @@ EXAMPLE_MSG = """
"slotName": "light_color",
"value": {
"kind": "Custom",
"value": "blue"
"value": "green"
}
}
]
@@ -27,27 +27,19 @@ EXAMPLE_MSG = """
@asyncio.coroutine
def test_snips_call_action(hass, mqtt_mock):
"""Test calling action via Snips."""
calls = async_mock_service(hass, 'test', 'service')
result = yield from async_setup_component(hass, "snips", {
"snips": {
"intents": {
"Lights": {
"action": {
"service": "test.service",
"data_template": {
"color": "{{ light_color }}"
}
}
}
}
}
"snips": {},
})
assert result
intents = async_mock_intent(hass, 'Lights')
async_fire_mqtt_message(hass, 'hermes/nlu/intentParsed',
EXAMPLE_MSG)
yield from hass.async_block_till_done()
assert len(calls) == 1
call = calls[0]
assert call.data.get('color') == 'blue'
assert len(intents) == 1
intent = intents[0]
assert intent.platform == 'snips'
assert intent.intent_type == 'Lights'
assert intent.slots == {'light_color': {'value': 'green'}}
assert intent.text_input == 'turn the lights green'