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

Auto-entities can be used with any card that uses entities: (as opposed to entity:).

However - layout-card can take an entities: option and turn that into once card per itemā€¦ (see bottom of the readme).

1 Like

Yes your documentation was quite clear on the entities stuff (that is why I asked). I hadnā€™t looked into layout-card yet and I certainly didnā€™t know about this feature. Thanks again, I will take a look into this. It might be what I was looking for. A friend of mine is actually making something of this sort I believe. You might have heard of him (@dwains). But this will help me out for the time being.

Anyways thanks again for your awesome work/help.

This quite recent feature in monster-card comes from a contribution/PR iā€™ve made. Nice to see youā€™ve implemented it back in Auto-entites, thanks !
Iā€™ll look your documentation deeper to switch from all my monster-cards to your new one.

1 Like

Thx for this plugin!
I noticed that in case of using Edge as browser the card doesnt load and gives an error : Custom element doesnā€™t exist: auto-entities.

In Chrome everything works fine.
Is this a known issue?

yes, Edge is a known issue itself :smiley:

2 Likes

Looks amazing! Can you please your code ?

Thank you!

Shure, no probleme.
here you are:

cards:
  - content: |
      # Batteriestatus:
    type: markdown
  - card:
      show_header_toggle: false
      type: entities
    filter:
      exclude:
        - entity_id: '*battery_state*'
      include:
        - entity_id: '*battery*'
    show_empty: false
    sort:
      method: name
      numeric: true
    type: 'custom:auto-entities'
id: card_batterylow
type: vertical-stack

You might have to play with the include and exlude filter to get your best results.

Withā€¦

    sort:
      method: state
      numeric: true
      reverse: true

ā€¦you get the sorting from the screenshot.

1 Like

Unfortunately, I canā€™t easily test or debug in Edge, since Iā€™m a mac user, and the mac version uses the chromium engineā€¦

2 Likes

making use of this very nice card, I do wonder what the default sort order is (ie when one doesnā€™t use sort: in the card config).

My entities are listed in a way I donā€™t recognize to be alphabetical, or by the config in the backend at all, nor by state or order in the group they auto-populate, well, by anything reallyā€¦

Would be cool to understand how and why they are listed as they are:

this is the card config for the Switches cl:

      - type: custom:fold-entity-row
        head:
          type: section
          label: Switches cl
        entities:
          - type: custom:auto-entities
            card:
              type: entities
              show_header_toggle: false
            filter:
              include:
                - entity_id: 'switch.*_cl'
                  options:
                    secondary_info: last-changed

26

or

secondly, if Id like the entities of

      - type: custom:fold-entity-row
        head:
          type: section
          label: Lights
        entities:
          - type: custom:auto-entities
            card:
              type: entities
              show_header_toggle: false
            filter:
              include:
                - group: 'group.all_lights_only'
                  options:
                    secondary_info: last-changed

to be sorted according to the group order, what would be the correct sort config?

all_lights_only:
  name: All lights only
  icon: mdi:lightbulb-outline
  entities:
# Philips_Hue_lights
    - light.backdoor_outdoors
    - light.gate_outdoors
    - light.porch_outdoors
    - light.laundry_ceiling
    - light.dining_corner
    - light.symfonisk
    - light.dining_table_lamp_1
    - light.dining_table_lamp_2
    - light.dining_table_lamp_3
    - light.kist
    - light.cabinet
    - light.serre_chair
    - light.lounge_chair_regular
etc
etc
etc

Ive filed a FR to add last-triggered to the sort options, which would be way cool to auto generate a card with the most active automations and scripts, and be a magic tool for the inspection of the system. Hope you will consider.

First of all, you are using fold-entity-row and auto-entities the ā€œwrongā€ way (with the disclaimer that ā€œif itā€™s stupid and it works, itā€™s not stupidā€ - thereā€™s no actually wrong way).

They are both specificlaly designed to work like

- type: custom:auto-entities
  card:
    type: custom:fold-entity-row
    head:
      type: section
      label: Lights
  filter:
    .. etc...

Edit: I must say your way looks really good, though.

Second; last triggered is an attribute of the script, as opposed to last_changed and last_updated which are ā€œmagicalā€ values. You can already sort by attribute values.

On to your question.
The order the entities show up in if not sorted is the same they are given in the "hass object", which is pretty much your current Home Assistant state. It depends a bit on your python, version, the order your integrations are loaded in, the order things are set up in your configuration and which sign of the zodiac Jupiter is currently in. In short, think of it as random.

If you use a group, the entities should show up in the same order they are listed in the group definition, but I canā€™t guarantee it.

1 Like

Hahaha! The sorting options are awesome as is this card. Really appreciate your great work Thomas.

haha, yes, that was my conclusionā€¦ thanks for confirming.

