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

Does anybody know of a way to simply create a vertical list of areas with any of the stock cards?

image

The left most column should simply list the areas nameā€™s rather than the full sensor name (here just as place holder a glance card).

type: horizontal-stack
cards:
  - type: custom:auto-entities
    card:
      type: glance
      show_state: false
      show_icon: false
      columns: 1
    filter:
      include:
        - entity_id: sensor.eq3_temp*
      exclude: []
  - type: custom:auto-entities
    card:
      type: glance
      show_name: false
      show_icon: false
      columns: 1
    filter:
      include:
        - entity_id: sensor.eq3_temperature*
      exclude: []
  - type: custom:auto-entities
    card:
      type: glance
      show_name: false
      show_icon: false
      columns: 1
    filter:
      include:
        - entity_id: sensor.xiaomi_temperature*
      exclude: []
  - type: custom:auto-entities
    card:
      type: glance
      show_name: false
      show_icon: false
      columns: 1
    filter:
      include:
        - entity_id: sensor.xiaomi_humidity*
      exclude: []

Meanwhile I found it !
For people looking for an example of mushroom integration, he is mine :

type: vertical-stack
cards:
  - type: custom:mushroom-title-card
    subtitle: Batteries
  - type: custom:auto-entities
    sort:
      method: state
      numeric: true
    card:
      type: entities
    filter:
      include:
        - entity_id: '*battery_level*'
        - attributes:
            device_class: battery
            state_class: measurement
          options:
            type: custom:mushroom-template-card
            primary: '{{ states[''this.entity_id''].attributes.friendly_name }}'
            secondary: '{{ states[''this.entity_id''].state }}%'
            icon: >-
              {% set battery_level = states['this.entity_id'].state |float(0) %}
              {% set battery_round = (battery_level / 10) | int(0) * 10 %} {% if
              (battery_round >= 100) %}
                {{ 'mdi:battery' }}
              {% else %}
                {% if (battery_round > 0) %}
                  {{'mdi:battery-' ~ battery_round}}
                {% else %}
                  {{ 'mdi:battery-alert' }}
                {% endif %}
              {% endif %}
            icon_color: >-
              {% set battery_level = states['this.entity_id'].state |int(0) %}
              {% set battery_round = (battery_level / 10) | int(0) * 10 %} {% if
              (battery_level >= 50) %}
                {{ 'green' }}
              {% else %}
                {% if (battery_level > states('input_number.number_batterij_drempel') |int(0)) %}
                  {{'orange'}}
                {% else %}
                  {{ 'red' }}
                {% endif %}
              {% endif %}
            tap_action:
              action: none
            double_tap_action:
              action: none
      exclude:
        - attributes:
            friendly_name: '* Battery Level'
      sort:
        method: state
        numeric: true

2 Likes

why use the icon template? youā€™ve selected the device_class: battery, which does that for you
or doesnt the mushroom card show the core device_class? (asking since I dont use the Mushroom cards)

If you donā€™t specify an icon in a mushroom template card, none will be displayed

I see, thatā€™s not good :wink:

though I believe custom:card-button doesnt follow device_class either. pity really.

Did you figure out a way to hide hidden entities? As far as my research goes, there is still no template option (Access hidden entity status from template? - #5 by giorgos).

My workaround so far: I created a group with the hidden elements and excluded this within the auto-entities card.

No, I havenā€™t done anything with hidden entities - do not have them.
Your solution with a group seems to be OK. If the group may be created automatically - then it would be great.
Is there any way to determine the ā€œhiddenā€ flag in templates?

Is it possible to use auto-entities with Mushroom Chips cards? The mushroom chip card expects a single entity parameter rather than a list of entities. Auto entities would have to create a separate card for each entity in the list.

Looking for some help - I want a card to show if any devices are playing plex. This is what I have so far.
Things I am looking to add. Sort in order by device name, test implementing with mini media player, Title of movie/show playing. Or looking for what others are doing for this.

type: custom:auto-entities
card:
 type: entities
filter:
 include:
  - entity_id: media_player.plex_*
   state: /playing|paused|'on'/

Canā€™t help with the rest, not using media_player, but there is a sort option for auto-entities.
options - sort:

@all:
Can anybody think of a way of checking how many entities are being auto created by auto-entities? I would like to make some cards conditional on the amount of entities to be displayed.
Auto-entities does seem to have an internal counter that can be used for count: but I cannot see how to access it in Javascript.

I have problems wrapping my head around this simple task. Instead of displaying ā€œstateā€ in the Glance-card, I want to display the ā€œshow_last_changedā€ or ā€œlast-changedā€ (custom:auto-entities) for all entities showing up in the card.
Any ideas?

type: custom:auto-entities
show_empty: false
sort:
  method: name
card:
  type: glance
  show_state: false
filter:
  include:
    - entity_id: binary_sensor.window_sensor*_access_control
      state: 'on'
    - entity_id: light.dimmer_*
      state: 'on'
#      options:
#        secondary_info: last-changed ???
    - entity_id: binary_sensor.smoke_detector*_smoke_alarm_smoke_detected
      state: 'on'
    - entity_id: binary_sensor.flood_sensor*_water_alarm_water_leak_detected
      state: 'on'

If filterering is done by using a ā€œtemplateā€ option, then a count of filtered items may be calculated.

  1. Remove ā€œshow_state: falseā€ - it prevents displaying ā€œlast-changedā€.
  2. If you need a ā€œlast-changedā€ displayed for every item (not only ā€œlightā€) then the ā€œoptionsā€ must be specified for each item.
  3. Use ā€œshow_last_changed: trueā€ instead of what you wrote (it is unsupported).
1 Like

Filtering is done using include/exclude.

That was an answerā€¦ You cannot define a count unless you filter it manually.

Manually with a template? So the card does not even internally count the amount of entities?

Dunno. If it does - an average user cannot access this info. Does the Entities card publish anywhere a number of rows included? No.

Yes.

1 Like

I was hoping that it would be possible to either access the internal count number or maybe count something like ā€œfor s in seriesā€ or something, i.e. get the number of series that are being plotted. Something like that.

I have a printer that has multiple color inks. They are used to print ā€˜professionalā€™ pictures.

I am successfully displaying the various ink color levels, sorted properly, lowest on top using the Auto-Entities card. I am delighted as I no longer have to guess which ink I have to order.

Two features I would like to add, I just cannot seem to figure out how.

  1. Is there a way to set a level (say 20%) where the icon display changes color?

  2. Is there a way to reduce the displayed entity string (using regex?) as the actual color does not show in mobile, it is too long.

I was trying to figure out how option is used but could not figure it. :confused:

This is what I have now.

type: custom:auto-entities
card:
  type: entities
  title: Epson Color ink status
entities:
  - entity: sensor.epson_xp_15000_series
filter:
  include:
    - entity_id: /.*epson_xp_15000_series_.*$/
sort:
  method: state
  reverse: false
  numeric: true
show_empty: true

Left is how it looks on desktop, while right is on the phone.

Again, thank you for an excellent card!

Kind of this:

    - entity_id: ...
      options:
        card_mod:
          style: |
            :host {
              {% if states(config.entity) ..... %}
                place here your styles
              {% endif %}
            }

This may only be achieved by using a ā€œtemplateā€ option. Check for examples here.