From 4ee5e7558f102e36d8da49553ef0c9e575feb05d Mon Sep 17 00:00:00 2001 From: Luke Hovington Date: Sun, 5 Aug 2018 12:40:07 +1000 Subject: [PATCH 1/4] Adding new proceed variable --- source/_docs/scripts.markdown | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/source/_docs/scripts.markdown b/source/_docs/scripts.markdown index f11861ad1ac4..6fbdb3a39616 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 by default abort its execution if the condition is not satisfied. Timeout has the same syntax as `delay`. {% raw %} ```yaml @@ -120,6 +120,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 continue to execute after the timeout by using `proceed` + +{% raw %} +```yaml +# wait until a valve is < 10 or abort after 1 minute. +- wait_template: "{{ states.climate.kitchen.attributes.valve|int < 10 }}" + timeout: '00:01:00' + proceed: 'true' +``` +{% 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. From 02ad1640d3d325f1c43a44466e757758c575c230 Mon Sep 17 00:00:00 2001 From: Luke Hovington Date: Mon, 6 Aug 2018 09:26:26 +1000 Subject: [PATCH 2/4] Fixing documentation langauage --- source/_docs/scripts.markdown | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/_docs/scripts.markdown b/source/_docs/scripts.markdown index 6fbdb3a39616..5d4803c6d402 100644 --- a/source/_docs/scripts.markdown +++ b/source/_docs/scripts.markdown @@ -124,7 +124,7 @@ You can also get the script to continue to execute after the timeout by using `p {% raw %} ```yaml -# wait until a valve is < 10 or abort after 1 minute. +# wait until a valve is < 10 or proceed after 1 minute. - wait_template: "{{ states.climate.kitchen.attributes.valve|int < 10 }}" timeout: '00:01:00' proceed: 'true' From 27d79e7b4be3fdddbd630defabb0f0b9a61a3a0f Mon Sep 17 00:00:00 2001 From: Luke Hovington Date: Wed, 8 Aug 2018 09:36:03 +1000 Subject: [PATCH 3/4] Updating documentation due to code changes --- source/_docs/scripts.markdown | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/source/_docs/scripts.markdown b/source/_docs/scripts.markdown index 5d4803c6d402..afc4f34e89de 100644 --- a/source/_docs/scripts.markdown +++ b/source/_docs/scripts.markdown @@ -120,14 +120,14 @@ It is also possible to use dummy variables, e.g., in scripts, when using `wait_t ``` {% endraw %} -You can also get the script to continue to execute after the timeout by using `proceed` +You can also get the script to continue to execute after the timeout by using `continue_on_timeout` {% raw %} ```yaml -# wait until a valve is < 10 or proceed after 1 minute. -- wait_template: "{{ states.climate.kitchen.attributes.valve|int < 10 }}" +# wait for sensor or 1 minute. +- wait_template: "{{ is_state('binary_sensor.entrance', 'on') }}" timeout: '00:01:00' - proceed: 'true' + continue_on_timeout: 'true' ``` {% endraw %} From 6ecd7d27f18907ba04c90228d0bd95a26107833c Mon Sep 17 00:00:00 2001 From: Luke Hovington Date: Sun, 12 Aug 2018 23:29:49 +1000 Subject: [PATCH 4/4] Changing default to continue to execute after delay --- source/_docs/scripts.markdown | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/source/_docs/scripts.markdown b/source/_docs/scripts.markdown index afc4f34e89de..cf73a558c15f 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 by default 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,14 +121,14 @@ It is also possible to use dummy variables, e.g., in scripts, when using `wait_t ``` {% endraw %} -You can also get the script to continue to execute after the timeout by using `continue_on_timeout` +You can also get the script to abort after the timeout by using `continue_on_timeout` {% raw %} ```yaml -# wait for sensor or 1 minute. -- wait_template: "{{ is_state('binary_sensor.entrance', 'on') }}" +# 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: 'true' + continue_on_timeout: 'false' ``` {% endraw %}