Hi,
I am trying to add a card to the UI, that shows all lights that are currently on (could also be "all open windows,…).
I can achieve this simply by using the entity-filter card and manually adding a list of all my light entities. But I thought, there must be a more elegant and future-proof way. What I really want to spefify is “all entities of the light domain”.
The forum posts PSA: Turn on/off all lights in Home Assistant 0.104+ (group.all_* changes) and How to say in message which windows are open? contain template code that can be used in automations, but I can’t get this to work for the entity list in the entity-filter card.
What I tried:
type: entity-filter
card:
type: glance
title: Active lights
show_empty: false
state_filter:
- 'on'
entities: >
{% set domain = 'light' %}
{% set entities = states[domain] | map(attribute='entity_id') | list %}
{{entities}}
and
type: entity-filter
card:
type: glance
title: Active lights
show_empty: false
state_filter:
- 'on'
entities: >
{% for state in states.light %}
- {{ state.entity_id }}
{% endfor %}
Both without success - probably because jinja templates are not allowed for entities:
Any advise is greatly appreciated