thomasloven / lovelace-auto-entities

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

filter entities having / not having specific attribute #341

Closed Akinetopsia1 closed 1 year ago

Akinetopsia1 commented 1 year ago

For example i am trying to list device_tracker entities of a given source_type only if the friendly_name attribute is present and set to something, while ignoring those without that attribute.

Conversely on a second card i'd want to match only those of the same source_type this time without that attribute

bkbilly commented 1 year ago

I was just looking for the same thing for the Steam integration and I've come up with this:

type: custom:auto-entities
card:
  type: entities
filter:
  include:
    - integration: steam_online
      attributes:
        game: "! None"
    - integration: steam_online
      not:
        attributes:
          game: "! None"

The 1st include shows the entities that have the attribute game and the 2nd shows the ones that don't have the game attribute.

Akinetopsia1 commented 1 year ago

Turns out it appears the friendly name attribute is not exposed in lovelace at all, so i have no way to differentiate between devices i've setup / approved and new devices the way i was planning to

I can't test your suggestion, but i knew it had be something simple like that, i just couldn't figure it out