🔹 Auto-entities - Automatically fill cards with entities

Wow, thank you so much @Mariusthvdb! This is amazing and with some tinkering leads exactly to the list of lights that I was hoping to get!

I have added a couple of additions:

  • I rejected light.presence_simulation (dummy group for presence simulation add-on), as this isn’t really a group in the normal sense
  • I additionally added a second list getting all the entities that contain .group_ in the entity_id. Just as a back-up to the issue you mentioned with unavailable groups, so that I can rename the group if it becomes necessary. The lists have some overlap, but this doesn’t matter as it is only used for the exclusions, excluding an entity twice doesn’t matter.
{% 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
  ) | list
%}

{% set members = groups | expand
  | map(attribute='entity_id')
  | list
%}

{{ 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
}}

Now this brings me to the issue that I can’t add options to template filters. I tried to follow this post to include the options right into the template and ended up with this:

type: custom:auto-entities
card:
  type: entities
filter:
  template: |
    [
      {% for e in state_attr('sensor.individual_lights','entities') %}
        {
          "type": "custom:decluttering-card",
          "template": "illumination_light-card-single",
          "variables": "{{ 
                - Light: this.entity_id }}",
          }, 
      {% endfor %} ]
  include: []
  exclude: []

But that doesn’t really work yet. It just gives me no entities at all and honestly, I’m a bit out of my depth here. My sensor.individual_lights looks like this: ['light.dummy_light_1', 'light.sunricher_on_off_2ch_licht', 'light.sunricher_on_off_2ch_licht_2', 'light.dummy_light_group_2']

Do you have any pointers on how I can add the options to the template filter? Or is there a way to use sensor.individual_lights as part of a normal include filter? Other than that it seems to work great!

I’ve also added a comment to the issue you have opened. This would definitely be more logic!