Allow stopping a script with a response value (#95284)

This commit is contained in:
Paulus Schoutsen
2023-06-27 02:24:22 -04:00
committed by GitHub
parent 51aa2ba835
commit 5f14cdf69d
10 changed files with 140 additions and 28 deletions

View File

@ -675,8 +675,14 @@ async def handle_execute_script(
context = connection.context(msg)
script_obj = Script(hass, msg["sequence"], f"{const.DOMAIN} script", const.DOMAIN)
await script_obj.async_run(msg.get("variables"), context=context)
connection.send_result(msg["id"], {"context": context})
response = await script_obj.async_run(msg.get("variables"), context=context)
connection.send_result(
msg["id"],
{
"context": context,
"response": response,
},
)
@callback