I think I got what I wanted
However, I had to delete my lights group with all the lights, otherwise it somehow didnât work.
All lights:
type: custom:stack-in-card
mode: vertical
cards:
- type: custom:auto-entities
card:
type: entities
filter:
template: |
{% set groups = (states.light
| selectattr('attributes.entity_id','defined')
| rejectattr('entity_id', 'eq', 'light.presence_simulation')
| map(attribute='entity_id')
| list) + (states.light
| selectattr('entity_id', 'search', '.*\.group_.*')
| map(attribute='entity_id')
| list)
%}
{% set members = groups | expand
| map(attribute='entity_id')
| list
%}
{% set individualLights = states.light
| rejectattr('entity_id', 'in', label_entities('exclude'))
| rejectattr('entity_id', 'in', area_entities('System'))
| map(attribute='entity_id')
| reject('in', groups + members)
| list
%}
[
{% for group in groups %}
{
"type": "custom:expander-card",
"title-card": {
"type": "custom:mushroom-light-card",
"entity": "{{ group }}"
},
"cards": [
{% for light in state_attr(group, 'entity_id') %}
{
"type": "custom:mushroom-light-card",
"entity": "{{ light }}"
}{% if not loop.last %},{% endif %}
{% endfor %}
]
}{% if not loop.last %},{% endif %}
{% endfor %}
]
include: []
exclude: []
- type: custom:auto-entities
card:
type: entities
filter:
template: |
{% set groups = (states.light
| selectattr('attributes.entity_id','defined')
| rejectattr('entity_id', 'eq', 'light.presence_simulation')
| map(attribute='entity_id')
| list) + (states.light
| selectattr('entity_id', 'search', '.*\.group_.*')
| map(attribute='entity_id')
| list)
%}
{% set members = groups | expand
| map(attribute='entity_id')
| list
%}
{% set individualLights = states.light
| rejectattr('entity_id', 'in', label_entities('exclude'))
| rejectattr('entity_id', 'in', area_entities('System'))
| map(attribute='entity_id')
| reject('in', groups + members)
| list
%}
[
{% for light in individualLights %}
{
"type": "custom:mushroom-light-card",
"entity": "{{ light }}"
}{% if not loop.last %},{% endif %}
{% endfor %}
]
include: []
exclude: []
All lights in room (âSchlafzimmerâ):
type: custom:stack-in-card
mode: vertical
cards:
- type: custom:auto-entities
card:
type: entities
filter:
template: |
{% set groups = (states.light
| selectattr('attributes.entity_id','defined')
| rejectattr('entity_id', 'eq', 'light.presence_simulation')
| selectattr('entity_id', 'in', area_entities('Schlafzimmer'))
| map(attribute='entity_id')
| list) + (states.light
| selectattr('entity_id', 'search', '.*\.group_.*')
| selectattr('entity_id', 'in', area_entities('Schlafzimmer'))
| map(attribute='entity_id')
| list)
%}
{% set members = groups | expand
| map(attribute='entity_id')
| list
%}
{% set individualLights = states.light
| rejectattr('entity_id', 'in', label_entities('exclude'))
| rejectattr('entity_id', 'in', area_entities('System'))
| selectattr('entity_id', 'in', area_entities('Schlafzimmer'))
| map(attribute='entity_id')
| reject('in', groups + members)
| list
%}
[
{% for group in groups %}
{
"type": "custom:expander-card",
"title-card": {
"type": "custom:mushroom-light-card",
"entity": "{{ group }}"
},
"cards": [
{% for light in state_attr(group, 'entity_id') %}
{
"type": "custom:mushroom-light-card",
"entity": "{{ light }}"
}{% if not loop.last %},{% endif %}
{% endfor %}
]
}{% if not loop.last %},{% endif %}
{% endfor %}
]
include: []
exclude: []
- type: custom:auto-entities
card:
type: entities
filter:
template: |
{% set groups = (states.light
| selectattr('attributes.entity_id','defined')
| rejectattr('entity_id', 'eq', 'light.presence_simulation')
| selectattr('entity_id', 'in', area_entities('Schlafzimmer'))
| map(attribute='entity_id')
| list) + (states.light
| selectattr('entity_id', 'search', '.*\.group_.*')
| selectattr('entity_id', 'in', area_entities('Schlafzimmer'))
| map(attribute='entity_id')
| list)
%}
{% set members = groups | expand
| map(attribute='entity_id')
| list
%}
{% set individualLights = states.light
| rejectattr('entity_id', 'in', label_entities('exclude'))
| rejectattr('entity_id', 'in', area_entities('System'))
| selectattr('entity_id', 'in', area_entities('Schlafzimmer'))
| map(attribute='entity_id')
| reject('in', groups + members)
| list
%}
[
{% for light in individualLights %}
{
"type": "custom:mushroom-light-card",
"entity": "{{ light }}"
}{% if not loop.last %},{% endif %}
{% endfor %}
]
include: []
exclude: []