šŸ”¹ 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:

That did not work, but good news! ScottG on the discord helped me work through the options to get a working version! For all those struggling to get Auto Entities to work with Mushroom Chips, here is a working code block:

type: custom:auto-entities
show_empty: true
card_param: chips
card:
  type: custom:mushroom-chips-card
  alignment: justify
filter:
  include:
    - domain: scene
      area: Living Room
      options:
        type: entity
        content_info: name
        tap-action:
          action: toggle
  exclude: []
sort:
  method: friendly_name

Here were my mistakes, in order:

  1. Options are your friend for the auto entities card. For scenes to work, the chips must be of the entity variety, and I really recommend having the name
  2. You really want to use the tap_action: action: toggle blurb. This has to be separate lines! ScottG pointed out I was trying to make tap_action: toggle work when in the chips card it is passed as an object, not as a string (therefor the action part must be indented on the line below)

I hope this helps, and if it does, you should buy Scott a coffee:

cant be.
the config I posted works fine.
ofc all choices you can make have an effect, so yes, using the content_info: name adds the name in stead of the state.
setting a tap action other than default makes a difference.

as long as you use the magic card_param to populate the correct parameter in the auto-entities config, and set a few options of your choice, you should be good. as I suggested here

Hi , I need help with auto entities and the Maxi media player card. I do not if itā€™s posible but I would like to show the correctly playing media player. With mini media player I have no problem. I made a group of media players and with auto entities I show the currently player one but I,m not able to do it with the Maxy media player card.

This is the code I use for mini media player and I do no know how adapt it to Maxi media player. Any help will be appreciated.

    - type: custom:auto-entities
      card:
        type: entities
        show_header_toggle: false
      filter:
        include:
          - domain: media_player
            state: playing
            group: media_player.media_salon
            options:
              artwork: full-cover-fit
              hide:
                power: true
                icon: true
                source: true
                progress: false
                volume: true
                controls: true
                name: false
                info: false
              type: custom:mini-media-player
        exclude: []
      sort:
        method: last_changed
        count: 1
        numeric: true
        reverse: true
        show_empty: true
      else:
        type: picture
        image: /local/stand-by-tv-card.jpg
        tap_action:
          action: none
        hold_action:
          action: none

did you test it without any of the configuration options, and only set options to use the maxi-media-player card?

next step would be to add any of the config options you require it supports, not just copy and past options from another card

Yes I tried but show no supported players found

Sorry the code as image Iā€™m on my phone and I cant paste clean code on iOS, all with strange characters