From b404a280d1f51d89d865977b5c38baf8017abe7b Mon Sep 17 00:00:00 2001 From: Franck Nijhof Date: Wed, 4 May 2022 18:15:17 +0200 Subject: [PATCH] Add default to self-reference template example (#22624) --- source/_integrations/template.markdown | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/_integrations/template.markdown b/source/_integrations/template.markdown index 417676c595b..ecd2d58c6d1 100644 --- a/source/_integrations/template.markdown +++ b/source/_integrations/template.markdown @@ -578,7 +578,7 @@ This example demonstrates how the `this` variable can be used in templates for s template: - sensor: - name: test - state: "{{ this.attributes.test }}" + state: "{{ this.attributes.test | default('Value when missing') }}" # not: "{{ state_attr('sensor.test', 'test') }}" attributes: test: "{{ now() }}"