🔹 Auto-entities - Automatically fill cards with entities

hä? i have set the card to entities, for me is it simular

Remove this.
Add this:

options:
  - type: attribute
    attribute: headline
    name: Landshut
    icon: mdi:alert-octagon
1 Like

this shows me not the headline, i think this was why im using the grid

image

type: custom:auto-entities
card:
  type: entities
filter:
  include:
    - domain: binary_sensor
      entity_id: '*warning_landshut*'
      state: 'on'
  exclude:
    - attributes:
        severity: Minor
    - attributes:
        severity: Moderate
sort:
  method: friendly_name
  reverse: false
options:
    - type: attribute
      attribute: headline
      name: Landshut
      icon: mdi:alert-octagon

remove “-”

makes no different :frowning:

ahh, Thank you it works, the options msut be in the include code.
Is it possible no show up only the headline text?
Style doesn’t work any more too and a hide when no text is showing up is not possible in this card right?

style: |
  ha-card {
    background-color: rgba(255, 80, 80, 0.2);
    font-size: 14px;
  }
type: custom:auto-entities
card:
  type: entities
filter:
  include:
    - domain: binary_sensor
      entity_id: '*warning_landshut*'
      state: 'on'
      options:
        type: attribute
        style: |
           ha-card {
             background-color: rgba(255, 80, 80, 0.2);
             font-size: 14px;
           }
        attribute: headline
        name: Landshut
        icon: mdi:alert-octagon
  exclude:
    - attributes:
        severity: Minor
    - attributes:
        severity: Moderate
sort:
  method: friendly_name
  reverse: false


type: custom:auto-entities
card:
  type: entities
  card_mod:
    style: |
      ....
filter:

I’d like to include card mod styling in the filter template, but I’m stuck.
Here’s what is working in a normal custom:multiple-entity-row card:

    card_mod:
      style: |
        hui-generic-entity-row .entities-row .entity.state {
            width: 53px !important;
          }
        hui-generic-entity-row .entities-row .entity {
            width: 40px !important;
          }

The auto entities card in which I need this

type: custom:auto-entities
show_empty: true
card:
  type: entities
filter:
  template: |
        {{-
          {
            'type': 'custom:multiple-entity-row',
            'entity': s.entity_id,
            'name': <name>,
            'secondary_info': 'last-changed',
            'entities': [
              {'icon': 'mdi:battery-low',
               'entity': <an_entity>,
               'name': false,
               'state_color': 'true'},
              {'entity': <another_entity>,
               'name': false,
               'format': 'precision0'},
              ],
          }
        -}},
1 Like

Do you know of any way to add card mod styling to each card generated?
I’ve tried everything but it seems the for loop logic just splits everything to pieces when I try it and I can’t seem to get it to work and I end up with 100s of different cards that makes no sense what so ever.

Hi,
I’m using auto-entities in combination of mushroom cards, which is working fine:

type: custom:auto-entities
card:
  title: Smoke detectors
  type: vertical-stack
card_param: cards
filter:
  include:
    - group: group.smokedetectors
      state: 'off'
      options:
        type: custom:mushroom-template-card
        primary: '{{ area_name(entity) }}'
        icon: '{{ state_attr(entity,"icon") }}'
        icon_color: red
        tap_action:
          action: more-info
        hold_action:
          action: none
        double_tap_action:
          action: none
show_empty: false
sort:
  reverse: false

shot1

But instead of using vertical-stack’s title, I want to use mushroom-title-card’s subtitles because of design purposes:

type: custom:mushroom-title-card
subtitle: Smoke detectors

I’ve tried to place the title card snippet in to the filter section as well as to the entities section. But the title gets not hidden, in case of the filter does not examine any entity:

Do you have an idea?

Have you managed to show images using auto-entities and template? I am struggling to make it to work

Maybe anyone can help me with this.
Trying to display all cameras streams using auto-entities card.

Here is my current code:

- type: custom:mod-card
  card_mod:
    style: |
      :host {
        position: absolute;
        bottom: 6px;
        right: 6px;
        width: 265px;
      }
  card:
    type: custom:auto-entities
    show_empty: true
    card:
      type: grid
      square: true
      columns: 1
    card_param: cards
    filter:
      template: |-
        {% for camera in states.camera -%}
          {%- if camera.entity_id | regex_match("camera\.tapo_.*_hd", ignorecase=False) -%}
            {{
              {
                'type': picture-entity,
                'entity': camera.entity_id,
                'camera_image': camera.entity_id,
                'camera_view': live,
                'show_state': false,
                'show_name': false
              },
            }},
          {%- endif -%}
        {%- endfor %}

It’s not throwing any error but also not showing anything.

I have tried to check the auto-entities with grid card by creating a card in a UI editor and add one camera and everything seems to be working fine and when checking the code editor, I can see this working code:

type: custom:auto-entities
filter:
  include:
    - domain: camera
  exclude: []
show_empty: true
card_param: cards
card:
  square: true
  type: grid
  columns: 1
  cards: [
  {
      'type': picture-entity,
      'entity': camera.tapo_camera_f145_hd_stream,
      'camera_image': camera.tapo_camera_f145_hd_stream,
      'camera_view': live,
      'show_state': false,
      'show_name': false
    },
  ]

