Add default to self-reference template example (#22624)

This commit is contained in:
Franck Nijhof 2022-05-04 18:15:17 +02:00 committed by GitHub
parent 6e80c89998
commit b404a280d1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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() }}"