i tried to combine my template code with the new one.
type: custom:auto-entities
card:
type: entities
filter:
template: |-
{% set ns = namespace(areas=[], lights= expand(
states.light|selectattr('name','ne','All'))| selectattr("state","eq","on") | list) %}
{% for elm in ns.lights if not area_id(elm.entity_id) in ns.areas%} {% set
ns.areas = ns.areas + [area_id(elm.entity_id)] %} {%- endfor %} {% for area
in ns.areas -%} {% for elm in area_entities(area) if elm in
ns.lights|map(attribute="entity_id") -%}
{{{ 'type': 'custom:vertical-stack-in-card',
'title': area,
'cards':
[
{
'type': 'custom:auto-entities',
'show_empty' : 'false',
'card' :
{ 'type': 'entities'},
'filter':
{ 'include':
[{ 'domain' : 'light',
'state' : 'on',
'area' : area,
'options':
{'type' : 'custom:mushroom-light-card' }}]},
}]}}},
{%- endfor %} {%- endfor %}
the only problem is that it seems to loop to often. and i dont know how to fix this.
all loops are needed to get the correct areas and entities but when i look at my card i have the same amount of vertical stacks and of my entities. so i got 6x vertical stack called âoffice/bĂźroâ and within all 6 there are all the same lights.
If you could fix my code i would be very happy. my brain hurts >.<