🔹 Auto-entities - Automatically fill cards with entities

Finally released in HACS.

This lovelace plugin lets you automatically put entities into lovelace cards.
You can e.g. make an entities card which shows all your remotes which have a low battery.
Or a glance card which shows all lights that are currently on.
There’s lots of matching options. Like selecting all media players where the currently playing song matches a regular expression.
And you can also finally sort the entities!

Here’s just some examples from my development setup:

45 Likes

Hey Thomas,

I am currently moving all my monster-cards to your new auto-entities-card and there is one thing thats a bit annoying and has to do with another card of you - the browser-mod-integration:

I my lovelace config I have an auto-entities-card that displays all lights across the house that are currently switched on. I have the header_toggles enabled which makes it pretty easy to turn off all lights in the house with a single click. With the browser-mod-integration each device currently using hass also is visible as a light:

autoentities
The problem is when I click the header toggle my screen on my computer and smartphones goes black. I don’t store cookies on my computers so everytime I reboot I get a new ID.
Is there a way to generally ignore all devices (lights) from browser-mod in a auto-entities-card? Maybe something like a regular expression?

Keep up the great work!

All browser_mod entities have the attribute: type: browser_mod. You can exclude that.

4 Likes

Perfect! Thank you. But I still can’t get it to work. Can you help me out or maybe add this case to your README.md?

I’ve tried the following but it’s not working:

type: 'custom:auto-entities'
show_empty: false
card:
  title: Eingeschaltete Lampen
  type: entities
entities: null
filter:
  exclude:
    - domain: light
      state: 'on'
      type: 'browser_mod'
  include:
    - domain: light
      state: 'on'
sort:
  method: name

Try checking some of the examples of filtering on other attributes.
https://github.com/thomasloven/lovelace-auto-entities#examples

And you don’t need to match everything in the exclude filter.
Just

exclude:
- attributes:
   type: browser_mod

is enough.

1 Like

Finally it’s working. Thank you very much.

Hello,

maybe someone can point me into the right direction, i’m a bit stucked here:

I have following entities and attributes:

Entity #1 : camera.aarlo*
Attribute: battery_level

Entity #2: plant.*
Attribute: battery

Each attribute is following a numeric value (measured in %).

I’d like to show these using auto-entities if one of these devices is less than 20% battery.

Tried the following code (starting for entity #1 only) but Lovelace tells me “Cannot convert undefined or null to object”.

### Battery Alarms
         - type: 'custom:auto-entities'
           show_empty: false
           card:
             title: Schwache Batterien
             type: entities
           #entities: null
           filter:
             include:
               - domain: camera
                 - entity_id: "battery_level"
               - attributes:
                 battery_level: "<= 20"

Thanks a lot in advance!
/ Ralf

After correcting indentation, this would show

  • All your cameras
  • The impossible entity with entity id battery_level (not sensor.battery_level or anything), so nothing
    AND
  • All entities with an attribute battery_level that is less than or equal to 20.

which is probably not quite what you want.

The error you’re describing, though, comes from somewhere else. It only happens if you have attributes: followed by nothing.

Thanks for the fast reply, but I’m still stucked how the code should look like to get what i tried to do?

Thanks
/Ralf

EDIT: found answer in this post: Lovelace Battery Entity Card
Post #17

But thanks for the help!

/ Ralf

Why sorting with

  sort:
    method: state

gives that

EDIT: work in version 1.6+

1 Like

And even

    filter:
      include:
        - entity_id: '*battery*'
    sort:
      method: state
      numeric: true

gives unsorted results:
Anmerkung 2019-12-07 133346
Would be nice to give us a hint how to fix this.

THX!

That’s not included in the 1.5 release.
Install the master version to get it.

1 Like

Wow, great! Version 1.6 is working like a charm.
image
You´r awesome! :smiley:
Thank you!! :+1:

Is there a way to display the attribute value instead of state of some entities? I want to show the battery value of vacuum and device_tracker but it just shows docked and home.

card:
  show_header_toggle: false
  title: Battery Status
  type: entities
filter:
  include:
    - domain: device_tracker
      attributes:
        battery: <= 100
    - domain: vacuum
      attributes:
        battery_level: <= 100
    - entity_id: sensor.*battery*
      state: <=100
sort:
  method: state
type: 'custom:auto-entities'
1 Like

That’s what template sensors are for.

1 Like

As always, @thomasloven, top quality support!
Thank You!

Some updates:

Auto-entities now supports

  • Displaying entities based on last_change or last_updated
  • Sorting entities by name, entity id, state, attributes, last change etc…
  • Display up to a maximum number of entities (e.g. display the first 10 matches)
  • Skipping a number of entities (e.g. display match 10-20)
  • Replacing this.entity_id with the current entity id in options (e.g. for setting tap_action to call a service on the matched entity)
4 Likes

This card is truly amazing (like most of your addons/plugins). I have a rather crazy question though. Seeing that auto entities can find entities and fill them according to an area, I was actually wondering if this would be possible with other cards than entities or glance.

E.g. I would like to generate a vertical/horizontal stack with 3 buttons on each row and have them filled automatically like auto-entities does except then with entity button or button-card.

So it would fill button-cards with entities inside a specific area. I might be asking something really exotic and/or something that is impossible. But seeing these two specific addons (auto-entities and lovelace_gen) I would think that this might be possible one way or another.

Still this card is amazing and I use it more often than I did before, but auto filling other cards than entities or glance would be really amazing.

Thanks for all your great work @thomasloven you make the HA experience a lot better for all of us!