šŸ”¹ Auto-entities - Automatically fill cards with entities

fold-entity-row, collapsible-card - both have own main threads.

I should have been more clear… I tried those but its creating a separate Header, I’m trying to make the collapse inside the existing Auto-Entities header. Thus, looks like its a card-within-a-card, which is not what I’d like.

This is what it looks like…

this is the core code I want the entities to fold into…

type: custom:auto-entities
card:
  type: entities
  title: Zone Details
filter:
  template: >
    {% for s in states.binary_sensor | selectattr('attributes.zone', 'defined')
    -%}
       {{-
          {
            'type': 'custom:multiple-entity-row',
            'entity': s.entity_id,
            'name': s.name,
            'secondary_info': {'name':'Zone','attribute':'zone'},
            'entities': [
                {'attribute':'bypassed','name':'Bypassed'},
                {'attribute':'low_battery','name':'Low battery'},
                {'attribute':'tamper','name':'Tamper'}
            ],
            'show_state': false,
            'state_color': true
          }
        -}},
    {%- endfor %}
sort:
  method: attribute
  attribute: zone
  numeric: true

Check in fold-entity-row Docs (or in auto-entities Docs), there were examples.

Anybody have any idea? Maybe if I phrase my question differently.

Does anyone know how to use the response of an action (aka service) in template filter for auto-entities?

@thomasloven large system Bug… Auto-Entities card hangs / dies frequently. Especially when adding a Filter. The screen literally goes blank.

posted here…

I have over 3300 entities, so I suspect the code cant handle that. If/when I get the screen to show and Select a Property, and start entering a filter, like ā€˜RGB’ it hangs again and the screen goes completely blank. I must again click the browsers’ back button.

I have not been a coder in a long time but unless you have a different way to do the initial on-screen, I suggest disallowing the integration to instantiate any entity list if the resultant set is greater than a specific number… maybe 200 or something. On the initial add of a Filter (thus the list is unfiltered)… Keep the resultant set blank, thus requiring at least 1 Filter to be added. That should help with large systems.

Trying to add a Filter, screen blanks. If I click browser ā€˜back’, then it will show the screen…

Filter option added after above, then adding RGB text, hangs again…

When I get the screen to show, and the entities list (on the right) is empty because the Filter didnt return any values… responsiveness it as expected and I can enter/select everything just fine.

It is still unclear (at least for me) as to what you want, why ā€˜auto-entities’ ? Why not use a todo-list card or something else?

1 Like

anyone know how to modify the name of the buttons created?

I have tried Options for name:

{{ state_attr(entity, ā€˜friendly_name’) | replace(ā€˜RGB’, ā€˜ā€™) | trim }}

[[[ return entity.attributes.friendly_name.replace(ā€˜RGB’, ā€˜ā€™).trim(); ]]]

and a few other variations.

thx!

why dont you start with not entering a name for the resulting entities card? see what that gives.

I want to remove text from all the names. I know what it displays by default, which is why i want to remove the text.

I need help with making the code work

tbh, I dont understand what you are asking.

Maybe if you make a screenshot of a single item, and mark what you don’t want in it, and create a mockup of what you do want, we can help you

@Mariusthvdb looks like you were trying to do something similar years ago…

string.replace() … remove all the RGB letters in the strings

I have tried all of these (separately)…

    #name: {{state_attr(entity, ā€˜friendly_name’) | replace('RGB', ā€˜ā€™)}}

    #name: {{state_attr(entity, ā€˜friendly_name’) | replace('RGB', ā€˜ā€™) | replace(' - ', ' ')}}
    #name: {{return entity.attributes.friendly_name.replace(ā€˜RGB’, ā€˜ā€™); }}

    #name: {{ replace(ā€˜RGB’, ā€˜ā€™) }}

result…

What card are you using to produce the button(s)? I don’t think it’s auto-entities where you’ve posted this question.

right, I believe you’ve lost me completely.
I responded to

but now you say you need

?
if you keep changing your targets per post, no-one will we able to help you out… :wink:

I thought you were responding to my ask from yesterday. That post was 9 days ago :wink: … I never did figure out how to make the collapse inside the Auto-Entities header, I resorted to using a Title Card, which is not great but it works.

