parent
ea7b1e4573
commit
9aaf11de8c
54 changed files with 223 additions and 382 deletions
|
@ -1,5 +1,4 @@
|
|||
"""Handle intents with scripts."""
|
||||
import asyncio
|
||||
import copy
|
||||
import logging
|
||||
|
||||
|
@ -45,8 +44,7 @@ CONFIG_SCHEMA = vol.Schema({
|
|||
_LOGGER = logging.getLogger(__name__)
|
||||
|
||||
|
||||
@asyncio.coroutine
|
||||
def async_setup(hass, config):
|
||||
async def async_setup(hass, config):
|
||||
"""Activate Alexa component."""
|
||||
intents = copy.deepcopy(config[DOMAIN])
|
||||
template.attach(hass, intents)
|
||||
|
@ -69,8 +67,7 @@ class ScriptIntentHandler(intent.IntentHandler):
|
|||
self.intent_type = intent_type
|
||||
self.config = config
|
||||
|
||||
@asyncio.coroutine
|
||||
def async_handle(self, intent_obj):
|
||||
async def async_handle(self, intent_obj):
|
||||
"""Handle the intent."""
|
||||
speech = self.config.get(CONF_SPEECH)
|
||||
card = self.config.get(CONF_CARD)
|
||||
|
@ -83,7 +80,7 @@ class ScriptIntentHandler(intent.IntentHandler):
|
|||
if is_async_action:
|
||||
intent_obj.hass.async_add_job(action.async_run(slots))
|
||||
else:
|
||||
yield from action.async_run(slots)
|
||||
await action.async_run(slots)
|
||||
|
||||
response = intent_obj.create_response()
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue