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

Hi together,

I use auto-entities in different parts in my dashboard. E.g. I used it to display lights and waste collection. I also use custom:grid-layout. And there is the problem. On a desktop, everything looks good, but If I look on a mobile device or a Tablet it looks like this:


Is it possible to get both functions work and look good?

Thanks for help!
Dominik

You wrote ā€œit looks badā€ but has not specified what is exactly ā€œbadā€, the ā€œgood looking pictureā€ is not provided too. Not to mention absence of MWE.

On the desktop it looks like this:

I have this custom:grid-layout configured:

- type: custom:grid-layout
    title: _living_room
    path: 1
    square: false
    layout:
      #default
      grid-gap: 1px 1px
      grid-template-columns: repeat(4, 1fr)
      grid-template-rows: auto
      grid-template-areas: |
        "  chips  chips  chips  chips  "
        "  t1     t1     t1     t1     "
        "  l1     l1     l1     l1     "
        "  t2     t2     t2     t2     "
        "  k2     k2     k2     k2     "
        "  t3     t3     t3     t3     "
        "  m1     m2     m3     .      "
        "  m4     m5     .      .      "
        "  t4     t4     t4     t4     "
        "  dw1    dw1    dw1    dw1    "
        "  t5     t5     t5     t5     "
        "  b1     b1     b1     b1     "
      mediaquery:
        #phone
        "(max-width: 800px)":
          grid-gap: 1px 1px
          grid-template-columns: repeat(2, 1fr)
          grid-template-areas: |
            "  chips  chips  "
            "  t1     t1     "
            "  l1     l1     "
            "  t2     t2     "
            "  k2     k2     "
            "  t3     t3     "
            "  m1     m2     "
            "  m3     .      "
            "  m4     m5     "
            "  t4     t4     "
            "  dw1    dw1    "
            "  t5     t5     "
            "  b1     b1     "
        #portrait
        "(max-width: 1200px)":
          grid-gap: 1px 1px
          grid-template-columns: repeat(3, 1fr)
          grid-template-areas: |
            "  chips  chips  chips  "
            "  t1     t1     t1     "
            "  l1     l2     l3     "
            "  t2     t2     t2     "
            "  k2     k2     k2     "
            "  t3     t3     t3     "
            "  m1     m2     m3     "
            "  m4     m5     .      "
            "  t4     t4     t4     "
            "  dw1    dw1    dw1    "
            "  t5     t5     t5     "
            "  b1     b1     b1     "

And this is the displayed section of the lights:

- type: custom:auto-entities
        card:
          type: grid
          #columns: 4
          column_width: 50%
          square: false
        card_param: cards
        filter:
          include:
            - domain: light
              area: wohnzimmer
              options:
                type: custom:button-card
                template: card_light
                variables:
                  ulm_card_light_enable_color: true
                  ulm_card_light_enable_slider: true
                  ulm_card_light_enable_collapse: true
                  ulm_card_light_force_background_color: true
                  ulm_card_light_enable_popup: true
        view_layout:
          grid-area: l1

On mobile it should look like this (2 columns) and on Tablet in three columns:

So, this is a not an auto-entities issue, this is about layout-card.

1 Like

Sorry to bring up a very old comment but I would like to do what ha_popbox was wanting to achieve however I canā€™t simply use template sensors as the entity_idā€™s are dynamic. (once a parcel has been delivered I remove it from SeventeenTrack, likewise any new parcel is added as has a new entity_id)

I use the SeventeenTrack integration to track parcels and this creates an entity for each parcel and as such the entity_id has the parcel description in it, which obviously changes with each parcel I tell it to track.

I currently use auto-entities to generate a card showing the incoming parcels by way of using wildcards and this shows the parcels, but as ha_popbox said, it gives the state, not an attribute. Iā€™d like to show a particular attribute of each entity.

Current code
title: Parcel Tracking
type: custom:stack-in-card
cards:
  - type: custom:auto-entities
    card:
      type: entities
    filter:
      include:
        - entity_id: sensor.seventeen*
          state: In Transit
      exclude: []
  - type: custom:auto-entities
    card:
      type: entities
    filter:
      include:
        - entity_id: sensor.seventeen*
          state: Not Found
      exclude: []
  - type: custom:auto-entities
    card:
      type: entities
    filter:
      include:
        - entity_id: sensor.seventeen*
          state: Delivered
      exclude: []

Card view:
image

Entity:

Iā€™d like it to show the attribute called ā€˜into_textā€™ rather than the state.

Is this possible? I see that the standard HA entities card allows for showing an attribute but Iā€™m not sure if / how I can use auto-entities to generate the list of entities for that card.

Is there a way to mix this card with custom:entity-attributes-card ?

        - entity_id: sensor.seventeen*
          state: Not Found
          options:
            type: attribute
            attribute: xxxx

In case of many parcels it is better to combine auto-entities with flex-table-card - then you may display even more attributes in a compact way.

1 Like

Is that options: code supposed to be in the auto-entities card like this below?

title: Parcel Tracking
type: custom:stack-in-card
cards:
  - type: custom:auto-entities
    card:
      type: entities
    filter:
      include:
        - entity_id: sensor.seventeen*
          state: In Transit
      exclude: []
    options:
      type: attribute
      attribute: info_text
  - type: custom:auto-entities
    card:
      type: entities
    filter:
      include:
        - entity_id: sensor.seventeen*
          state: Not Found
      exclude: []
    options:
      type: attribute
      attribute: info_text
  - type: custom:auto-entities
    card:
      type: entities
    filter:
      include:
        - entity_id: sensor.seventeen*
          state: Delivered
      exclude: []
    options:
      type: attribute
      attribute: info_text

