thomasloven / lovelace-auto-entities

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

Support for new tile card #319

Closed bkbilly closed 1 year ago

bkbilly commented 1 year ago

The new Tile card released by Home Assistant 2022.11.0 doesn't show anything if I write something like this:

type: custom:auto-entities
filter:
  include:
    - device: AlarmPI
  exclude: []
sort:
  method: state
  reverse: false
  ignore_case: false
  numeric: false
show_empty: true
card:
  type: tile

If I leave the card type as entities which is the default it works perfectly.

It would be nice to show the new tile cards.

jason0x43 commented 1 year ago

The issue here is that custom:auto-entities doesn't create a bunch of whatever is provided to card (that threw me off for a while, too). Rather, it provides a list of entity IDs to the entities property of whatever card type is specified in card.

By default, it uses an Entities card. It will create a single Entities card and set that card's entities property to be the auto-created list of entities.

Tile cards only work with a single entity, so they can't be used as the base card for custom:auto-entities.

Entity-level properties can be specified using filter options. I was able to use the tile card in a grid layout by specifying it in the filter options. The layout below has custom:auto-entities populate a custom:layout-card with Tile cards for my temperature and humidity sensors.

type: custom:auto-entities
card:
  type: custom:layout-card
  layout_type: custom:grid-layout
  layout:
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr))
    grid-template-rows: auto
    cards: []
  filter:
    include:
      - domain: sensor
        entity_id: '/.*(temp|humidity).*/'
        options:
          type: tile
bkbilly commented 1 year ago

Thanks for the recommendation!

bkbilly commented 1 year ago

I've tried the layout-card you suggested and I've made some modifications to look better. I am posting it here if anyone is interested:

type: custom:auto-entities
show_empty: false
sort:
  method: friendly_name
card:
  cards: []
  type: custom:layout-card
  layout_type: custom:masonry-layout
  layout:
    width: 100
    max_width: 500
    max_cols: 3
    min_height: 1
    margin: 0
    card_margin: var(--masonry-view-card-margin, 0px 4px 0px)
filter:
  include:
    - domain: light
      state: 'on'
      options:
        type: tile