Allow calling scripts from Alexa

This commit is contained in:
Paulus Schoutsen 2016-04-22 05:30:30 -04:00
parent 612a017bc6
commit 4a5411a957
2 changed files with 5 additions and 5 deletions

View File

@ -8,8 +8,7 @@ import enum
import logging import logging
from homeassistant.const import HTTP_OK, HTTP_UNPROCESSABLE_ENTITY from homeassistant.const import HTTP_OK, HTTP_UNPROCESSABLE_ENTITY
from homeassistant.helpers.service import call_from_config from homeassistant.helpers import template, script
from homeassistant.helpers import template
DOMAIN = 'alexa' DOMAIN = 'alexa'
DEPENDENCIES = ['http'] DEPENDENCIES = ['http']
@ -91,7 +90,8 @@ 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, response.variables) script.call_from_config(handler.server.hass, action,
response.variables)
handler.write_json(response.as_dict()) handler.write_json(response.as_dict())

View File

@ -20,9 +20,9 @@ CONF_EVENT_DATA = "event_data"
CONF_DELAY = "delay" CONF_DELAY = "delay"
def call_from_config(hass, config): def call_from_config(hass, config, variables=None):
"""Call a script based on a config entry.""" """Call a script based on a config entry."""
Script(hass, config).run() Script(hass, config).run(variables)
class Script(): class Script():