From e2ad20b99a8c95de61e2c987fb29dd05e04d0a36 Mon Sep 17 00:00:00 2001 From: Pieter Rautenbach Date: Mon, 21 Mar 2022 16:25:53 +0200 Subject: [PATCH] Document that variables can be templated (#22103) Co-authored-by: Franck Nijhof --- source/_docs/scripts.markdown | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/source/_docs/scripts.markdown b/source/_docs/scripts.markdown index a600a91ce07..cf468a3a0a1 100644 --- a/source/_docs/scripts.markdown +++ b/source/_docs/scripts.markdown @@ -75,6 +75,22 @@ The variables action allows you to set/override variables that will be accessibl {% endraw %} +Variables can be templated. + +{% raw %} + +```yaml +- alias: "Set a templated variable" + variables: + blind_state_message: "The blind is {{ states('cover.blind') }}." +- alias: "Notify about the state of the blind" + service: notify.mobile_app_iphone + data: + message: "{{ blind_state_message }}" +``` + +{% endraw %} + ### Scope of Variables Variables have local scope. This means that if a variable is changed in a nested sequence block, that change will not be visible in an outer sequence block.