Current issue is easier to figure out, I hope… it should be simple but seems like HA complicates most simple stuff by forcing it to be some odd template format where non-normal code (jscript, etc) stuff doesnt work 100%.

thx for the help!

this is the code I’m trying to change the names on, to remove the RGB string…

type: custom:auto-entities
show_empty: false
card:
  type: grid
  columns: 1
  square: false
card_param: cards
filter:
  include:
    - domain: light
      name: "*RGB*"
      options:
        type: custom:slider-button-card
        compact: true
exclude: []
grid_options:
  columns: full
sort:
  method: friendly_name

This has nothing to with core Ha requirements . You have to follow the custom card requirements at hand. So if the embedded card uses Jinja or JS, that is what you need.
Card-mod uses Jinja . It all depends on the card and its use in the particular card config.

I don’t use that slider-card so can’t comment on that out of the box whether it supports templates at all

edit
briefly checking GitHub - mattieha/slider-button-card: A button card with integrated slider
I don’t think it does… which explains the [object Object]
you cant just make up config options that dont exist

Would mod-card work in this situation?

side note (small rant):
I like HA and how capable it is but seems as many (if not most) dashboard integrations are difficult to learn/build-with due to a general lack of standardization and built-in functions which all card integrations ā€˜should’ simply inherit from HA core. Maybe its a lack of APIs (I dont know)? Cards integrations should ā€˜by default’ have core features like : all text manipulations for title and buttons/entities (like naming in this specific example), fonts, card colors/borders/etc, nesting, title bar expand/collapse, etc. But it looks like each integration dev is creating features separately for each card integration, and not implementing things that just should be universal.

Every time I use a new card type, there seems they are often implemented very differently and have many and different ā€˜exceptions’…

  1. oh, you cant do XYZ with that card
  2. You can do that but in this case you need to place that code in features, not options
  3. Oh that one… yeah… turn your keyboard upside down, press ^, and recite this incantation in Latin the it will work! :rofl:

That card doesn’t support templates or changing the entity name.

Hi!
I use labels for devices for various reasons.
One is giving devices names that are easy to understand by my family and the other is to use them for filtering devices by tokens:


Labels 1
The following auto-entities card definition shows how it works:

type: custom:auto-entities
card:
  type: entities
  title: Lichter schalten
filter:
  template: >-
    {% set tokens = ['licht', 'lampe'] %} {% set matching_labels = labels() |
    select('search', tokens | join('|')) | list %} {% set devices =
    matching_labels | map('label_devices') | sum(start=[]) | list %} {% set
    entities = devices | map('device_entities') | sum(start=[]) | list %} {% set
    filtered_entities = entities | select('match',
    '^switch\.(?!.*_vch[0-9]+).*') | list %}

    [{% for entity in filtered_entities %} {"entity": "{{ entity }}", "name":
    "{{ label_name(labels(device_id(entity))[0]) }}"}{% if not loop.last %}, {%
    endif %}    {% endfor %}]

and how it comes out:

The only thing I’m missing ist using label-icons here to show up as string-lights, outdoor lights etc.
How can I do that. There is no function label_icon().

you are mixing up so many concepts here, (cards are not integrations etc, and ā€˜card integrations’ don’t even exist) I believe you should really get to grips with the main HA concepts first.

It is important to get those concepts right, before posting about them, as that is the best way to get help.

next, you should also understand HA does not control the many custom cards/integrations/plugins/what have you.

(given the fact you are around since 2017 I should really not have to state that, I am sure you are aware of the above)

So even though I can feel your frustration of having to configure each and every custom card differently, and have to adjust the syntax based on JS or Jinja, that is what it is, no way around that.

Not a lot of use ranting about that I am afraid.

Lastly, and already mentioned that, you can’t makeup things that are not supported.

You can try to find undocumented features (and yes, even core UI is not always as configurable as the yaml counterpart , so there are indeed differences there), but it is best to always follow the docs precisely.

1 Like

you can not set label icons in the auto0entities, because you can not set them at all… Auto-entities isnt some sort of wizard to change any frontend representation, it only feeds entities to the card you set it to consume…

having said that, I am not even sure I understand what you want, because label icons are not show in the dashboard at all? Only in the /config dashboards?