of course! thanksā€¦

this doesnt work though:

  - type: custom:auto-entities
    card:
      type: entities
      title: All Automations auto
      show_header_toggle: false
    filter:
      include:
        - domain: automation
          options:
            secondary_info: last-triggered
    sort:
      attribute: last_triggered

well, I hoped, but as you can see it isnā€™t the case. Sorted them by name for now, which at least has some eye candy, but group order would really be better, since they can be sub-ordered in the group without having to create separate groups.

cool, didnā€™t realize I did it the wrong way. Still, Iā€™ll try it the correct way, and see if it changes the issues I have :wink:
thanks for reporting back!

well it does make a difference, and in fact a significant one. Not in the order of the entities, but in the way it is rendered in the frontend:

my way:

your way:

39

have to think why this is happening, but, maybe good to realize the difference and make good use of it. Must admit I kind of like the elevated group popping out of the fold as an extra emphasis. But, as you say, not as per original design :wink:

Does it exist a way to use the auto-entities to show only the lights and sensors with an state = unavailable?

@thomasloven I tried to moved from monster-card to auto-entities but I have an issue with Boolean attribute. The following card was working with monster-card, but not with auto-entites:

EDIT: the latest version fixed the issue, thanks !

card:
  type: glance
filter:
  exclude:
    - state: 'off'
    - state: unavailable
    - entity_id: '*group*'
    - attributes:
        is_deconz_group: false
  include:
    - domain: light
      options:
        tap_action:
          action: toggle
show_empty: false
type: 'custom:auto-entities'

@gmario Iā€™m using the following to get unavailable entities:

card:
  type: glance
filter:
  exclude:
    - state: 'off'
    - state: 'on'
    - entity_id: '*group*'
    - attributes:
        is_deconz_group: false
  include:
    - state: unavailable
    - domain: light
      options:
        tap_action:
          action: toggle
show_empty: false
type: 'custom:monster-card'

First, this card is amazing. Thank you.

Is there any way to make show_empty: false based solely on filtered entities?

I only want to show my card if my filter: include: entity is true. But when I show my card, I also want to show entities that arenā€™t filtered.

Currently, my unfiltered entities are making my card show all the time.

HI,

trying to list my hue sensors as follows:

  - type: custom:auto-entities
    card:
      type: entities
      title: Hue threshold sensors
      show_header_toggle: false
    filter:
      include:
        - entity_id: '*_sensor_threshold'

which works fine, except for one thing: I have 4 threshold sensors for outside (ā€˜buitenā€™) I like to display together, while now they are scattered in the list. How can I order these to show first or last in the total list groups together?

this is what it looks like right now:

Add a not to the include filter you already have to filter them out, and then a new filter to filter them back in where you want them.

yes, thanks!

made a decluttering template for it:

auto_hue_sensors:

card:
  type: custom:auto-entities
  card:
    type: entities
    title: 'Hue [[type]] sensors'
    show_header_toggle: false
  filter:
    include:
      - entity_id: 'sensor.*_[[type]]'
        not:
          entity_id: '*buiten*'
        sort:
          method: name
      - entity_id: '*buiten_*_[[type]]'
        sort:
          method: name

and Lovelace config:

  - type: custom:decluttering-card
    template: auto_hue_sensors
    variables:
      - type: sensitivity

  - type: custom:decluttering-card
    template: auto_hue_sensors
    variables:
      - type: threshold

because to the extra _day and _night extension couldnā€™t find a way to use the decluttering template for this (yet, might have another go at it later on):

  - type: custom:auto-entities
    card:
      type: entities
      title: Hue schedule sensors
      show_header_toggle: false
    filter:
      include:
        - entity_id: 'sensor.*_schedule_*'
          not:
            entity_id: '*buiten*'
          sort:
            method: name
        - entity_id: '*buiten_schedule_*'
          sort:
            method: name


thanks! magical card it is.

1 Like

HI,
have to get back to one of my above posts concerning this auto-entities card for automations:

  - type: custom:auto-entities
    card:
      type: entities
      title: All Automations auto
      show_header_toggle: false
    filter:
      include:
        - domain: automation
          options:
            secondary_info: last-triggered
    sort:
      attribute: last_triggered

the sorting is nowhere near based on the last_triggered attributeā€¦ didnā€™t realize it then, but now that I fixed most other issues, I would like to understand what is incorrect here. Is it too difficult for the frontend to keep adjusting this view based on last_triggered (very frequent triggering) or is the config simply incorrectā€¦

note: I am talking about the sort: attribute: last_triggered, not the secondary_info: last-triggered, which is something else, and does work alrightā€¦

as a matter of fact,I canā€™t get any sort method to work for this cardā€¦ name nor entity_id. Even when I put the sort under the filter, no change is displayed?

really puzzled here.