thomasloven / lovelace-auto-entities

🔹Automatically populate the entities-list of lovelace cards
MIT License
1.24k stars 113 forks source link

Is there any way to get the number of matching entities? #278

Closed pcb1962 closed 2 years ago

pcb1962 commented 2 years ago

I use this card a lot, love it, but sometimes I would just like to check the number of matched entities without looking at the detail. Is there any way to get the number of matches so I could stack it with a single entity card showing the total? For example I have 42 tasmota devices, it would be great if I could quickly see that the total online is 42, and only look at the list if the number is different. Thanks for any ideas.

ildar170975 commented 2 years ago
  1. The auto-entities card returns a LIST of objects. An "object" may be an "entity row", "card" etc. So the list may be used as a part of Entities card, Glance card, history-graph, custom:mini-graph-card, .... OR as a part of some stack of cards.

  2. You are asking about a "value representing a count of objects". And you want this value to be displayed somewhere. It is not clear where this value may be displayed in many cases of using auto-entities (see pt. 1).

Here is a possible implementation of your case. Let's assume that the "count of objects" is displayed as some entity row:

entity row for "count"
divider row
entity rows for objects

You may achieve this: 1) Create a template sensor for calculating a number of objects and put this sensor on the 1st row. OR 2) Use a custom:template-entity-row card with a similar template as the 1st row.

pcb1962 commented 2 years ago

Thanks for the ideas, I'll see what I can do.