From e8733459d29444e8a64afb4ae80499cdfeb758f0 Mon Sep 17 00:00:00 2001 From: cdce8p <30130371+cdce8p@users.noreply.github.com> Date: Sun, 22 Oct 2017 00:58:46 +0200 Subject: [PATCH] Script - wait_template 'trigger.entity_id' support (#3593) * * Updated wait_template to include 'trigger.entity_id' and 'variables' support * * Deleted notes and whitespaces * Small grammar correction --- source/_docs/scripts.markdown | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/source/_docs/scripts.markdown b/source/_docs/scripts.markdown index 4a732d0cbec..bffc89b8a7b 100644 --- a/source/_docs/scripts.markdown +++ b/source/_docs/scripts.markdown @@ -90,6 +90,28 @@ 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 +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 +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.