From a81457eb8739120d9b96b3f0741a22153cb92491 Mon Sep 17 00:00:00 2001 From: Otto Winter Date: Sat, 19 Oct 2019 16:32:55 +0200 Subject: [PATCH] Add script.wait action (#367) --- guides/automations.rst | 28 +++++++++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) diff --git a/guides/automations.rst b/guides/automations.rst index b7aa2aca9..914e56242 100644 --- a/guides/automations.rst +++ b/guides/automations.rst @@ -337,7 +337,7 @@ All Actions - :ref:`lambda ` - :ref:`if ` / :ref:`while ` / :ref:`wait_util ` - :ref:`component.update ` -- :ref:`script.execute ` / :ref:`script.stop ` +- :ref:`script.execute ` / :ref:`script.stop ` / :ref:`script.wait ` - :ref:`logger.log ` - :ref:`homeassistant.service ` - :ref:`mqtt.publish ` / :ref:`mqtt.publish_json ` @@ -649,6 +649,32 @@ Please note this is only useful right now if your script contains a ``delay`` ac then: - script.stop: my_script +.. _script-wait_action: + +``script.wait`` Action +---------------------- + +This action suspends execution of the automation until a script has finished executing. + +Note: If no script is executing, this will continue immediately. If multiple instances of the script +are running, this will block until all of them have terminated. + +.. code-block:: yaml + + # Example configuration entry + script: + - id: my_script + then: + - switch.turn_on: my_switch + - delay: 1s + - switch.turn_off: my_switch + + # in a trigger: + on_...: + then: + - script.execute: my_script + - script.wait: my_script + .. _script-is_running_condition: ``script.is_running`` Condition