Hey guys,
so I’m new to work with templates, so have a question. I try something on the developer page and there is something i don’t undestand. I want to filter my entities and so I try some jinja filters, but the results are not as expected. So maybe it is obvious for you, but not for me.
My filter:
{{states.light | selectattr(‘state’, ‘eq’, ‘off’) | map(attribute=‘entity_id’) |list()}}
{{states.light | selectattr(‘state’, ‘eq’, ‘off’) | map(attribute=‘friendly_name’) | list()}}
The results:
[‘light.kuche’, ‘light.esszimmer’, ‘light.terrasse’, ‘light.eingangstur’, ‘light.schlafzimmer’, ‘light.sessel’, ‘light.couch’, ‘light.kuche_3’, ‘light.kuche_2’, ‘light.kuche_1’, ‘light.kuche_4’, ‘light.esstisch_1’, ‘light.esstisch_2’, ‘light.esstisch_3’, ‘light.terrasse_1’, ‘light.terrasse_2’, ‘light.eingang_rechts’, ‘light.eingang_links’]
[Undefined, Undefined, Undefined, Undefined, Undefined, Undefined, Undefined, Undefined, Undefined, Undefined, Undefined, Undefined, Undefined, Undefined, Undefined, Undefined, Undefined, Undefined]
The first result is as expected, but not the second. I gave all the entities a friendly name, but in the list the friendly names are undefined.
You can give me a little hint, please.
thank you in advance.