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

no your using a grid of tiles :wink:

and the tile you want it the tile of the grid?
that can be done easily, although with a bit of an extra effort (using card-mod 3.4.5) as grids dont have a ha-card element, you need to use the integrated custom:mod-card for that.

Search for that in the card-mod thread and see an example here and then find the right element in the Inspector for the title to target in your mod

Thanks Marius for your help.

What I want to accomplish is that the auto-entities-grid card has a header above it (type: heading / variant: title), but I only want it to be visible when the auto-entities actually have something to show.

Using the code inspector, the title I am aiming for is in hui-heading-card.

I found a workaround (cfr code below). It works, but I don’t like the fact that I am actually duplicating my filters.

type: vertical-stack
cards:
  - type: custom:auto-entities
    show_empty: false
    unique: true
    limit: 1
    card:
      type: heading
      heading: Verwarming actief
      variant: title
    card_param: card
    filter:
      include:
        - options: {}
          domain: climate
      exclude:
        - options: {}
          entity_id: climate.dries_hvac_climate_system
        - options: {}
          entity_id: climate.diyless_thermostat_1_heating_manual_mode
        - options: {}
          entity_id: climate.dries_climate
        - options: {}
          domain: climate
          attributes:
            hvac_action: "off"
        - options: {}
          domain: climate
          attributes:
            hvac_action: idle
        - options: {}
          area: hidir_eerste_verdieping
        - options: {}
          area: hidir_gelijkvloers
  - type: custom:auto-entities
    show_empty: false
    card:
      type: grid
      square: false
      columns: 1
    card_param: cards
    sort:
      method: name
    filter:
      include:
        - domain: climate
          options:
            type: tile
            state_content: last_updated
            entity: this.entity_id
      exclude:
        - entity_id: climate.dries_hvac_climate_system
        - entity_id: climate.diyless_thermostat_1_heating_manual_mode
        - entity_id: climate.dries_climate
        - domain: climate
          attributes:
            hvac_action: "off"
        - domain: climate
          attributes:
            hvac_action: idle
        - area: hidir_eerste_verdieping
        - area: hidir_gelijkvloers

yeah, but that is not what I suggested. I suggested to mod the title element of the grid card, but adding a type:heading might be an even better idea

for starters, you now have the heading card in an auto-entities, which does nothing:

just make that to

and next add the auto-entities.

this way you can prevent that from happening.
you can set a visibility on the vertical-stack

btw dont use variant, but heading_style: title or better, leave it out, as that is the default :wink:

What do you mean with ā€œdoes nothingā€? By duplicating the auto-entities filter, both the heading-title as the underlying tiles appear/disappear when needs.

If I take the heading outside auto-entities, I could indeed work with visibility-conditions. But the condition would need to be ā€œwhen auto-entities do not have any tile to show, don’t show the headerā€. And I don’t know how to do that (besides duplicating my auto-entities filter).

Thanks for your help. I am getting there. :slight_smile:

as you can see in my first screenshot, there are no populated cards with that code, except for the heading
I have quite a few climate entities, and in a correct config they would have showed up

the condition would have to be when any climate entity is active… Or so I understood your configuration
1 simple helper (binary_sensor) would suffice

Strange. That behaviour is different here. If there is one entity visible (cfr screenshot), I see both the header and the tile.
image
When no entities are shown, the header also dissappears.

You’re right. I can also try it this way.

can you create a new card with only this:

type: custom:auto-entities
show_empty: true
card:
  type: heading
  heading: Verwarming actief
  # variant: title #dont use this as it is not correct option, should be `heading_style`
card_param: card
filter:
  include:
    - options: {}
      domain: climate

and post the result in the view?

Result:


(currently, no climate entities are active)

So in this scenario, the header does show (in line with your experience).

But the other entity (cfr my YAML earlier) is not showing.

I don’t understand the different behaviour myself.

it isnt, it is exactly the same… this code is what you have yourself and it will only show the header, no matter the state of any climate entity,

that is why you can (should) take this out of an auto-entities config and use it stand alone (combined with the visibility option on the vertical-stack)

also, in the full config you posted above, there is a single inclusion state=ā€˜on’…

Scenario 1: one climate entity is active. The climate entity is shown, and also the header:

Scenario 2: no climate entities are active. Also the header is hidden (which is good):

Scenario 3: multiple climate entities are active:

So all three scenario’s behave as how I want it. So the header is shown/not shown when needed.

This is good, right?

1 Like

if that is what you are after sure, looking good

post the yaml for that please?

