šŸ”¹ Auto-entities - Automatically fill cards with entities

Anyway you will need using ā€œtemplateā€ option since you got 2 entities.
Read this.
And multiple-entity-row does not support sliders.

I think this is above me. I tried adapting your linked example to some simple sensors that my HA has, but I failed miserably.
I am surprised at how difficult this is proving to be. :persevere:

Create any complex card w/o auto-entiies.
Let it be a stack of Entities cards + Glance cards + some graphs, whatever.
Do it in storage mode.
Then open a generated dashboard file - you will find a json code.
Here is a draft of your template ))))

Oh, I was not aware. I will need to give that a try. Is it possible to switch back and forth between storage and yaml mode without creating issues on dashboards?

You may use several dashboards in storage mode & several dashboards in yaml.
Usually yaml is used for ā€œcombatā€ tasks, storage - for testing.

I just looked at the Multiple Dashboards - Home Assistant documentation and it looks like storage is the default anyway. Never considered moving my dashboards to yaml. But will do now. Much easier to backup than manually.

Thank you, I will check it out this weekend and hopefully learn somthing from the syntax that will help me here.

How can I include an entity based on the state of another entity?

I want sensor.device_a_locked to show up only when device_tracker.device_a is home.

ā€œtemplateā€ option.

I myself prefer a ā€œall config is in yamlā€ way & dislike the current trend ā€œmove config to UIā€.
Easier to backup, to temporarily include/exclude a code, move a code to another HA instance etc.

1 Like

Yes. ā€žTemplatingā€œ is like 42: itā€™s the answer to everything, right :laughing:

No idea how to do this.

Consider this example for multiple-entity-row.

1 Like

Hi! I have created a template that I want to use with auto-entities component. However, instead of creating multiple charts, all entities are thrown into one chart. Thereā€™s probably a crucial step Iā€™m missing, but I canā€™t for the life of me figure out how to make it work. For reference, this is how the one_line chart looks:

I want to make it shown for every entity returned by the auto-entities separately, like so:

But what Iā€™m getting is this:

Hereā€™s the code:

type: custom:auto-entities
card:
  type: custom:apexcharts-card
  config_templates: one_line
filter:
  include:
    - attributes:
        unit_of_measurement: W
  exclude:
    - state: unavailable

And the template:

apexcharts_card_templates:
  one_line:
    update_interval: 1min
    graph_span: 24h
    layout: minimal
    header:
      show: true
      show_states: true
      floating: true
    apex_config:
      chart:
        height: 60px
        offset_x: 200px
    card_mod:
      style: |
        #header {
          width: 104px
        }
        #graph-wrapper {
          margin-left: 120px
        }
        .apexcharts-canvas > .apexcharts-svg {
          margin-top: -15px
        }

Read this
Use this as a basis:

    type: custom:auto-entities
    card:
      type: vertical-stack
    card_param: cards
    filter:
      include:
        - entity_id: sensor.xxxx_*
          options:
            type: history-graph
            hours_to_show: 1
            entities:
              - entity: this.entity_id
1 Like

Thanks! Iā€™m closer now, but not quite there yet. This is the code I have:

type: custom:auto-entities
card:
  type: vertical-stack
card_param: cards
filter:
  include:
    - attributes:
        unit_of_measurement: W
      options:
        type: custom:apexcharts-card
        config_templates: one_line
        series:
          - entity: this.entity_id
  exclude:
    - entity_id: '*shelly*'
    - state: unavailable
    - entity_id: '*battery_power'
sort:
  method: state
  reverse: true
  numeric: true
  ignore_case: true

And this is the result:

/// apexcharts-card version 2.0.1 /// value.entity is extraneous
entity: sensor.house_power
type: custom:apexcharts-card
config_templates: one_line
series:
  - entity: sensor.house_power

Solved! I needed to enable the disable_config_validation option in apexcharts-card:

experimental:
  disable_config_validation: true

Got it from your issue, @Ildar_Gabdullin. Thanks!
Now the final apexcharts-template code looks like this:

apexcharts_card_templates:
  one_line:
    update_interval: 1min
    graph_span: 24h
    layout: minimal
    experimental:
      disable_config_validation: true # this fixed the last issue
    header:
      show: true
      show_states: true
      floating: true
    apex_config:
      chart:
        height: 60px
        offset_x: 200px
    card_mod:
      style: |
        #header {
          width: 104px
        }
        #graph-wrapper {
          margin-left: 120px
        }
        .apexcharts-canvas > .apexcharts-svg {
          margin-top: -15px
        }
        ha-card {
          overflow: visible !important;
        }
1 Like

Yes, I observed this here, asked Thomas about this problem here, then asked RomRider about it here. Quite a story )

2 Likes

Thank you that you suffer so others donā€™t have to, kind sir. Hats off! :bowing_man:

1 Like

Hello,

I am trying to show multiple picture-entity in a grid setup using auto-entities. I have arrived at this so far but it is complaining that ā€œentitiesā€ must be specified. What am I missing?

  - title: Cameras
    path: cameras
    icon: mdi:camera
    type: panel
    badges: []
    cards:
      - type: custom:auto-entities
        card:
          type: grid
          square: true
          columns: 5
        card_param: cards
        filter:
          template: |-
            {% for state in states.camera -%}
              {%- if state.entity_id | regex_match("camera\.tapo_.*_hd", ignorecase=False) -%}
                {{
                  {
                    'type: picture-entity,
                    'entity': state.entity_id,
                    'camera_image': state.entity_id,
                    'camera_view': live,
                    'show_state': false,
                    'show_name': false,
                    'name': state.attributes.friendly_name.split(' - HD')[0]
                  }
                }},
              {%- endif -%}
            {%- endfor %}

because of this, no ā€œ'ā€.

1 Like

Hi, I can list all my batteries with this:

  - type: custom:auto-entities
    card:
      title: Batterier
      type: entities
    filter:
      include:
        - attributes:
            device_class: battery

Buyt when i wanā€™t to sho only batteries below 80 procent, it dosenā€™t show anything?:

  - type: custom:auto-entities
    card:
      title: Batterier
      type: entities
    filter:
      include:
        - attributes:
            device_class: battery
            battery_level: <80

Whatā€™s wrong?