What am I missing in the first one that it is not working? Seems like grid cards array is not populated with picture-cards items :confused:

I don’t think you have to use loop, just add the cameras you don’t want to exclude.

type: custom:auto-entities
filter:
  include:
    - domain: camera
      options:
        type: picture-entity
        camera_view: live
        show_state: false
        show_name: false
card:
  type: grid
  square: true
  columns: 1
card_param: cards

Oh wow, such a simple and working solution. Don’t know how could I miss the options parameter or maybe just missunderstood and started ignoring it at some point. Thx @VietNgoc for quick help :slight_smile:

1 Like

I’m building a fitness dashboard with live fitness data from my smartwatch. I’m looking to create a horizontal (and maybe swipeable) stack of gauges of my goal progress for the primary metrics with the least complete goals listed first.

UPDATE: I found a workaround!

I’m planning for it to look something like this:

I’ve been able to combine auto-entities with layout-card to create the following layout, but I can’t get it to form a horizontal stack instead of defaulting to a masonry layout.

The issue seems to be that I need layout-card to convert from a list of entities to individual cards, but I can’t figure out how to take the output of layout card (a list of the individual cards and their properties) and form a horizontal stack from that.

type: custom:auto-entities
card:
  type: custom:layout-card
  layout:
    max_cols: 5
  layout_type: custom:horizontal-layout
filter:
  include:
    - entity_id: sensor.*_goal_percentage
      options:
        type: custom:flex-horseshoe-card
        entities:
          - entity: this.entity_id
            unit: '%'
            area: ____ Goal
        show:
          horseshoe_style: colorstopgradient
          scale_tickmarks: false
        layout:
          states:
            - id: 0
              entity_index: 0
              xpos: 50
              ypos: 62
              styles:
                - font-size: 5em;
          areas:
            - id: 0
              entity_index: 0
              xpos: 50
              ypos: 35
              styles:
                - font-size: 1.3em;
                - opacity: 0.9;
        horseshoe_scale:
          min: 0
          max: 100
          color: var(--primary-background-color)
        color_stops:
          '0': hsl(0, 83%, 56%)
          '10': hsl(10, 83%, 56%)
          '20': hsl(20, 83%, 56%)
          '30': hsl(30, 83%, 56%)
          '40': hsl(40, 83%, 56%)
          '50': hsl(50, 83%, 56%)
          '60': hsl(60, 83%, 56%)
          '70': hsl(70, 83%, 56%)
          '80': hsl(80, 83%, 56%)
          '90': hsl(90, 83%, 56%)
          '99': hsl(100, 83%, 56%)
          '100': hsl(171, 100%, 26%)
sort:
  method: state
  numeric: true

Let me know if any of that makes any sense and feel free to message me with any questions or suggestions.

Just a tip, if you don’t want it to be a bunch of blank space underneath each camera, set the “square: true” to “square: false”

I started messing around with card mod to fix it and realised after a while that I’m an idiot :smile:

Hi! I’m trying to get the next N departures with an integration, which saves all gathered departures in an attribute of the sensor. Per se the folllowing code works and I get the next two departures in a nice stack-in-card:

type: custom:auto-entities
card:
  type: custom:stack-in-card
  mode: horizontal
  card_mod:
    style:
      mushroom-state-info:
        $: |
          .primary {
            margin-top: 100px !important;
           } 
card_param: cards
filter:
  template: >-
    {%- for dep in
    (state_attr('sensor.griebnitzsee','departures')|selectattr('line_type',
    'in', ['suburban', 'regional'])|list)[:2] -%}
      {{ 
        {
          'type':'custom:mushroom-template-card',
          'primary': dep.direction,
          'secondary':dep.time,
          'icon': 'mdi:train' if dep.line_type == 'regional'
                  else 'mdi:tram' if dep.line_type == 'suburban'
                  else 'mdi:bus',
        } 
      }},
    {%- endfor -%}

However, the station names can get quite long so I’d like to add some card_mod styles to create a marquee (since I don’t know of a better way of doing it), but the code I posted doesn’t modify anything at all; How would I go about doing it in this case? Thank you so much!

image

try adding card-mod directly to mushroom template

type: custom:stack-in-card
mode: horizontal
cards:
  - type: custom:mushroom-template-card
    primary: Hello, {{user}}
    secondary: How are you?
    icon: mdi:home
  - type: custom:mushroom-template-card
    primary: Hello, {{user}} Long text abcd abdcf 
    secondary: How are you?
    icon: mdi:home
    card_mod:
      style:
        mushroom-state-info$: |
          .container {
            overflow: hidden !important;
          }
          .primary {
            animation: marquee 3s linear infinite;
            overflow: visible !important;
           } 
          @keyframes marquee {
            from {
              transform: translateX(0%);
            }
            to {
              transform: translateX(-100%);
            }
          }

CleanShot 2023-12-31 at 18.56.04

that’s amazing! were you able to figure this out?