ā€¦because that didnā€™t change the look of the card at all, still just seeing it list the ā€˜statesā€™.

Thanks, Iā€™ll look into this card.

No, check this.
Each filter may have its own set of options.

Thanks. I fixed it up so itā€™s now:

code
title: Parcel Tracking
type: custom:stack-in-card
cards:
  - type: custom:auto-entities
    card:
      type: entities
    filter:
      include:
        - entity_id: sensor.seventeen*
          state: In Transit
          options:
            type: attribute
            attribute: info_text
      exclude: []
  - type: custom:auto-entities
    card:
      type: entities
    filter:
      include:
        - entity_id: sensor.seventeen*
          state: Not Found
          options:
            type: attribute
            attribute: info_text
      exclude: []
  - type: custom:auto-entities
    card:
      type: entities
    filter:
      include:
        - entity_id: sensor.seventeen*
          state: Delivered
          options:
            type: attribute
            attribute: info_text
      exclude: []

ā€¦which works, however due to the length of the entity_id it gets cut off when the card displays it. Is there a way to remove part of the entity_id or even replace it with the text from another attribute?

image

Ideally Iā€™d like to remove ā€˜seventeentrack packageā€™ from what is displayed so it only shows the description, then the info_text from the attribute.

If an entity has a friendly_name - it will be displayed instead.
Or you may want to display a custom name like ā€œParcel from Tokyoā€ composed from attributes / entity_id - this may be achieved by using a ā€œtemplateā€ option, look for examples in the thread.

Yeah sorry, it is actually a very long friendly name.

Then extract a significant part from the name and show it instead.

Or you may reconsider a design:
ā€“ long name - as a ā€œnameā€
ā€“ state (which seems to be long too) - as a ā€œsecondary_infoā€
ā€“ last_changed - as a state
inside a template-entity-row

Hi,

Is there a way to use images insteat of icons in de auto-enitities card?

Now have this (Auto-Entities)

afbeelding

My wish:

afbeelding

There is but itā€™s completely unrelated to the auto-entities card. You can set the images above as an entity_picture for each of the entities. Look here for more info.

1 Like

This code shows a list of persons:

type: custom:auto-entities
card:
  type: entities
filter:
  include:
    - domain: person

Assume that each ā€œpersonā€ entity has an ā€œentity_pictureā€ attribute specified (via ā€œcustomizeā€) - then an image will be displayed for this row instead of an icon.
Otherwise - an icon is specified (at least for persons w/o present ā€œentity_pictureā€).

You may change it like:

type: custom:auto-entities
card:
  type: entities
filter:
  include:
    - domain: person
      options:
        icon: mdi:car

then a ā€œmdi:carā€ icon is displayed for each row.

This code overrides an image for every row to some fixed one:

type: custom:auto-entities
card:
  type: entities
filter:
  include:
    - domain: person
      options:
        image: /local/images/devices/ups_sua1500i.png

then the same ā€œUPSā€ image is displayed for each row.

This code overrides an image for every row to some individual one:

type: custom:auto-entities
card:
  type: entities
filter:
  template: >-
    {% for ENTITY in ..... -%}
      {{
        {
          'entity': ENTITY,
          'image': .....
        }
      }},
    {%- endfor %}

This code disables showing available images:

type: custom:auto-entities
card:
  type: entities
filter:
  include:
    - domain: person
      options:
        image: null

then a default ā€œmdi:accountā€ is displayed for every row.

If some entity must be displayed in many places with an image and there is only one place where I want to show an icon:
ā€“ then I specify an ā€œentity_pictureā€,
ā€“ and this picture is displayed everywhere (including any card with ā€œauto-entitiesā€),
ā€“ and for one place (some card) I need to specify something like ā€œimage: nullā€ (as shown above) to disable the image.

If some entity must be displayed in many places with an icon and there is only one place where I want to show an image:
ā€“ then I do not specify an ā€œentity_pictureā€,
ā€“ and an icon is displayed everywhere (including any card with ā€œauto-entitiesā€),
ā€“ and for one place (some card) I need to specify something like ā€œimage: xxxxxxxxxxā€ to show the image.

1 Like

Thank you, learned something!

1 Like

Triple thankyou :smile: That works!
I was playing around because you metioned the ā€œoptionā€ on github but I think I made a mistake with the placement of the lines.

Iā€™m not exactly sure when it stopped working, so apologies if I have missed something in the last few releasesā€¦ I have just noticed that two of my sensors are no longer appearing in my auto entities list. They were both limited to be equal to or less than 7 days, so only the next upcoming bin collection was displayed. Ie. Green or Recycling. Here is the code:

          filter:
            include:
            - entity_id: sensor.anniversary*
            - entity_id: sensor.recycling
              attributes:
                days: "<= 7"
            - entity_id: sensor.green
              attributes:
                days: "<= 7"
          sort:
            method: state
            numeric: true
            count: 6

Anyone have an idea what would have stopped it from working and what I can change to get it back?

A similar code works, check your sensors.


Thanks for the reply @Ildar_Gabdullin. It must be the way the sensor is reporting what the value is. I must have to change the word ā€œdaysā€ instead, just have to work out what to!

2022-08-01.screenshot (1)