mirror of
https://github.com/home-assistant/core.git
synced 2025-07-22 20:57:21 +00:00
Allow calling scripts from Alexa
This commit is contained in:
parent
612a017bc6
commit
4a5411a957
@ -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())
|
||||||
|
|
||||||
|
@ -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():
|
||||||
|
Loading…
x
Reference in New Issue
Block a user