I’m trying to create a lovelace entities
card with a list of entities derived from a group.
I have looked at ~10 posts in Search results for 'group expand' - Home Assistant Community and I still am stumped. Below is what I’ve tried, based on those posts, but nothing is working. What am I missing?
I’m also aware of some plugins like Lovelace: Group card and
Filter:
type: entities
entities: {{ expand('group.common_area_lights')
| map(attribute='entity_id')
| map("format")
| list()
}}
title: Common Area Lights
show_header_toggle: true
For Loop:
type: entities
entities:
{% for light in expand('group.common_area_lights') -%}
{{ "\n - {}".format(light.entity_id) -}}
{% endfor -%}
title: Common Area Lights
show_header_toggle: true
Using namespaced list
Based on Expand group select attr includes unavailable sensors - #7 by laxarus
type: entities
entities: >-
{% set ns = namespace(entity_list=[]) %}
{% set entity_list = expand('group.common_area_lights') | list %}
{% for entity in entity_list %}
{% set ns.entity_list = [entity.entity_id] + ns.entity_list %}
{%endfor%}
{{ns.entity_list | join(', ')}}
Using something else
based on Jinja / Template Sensor Question - #20 by RonJ103
type: entities
entities: >
{% set entities = expand('group.common_area_lights') %}
{% for x in entities %}
{%- if not loop.first %}, {% endif -%}
{{- x.entity_id -}}
{% endfor %}
title: Common Area Lights
show_header_toggle: true
Again, none of these worked, so would love a pointer to what I’m missing.