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

@stephanschleichstr13 not sure why youā€™re tagging me, but you are missing a comma at the end of the name line

sorry for that, i tagged you because i saw it in your example :slight_smile:
The comma fixed it thank you.

Pulling my hair out a bit but think I may be missing something obvious.

Iā€™m trying to get a card that functions as follows:

A vertical stack containing a mushroom title card and an auto-entities card. When the auto-entities card is empty, the whole vertical stack should be hidden.

Any ideas as to how I can achieve this?

Possible solutions:

  1. Use a ā€œtemplateā€ option which contains a code for that mushroom card + code for a card with generated list. (could be rather cumbersome)
  2. Use card-mod to hide the whole stack: if list is empty ā†’ hide.
1 Like

depending on your auto-entities include filter/template, my suggestion would be to use a type: conditional and show/hide the stack based on that condition.

if youā€™d provide us with something to go on (what is your include filter) , we could actually help you :wink:

1 Like

Yep apologies @Mariusthvdb I was a bit vague.

This is the card I have at the moment which shows lights that are on in the office:

type: vertical-stack
cards:
  - type: custom:mushroom-title-card
    subtitle: Office
  - type: custom:auto-entities
    filter:
      include:
        - domain: light
          area: office
          state: 'on'
          options:
            tap_action:
              action: toggle
            type: glance
            entities:
              - this.entity_id
      exclude: []
    show_empty: false
    card:
      show_name: true
      show_icon: true
      show_state: true
      type: glance
      columns: 2

It returns a card that looks like this:
image

So I would like to hide the whole card including the subtitle.

My difficulty with your suggestion is that I donā€™t know what the condition would be. I suppose I could count the entities returned by my filter and save them to a helper, which would then be referenced by a conditional card?

Perhaps Iā€™m overcomplicating it with the vertical stack and can add a customisable title some other way?

this would be the template for the card: lights in the office are on.

{{area_entities('office')
  |select('match','light')
  |select('is_state','on')|list}}

You might even have a light.office without knowing it. If not, itā€™s easily created either as a template entity (see Ildar suggestion) or as a binary. Or a light even.

Ofc I can not comment on this being a good solution or not. If it is what you want, then just make it. simple as that

you mean something like this?:

again, that is possible yes, and requires some templating in JavaScript (as this is a custom:button-card).

In the end it only depends on what you want.

1 Like

with your help I landed on this configuration which works exactly as I hoped

type: vertical-stack
cards:
  - type: custom:mushroom-title-card
    subtitle: Office
  - type: custom:auto-entities
    filter:
      include:
        - domain: light
          area: office
          state: 'on'
          options:
            tap_action:
              action: toggle
            type: glance
            entities:
              - this.entity_id
      exclude: []
    show_empty: true
    card:
      type: custom:layout-card
      layout: custom:vertical-layout
visibility:
  - condition: template
    value_template: >
      {{ (area_entities('office') | select('match','light') |
      select('is_state','on') | list) | length > 0 }}
    state: 'True'

thank you!

1 Like

I really want the Mushroom Chips card to work for scenes. Now that we can use sections to filter for rooms I am not going to bother with using the selector like I was trying to do when I asked about this last year.

Here is the code I have:

type: custom:auto-entities
filter:
  include:
    - domain: scene
      area: Living room
  exclude: []
sort:
  method: friendly_name
card:
  type: custom:mushroom-chips-card
show_empty: true
card_param: chips

What am I missing for this to work?

try:

type: custom:auto-entities
card:
  type: custom:mushroom-chips-card
filter:
  include:
    - domain: scene
      area: dorm # replace with your area id
      options:
        type: light
card_param: chips
sort:
  method: friendly_name

I admit this was a terrible thing to test, and it seems to suffer the same lag as I experience using the new label option. Practically unusable.

However, I believe you should add the options: field with the type.

it will end up like this:

so not yet card_modded, or even repeating the icons I have customized for the scenesā€¦

which probably is a mushroom bug, as the icons are set using core customize, and should show like this:

is there a way to show the Device names per area? not entities by the actual device name? Im trying to use the new labels option in the drop down but nothing i type is working?

post what youā€™ve tried, and post screenshots of the name you want to show.

be careful to use the new label option, it is a real dashboard killer.
If you want to use labels, youā€™re better off using them in a template filter

There is no card for displaying a device.
You may only list devices in markdown (w/o auto-entities).
Kind of this (could be optimized for sure):

{% for AREA_ID in areas() -%}
  {%- if area_devices(AREA_ID) |count > 0 -%}
    Area: {{area_name(AREA_ID)}}
    {% for DEVICE_ID in area_devices(AREA_ID) -%}
      {{device_attr(DEVICE_ID,'name')}}
    {% endfor %}
  {% endif -%}
{%- endfor %}
1 Like

yeah ok i got that already, just checking, thanks for the reply :slight_smile: