thomasloven / lovelace-auto-entities

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

Only populate unique entity names by last updated #260

Closed ChipWolf closed 2 years ago

ChipWolf commented 2 years ago

I'm looking for a way to populate a card with uniquely [display] named entities by their last update time.

My use case is populating entities of domain device_tracker on the map card. There are multiple entities with the same display name from different integrations (notably the mobile app and the iCloud integrations). I'd like the most recently updated entities to show on the map, no more than one of each display name.

Thanks!

Current config:

Screenshot 2022-03-10 at 12 27 32
type: custom:auto-entities
show_empty: false
card:
  type: map
  default_zoom: 13
  hours_to_show: 12
  aspect_ratio: '16:9'
  geo_location_sources:
    - all
filter:
  include:
    - domain: device_tracker
  exclude:
    - state: home
unique: entity
ChipWolf commented 2 years ago

I've found a relatively elegant workaround:

In this case; some of the groups of devices represent vehicles, so it didn't occur to me to use the person domain until now.

I created a person for each vehicle, associated all of the device trackers to their respective person and changed the included domain in my auto-entities config from device_tracker to person.

thomasloven commented 2 years ago

I think that's a good workaround. The other way to do this is via a clever near-magic template filter.