Fix execute device actions with WS execute_script (#95783)

This commit is contained in:
Erik Montnemery
2023-07-03 20:21:01 +02:00
committed by GitHub
parent 3f9d5a0192
commit 78880f0c9d
2 changed files with 81 additions and 5 deletions

View File

@ -704,10 +704,12 @@ async def handle_execute_script(
"""Handle execute script command."""
# Circular dep
# pylint: disable-next=import-outside-toplevel
from homeassistant.helpers.script import Script
from homeassistant.helpers.script import Script, async_validate_actions_config
script_config = await async_validate_actions_config(hass, msg["sequence"])
context = connection.context(msg)
script_obj = Script(hass, msg["sequence"], f"{const.DOMAIN} script", const.DOMAIN)
script_obj = Script(hass, script_config, f"{const.DOMAIN} script", const.DOMAIN)
response = await script_obj.async_run(msg.get("variables"), context=context)
connection.send_result(
msg["id"],