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
from homeassistant.const import HTTP_OK, HTTP_UNPROCESSABLE_ENTITY
from homeassistant.helpers.service import call_from_config
from homeassistant.helpers import template
from homeassistant.helpers import template, script
DOMAIN = 'alexa'
DEPENDENCIES = ['http']
@ -91,7 +90,8 @@ def _handle_alexa(handler, path_match, data):
card['content'])
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())

View file

@ -20,9 +20,9 @@ CONF_EVENT_DATA = "event_data"
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."""
Script(hass, config).run()
Script(hass, config).run(variables)
class Script():