Dev Template tool weirdness

Can someone explain why these two examples produce a different result?

EXAMPLE 1

{{
  (expand(states.input_boolean) | selectattr('entity_id', 'search', 'input_boolean.announcement_in_')
                                | selectattr('state', 'eq', 'on') 
                                | map(attribute='entity_id') | list) | replace('input_boolean.announcement_in_', '')
}}

{{
  (expand(states.input_boolean) | selectattr('entity_id', 'search', 'input_boolean.announcement_in_')
                                | selectattr('state', 'eq', 'on') 
                                | map(attribute='entity_id') | list) | replace('input_boolean.announcement_in_', '')
}}

Gives:
(note that both statements are identical)

['dining_room', 'kitchen']

['dining_room', 'kitchen']

EXAMPLE 2

Yet this:

{{
  (expand(states.input_boolean) | selectattr('entity_id', 'search', 'input_boolean.announcement_in_')
                                | selectattr('state', 'eq', 'on') 
                                | map(attribute='entity_id') | list) | replace('input_boolean.announcement_in_', '')
}}

Gives

[
  "dining_room",
  "kitchen"
]

Example 1

Example 2

The template editor is detecting the output type.

image

2 lists back to back is an invalid type, so it think’s it’s a string. When you remove the second output, it realizes it’s a list and makes it a nice format for you to look at.

2 Likes