Skip to content

Commit 15335b3

Browse files
committed
Fix docs for event_template_reloaded
The variable actually gets evaluated to the empty string, `''`, so the `default` filter needs the extra argument to handle values that evaluate to false.
1 parent 55681a0 commit 15335b3

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

examples/template-sensor.yaml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -99,15 +99,15 @@ template:
9999
name: Toyota Prius Distance
100100
unit_of_measurement: km
101101
state_class: total_increasing
102-
state: "{{ (updates|default(this)).state or 0 }}"
102+
state: "{{ (updates|default(this, true)).state or 0 }}"
103103
attributes:
104104
mode_type: driving
105105
trip_start: >
106-
{{ (updates|default(this)).attributes.get('trip_start') }}
106+
{{ (updates|default(this, true)).attributes.get('trip_start') }}
107107
trip_distance: >
108-
{{ (updates|default(this)).attributes.get('trip_distance') }}
108+
{{ (updates|default(this, true)).attributes.get('trip_distance') }}
109109
trip_adjustments: >
110-
{{ (updates|default(this)).attributes.get('trip_adjustments') }}
110+
{{ (updates|default(this, true)).attributes.get('trip_adjustments') }}
111111
112112
# this could be changed manually or via some automation.
113113
input_select:

0 commit comments

Comments
 (0)