type: vertical-stack
cards:
  - type: custom:auto-entities
    show_empty: false
    unique: true
    limit: 1
    card:
      type: heading
      heading: Verwarming actief
      variant: title
    card_param: card
    filter:
      include:
        - options: {}
          domain: climate
      exclude:
        - options: {}
          entity_id: climate.dries_hvac_climate_system
        - options: {}
          entity_id: climate.diyless_thermostat_1_heating_manual_mode
        - options: {}
          entity_id: climate.dries_climate
        - options: {}
          domain: climate
          attributes:
            hvac_action: "off"
        - options: {}
          domain: climate
          attributes:
            hvac_action: idle
        - options: {}
          area: hidir_eerste_verdieping
        - options: {}
          area: hidir_gelijkvloers
  - type: custom:auto-entities
    show_empty: false
    card:
      type: grid
      square: false
      columns: 1
    card_param: cards
    sort:
      method: name
    filter:
      include:
        - domain: climate
          options:
            type: tile
            state_content: last_updated
            entity: this.entity_id
      exclude:
        - entity_id: climate.dries_hvac_climate_system
        - entity_id: climate.diyless_thermostat_1_heating_manual_mode
        - entity_id: climate.dries_climate
        - domain: climate
          attributes:
            hvac_action: "off"
        - domain: climate
          attributes:
            hvac_action: idle
        - area: hidir_eerste_verdieping
        - area: hidir_gelijkvloers

what is that?

Something that shouldn’t be there. :sweat_smile:
I just deleted it.

why not

        - domain: climate
          attributes:
            hvac_action: "on"

You are right, I could define ā€œinclude : onā€ instead of ā€œexclude : off/idleā€.

But don’t worry, in real life I’m really an inclusive person. :wink:

ok so now clean that up (only in Yaml mode, not for the UI unfortunately):

type: vertical-stack
cards:
  - type: custom:auto-entities
    show_empty: false
    unique: true
    limit: 1
    card:
      type: heading
      heading: Verwarming actief
    card_param: card
    filter: &filter
      include:
        - domain: climate
          attributes:
            hvac_action: "on"
      exclude:
        - entity_id: climate.dries_hvac_climate_system
        - entity_id: climate.diyless_thermostat_1_heating_manual_mode
        - entity_id: climate.dries_climate
        - area: hidir_eerste_verdieping
        - area: hidir_gelijkvloers
  - type: custom:auto-entities
    show_empty: false
    card:
      type: grid
      square: false
      columns: 1
    card_param: cards
    sort:
      method: name
    filter: *filter

I still find it a bit cumbersome to use the top AE card for the header like that, although I can see why you did it, using only AE options.

Thanks for helping me out. And that YAML looks much better.

Some things I noticed:

  • hvac_action: ā€œonā€ should be hvac_action: ā€œheatingā€ apparantly (I forgot this myself). And you have many types of hvac actions (cooling,…). So that why probably I initially chose to exclude some states;
  • After forementioned adjustment, I get this:
  • I saw a ā€œfilter: &filterā€ in your YAML, and a reference to that further down the YAML. And that is very neat. It avoids duplication. But if I apply it, save it and reopen the YAML, it seems that the filter is automatically duplicated by Home Assistant.
  • Additionally, the general clean-up is counteracted by HA after saving it. E.g. the exclude section has again changed to:
       exclude:
        - options: {}
          entity_id: climate.dries_hvac_climate_system
        - options: {}
          entity_id: climate.diyless_thermostat_1_heating_manual_mode

So this is now a (working) end-result:

type: vertical-stack
cards:
  - type: custom:auto-entities
    show_empty: false
    unique: true
    limit: 1
    card:
      type: heading
      heading: Verwarming actief
    card_param: card
    filter:
      include:
        - options: {}
          domain: climate
          attributes:
            hvac_action: heating
        - options: {}
          domain: climate
          attributes:
            hvac_action: cooling
      exclude:
        - options: {}
          entity_id: climate.dries_hvac_climate_system
        - options: {}
          entity_id: climate.diyless_thermostat_1_heating_manual_mode
        - options: {}
          entity_id: climate.dries_climate
        - options: {}
          area: hidir_eerste_verdieping
        - options: {}
          area: hidir_gelijkvloers
  - type: custom:auto-entities
    show_empty: false
    card:
      type: grid
      square: false
      columns: 1
    card_param: cards
    sort:
      method: name
    filter:
      include:
        - domain: climate
          attributes:
            hvac_action: heating
          options:
            type: tile
            state_content: last_updated
            entity: this.entity_id
        - domain: climate
          attributes:
            hvac_action: cooling
          options:
            type: tile
            state_content: last_updated
            entity: this.entity_id
      exclude:
        - entity_id: climate.dries_hvac_climate_system
        - entity_id: climate.diyless_thermostat_1_heating_manual_mode
        - entity_id: climate.dries_climate
        - area: hidir_eerste_verdieping
        - area: hidir_gelijkvloers

yeah as said, only in Yaml mode, not in UI editor

still its odd you have this in the first auto-entities

and

      exclude:
        - entity_id: climate.dries_hvac_climate_system

in the second

also, the

seems un documented… would be cool though

you can use:

sort:
  count: 1

though

Correct. HA is doing this, not me.

Not sure why it was there, but it is gone now. :slight_smile: