From def92b9b3963ee49d065440b1ab77f7ebacdc203 Mon Sep 17 00:00:00 2001 From: "Hovo (Luke)" Date: Tue, 14 Aug 2018 04:24:35 +1000 Subject: [PATCH] Allow wait template to run the remainder of the script (#5954) * Adding new proceed variable * Fixing documentation langauage * Updating documentation due to code changes * Changing default to continue to execute after delay --- source/_docs/scripts.markdown | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/source/_docs/scripts.markdown b/source/_docs/scripts.markdown index 41579318f06..7534ae05787 100644 --- a/source/_docs/scripts.markdown +++ b/source/_docs/scripts.markdown @@ -81,7 +81,7 @@ Delays are useful for temporarily suspending your script and start it at a later ### {% linkable_title Wait %} -Wait until some things are complete. We support at the moment `wait_template` for waiting until a condition is `true`, see also on [Template-Trigger](/docs/automation/trigger/#template-trigger). It is possible to set a timeout after which the script will abort its execution if the condition is not satisfied. Timeout has the same syntax as `delay`. +Wait until some things are complete. We support at the moment `wait_template` for waiting until a condition is `true`, see also on [Template-Trigger](/docs/automation/trigger/#template-trigger). It is possible to set a timeout after which the script will continue its execution if the condition is not satisfied. Timeout has the same syntax as `delay`. {% raw %} ```yaml @@ -92,9 +92,10 @@ Wait until some things are complete. We support at the moment `wait_template` fo {% raw %} ```yaml -# wait until a valve is < 10 or abort after 1 minute. -- wait_template: "{{ states.climate.kitchen.attributes.valve|int < 10 }}" +# wait for sensor to trigger or 1 minute before continuing to execute. +- wait_template: "{{ is_state('binary_sensor.entrance', 'on') }}" timeout: '00:01:00' + continue_on_timeout: 'true' ``` {% endraw %} @@ -120,6 +121,17 @@ It is also possible to use dummy variables, e.g., in scripts, when using `wait_t ``` {% endraw %} +You can also get the script to abort after the timeout by using `continue_on_timeout` + +{% raw %} +```yaml +# wait until a valve is < 10 or continue after 1 minute. +- wait_template: "{{ states.climate.kitchen.attributes.valve|int < 10 }}" + timeout: '00:01:00' + continue_on_timeout: 'false' +``` +{% endraw %} + ### {% linkable_title Fire an Event %} This action allows you to fire an event. Events can be used for many things. It could trigger an automation or indicate to another component that something is happening. For instance, in the below example it is used to create an entry in the logbook.