From 534af1559edda18c9fadb8f19681a1f8fe66315c Mon Sep 17 00:00:00 2001 From: cdce8p <30130371+cdce8p@users.noreply.github.com> Date: Thu, 12 Oct 2017 04:53:11 +0200 Subject: [PATCH 1/3] * Updated wait_template to include 'trigger.entity_id' and 'variables' support --- source/_docs/scripts.markdown | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/source/_docs/scripts.markdown b/source/_docs/scripts.markdown index 4a732d0cbec7..ff7ea80c22d0 100644 --- a/source/_docs/scripts.markdown +++ b/source/_docs/scripts.markdown @@ -90,6 +90,30 @@ wait_template: {% raw %}"{{ states.climate.kitchen.attributes.valve < 10 }}"{% e timeout: 00:01:00 ``` +When using `wait_template` within an automation `trigger.entity_id` is supported for `state`, `numeric_state` and `template` triggers, see also [Available-Trigger-Data](/docs/automation/templating/#available-trigger-data). + +{% raw %} +```yaml +# Important: Note the whitespace before and after `trigger.entity_id`. +wait_template: "{{ is_state( trigger.entity_id , 'on') }}" +``` +{% endraw %} + +It is also possible to use dummy variables, e.g. in scripts, when using `wait_template`. + +{% raw %} +```yaml +# Service call, e.g. from an automation. +service: script.do_something +data_template: + dummy: "{{ input_boolean.switch }}" + +# Inside the script +# Important: Note the whitespace before and after `dummy`. +wait_template: "{{ is_state( dummy , 'off') }}" +``` +{% 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 cc8ec426a1e3b7521ad7c6a8ff6f13f7472c59fd Mon Sep 17 00:00:00 2001 From: cdce8p <30130371+cdce8p@users.noreply.github.com> Date: Thu, 12 Oct 2017 13:04:19 +0200 Subject: [PATCH 2/3] * Deleted notes and whitespaces --- source/_docs/scripts.markdown | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/source/_docs/scripts.markdown b/source/_docs/scripts.markdown index ff7ea80c22d0..23d9b3d622f0 100644 --- a/source/_docs/scripts.markdown +++ b/source/_docs/scripts.markdown @@ -94,8 +94,7 @@ When using `wait_template` within an automation `trigger.entity_id` is supported {% raw %} ```yaml -# Important: Note the whitespace before and after `trigger.entity_id`. -wait_template: "{{ is_state( trigger.entity_id , 'on') }}" +wait_template: "{{ is_state(trigger.entity_id, 'on') }}" ``` {% endraw %} @@ -109,8 +108,7 @@ data_template: dummy: "{{ input_boolean.switch }}" # Inside the script -# Important: Note the whitespace before and after `dummy`. -wait_template: "{{ is_state( dummy , 'off') }}" +wait_template: "{{ is_state(dummy, 'off') }}" ``` {% endraw %} From cc3b0f0c567b87891a91842d1831760c0a7706d3 Mon Sep 17 00:00:00 2001 From: Franck Nijhof Date: Wed, 18 Oct 2017 22:38:57 +0200 Subject: [PATCH 3/3] Small grammar correction --- 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 23d9b3d622f0..bffc89b8a7be 100644 --- a/source/_docs/scripts.markdown +++ b/source/_docs/scripts.markdown @@ -98,7 +98,7 @@ wait_template: "{{ is_state(trigger.entity_id, 'on') }}" ``` {% endraw %} -It is also possible to use dummy variables, e.g. in scripts, when using `wait_template`. +It is also possible to use dummy variables, e.g., in scripts, when using `wait_template`. {% raw %} ```yaml