From 8b83098a778acca015817747149895e3522231b8 Mon Sep 17 00:00:00 2001 From: Phil Bruckner Date: Sat, 29 Jun 2019 10:20:47 -0500 Subject: [PATCH] Add template support to template trigger's for option (#9714) --- source/_docs/automation/trigger.markdown | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/source/_docs/automation/trigger.markdown b/source/_docs/automation/trigger.markdown index 0b5bcab21ee..7ee0fef0e73 100644 --- a/source/_docs/automation/trigger.markdown +++ b/source/_docs/automation/trigger.markdown @@ -201,6 +201,21 @@ automation: ``` {% endraw %} +You can also use templates in the `for` option. + +{% raw %} +```yaml +automation: + trigger: + platform: template + value_template: "{{ is_state('device_tracker.paulus', 'home') }}" + for: + minutes: "{{ states('input_number.minutes')|int(0) }}" +``` +{% endraw %} + +The `for` template(s) will be evaluated when the `value_template` becomes `true`. +

Rendering templates with time (`now()`) is dangerous as trigger templates only update based on entity state changes.