How to use auto-entities with layout-card and mini-graph-card

Hello,
I’m trying to show a grid with graphs for all my temperature sensors. However, it is a bit hard to understand how I can combine the three plugins mentioned above to make it as automatic as possible.

This is what I tried:

type: 'custom:auto-entities'
filter:
  exclude:
    - name: Weatherbit*
  include:
    - domain: sensor
      attributes:
        icon: 'mdi:thermometer'
card_param: cards
card:
  type: 'custom:layout-card'
  max_columns: 3
  column_width: 25%
  cards:
    type: 'custom:mini-graph-card'
    hours_to_show: 48
    update_interval: 60
    height: 200

If anyone knows another solution using another card, the grid for example, I am also happy to use that instead.
Sometimes I wish that, instead of yaml configurations I could use functions taking and returning parameters, that way at least I will know what is the expected output and inputs.

thanks in advance.
– EDIT –

Here is another attempt. I feel this is closer and more correct, but still shows me an error: Cannot read property 'length' of undefined

type: 'custom:auto-entities'
card:
  type: grid
  columns: 2
card_param: cards
filter:
  exclude:
    - name: Weatherbit*
  include:
    - domain: sensor
      attributes:
        icon: 'mdi:thermometer'
      options:
        type: 'custom:mini-graph-card'
        hours_to_show: 48
        update_interval: 60
        height: 200
1 Like

So, I’m very sure that my last attempt is almost perfect. My only problem is that auto-entities is injecting the value into the card as entity while the card expects a list of entities, even if it is of a single entity. If I had just a way to tell auto-entities how to inject the entity it will be 100% perfect

Dam it, I was so close (and the feature was so hidden on the docs…).
Seems that you can use an specific string on the options of the auto-entities and it will inject there the entitiy name:

In the options: option of the filters, the string this.entity_id will be replaced with the matched entity_id. Useful for service calls - see below.

This was almost perfect for my use case, I couldn’t believe it was so convenient…
However, this is what I encountered:

The mini-graph-card fails if you provide an entity option, and auto-entities will inject it even if you use the previously mentioned feature.
I wish cards just ignore whatever they don’t want to take into account, instead of failing and making life hard for their users.

Finally!
I thankfully, as a developer I had an intuition. I thought that, if I provide an entity value the auto-entities will not inject it, and I thought that if the value were undefined the mini-graph will not detect it so I added an empty entity: entry… and it worked!
This is my final card definition:

type: 'custom:auto-entities'
card:
  type: grid
  columns: 2
card_param: cards
filter:
  exclude:
    - name: Weatherbit*
  include:
    - domain: sensor
      attributes:
        icon: 'mdi:thermometer'
      options:
        type: 'custom:mini-graph-card'
        hours_to_show: 48
        update_interval: 60
        height: 200
        entity:
        entities: 
          - "this.entity_id" 

3 Likes

Thank you @danielo515 !!
My missing key is:

options:
  entity: null
  entities:
    - this.entity_id

This is to ensure that auto-entities not pass “entity” attributes to mini-graph-card and passed it on entities.
Just FYI for other people, if you use this, exclude filter on auto-entities can’t be applied, that’s why you can use “not:” options in include filter. On my case, I filter sensor that have name “battery” or “nas” in its name.

I combine custom:auto-entities , custom:layout-card, and custom:mini-graph-card to have 2 column sensor, here is my config:

type: custom:auto-entities
card:
  type: custom:layout-card
  layout_type: horizontal
  layout_options:
    width: 150
    max_cols: 2
card_param: cards
filter:
  include:
    - entity_id: sensor.*temperature
      not:
        name: '*Battery|nas*'
      options:
        type: custom:mini-graph-card
        entity: null
        entities:
          - this.entity_id
        state_adaptive_color: true
        color_thresholds:
          - value: 31.98
            color: green
          - value: 31.99
            color: red

Thank you, I’ll give that a try!

Hi @danielo515, @itanumih and others, this solution fits my need perfectly but I can’t quite get it to work, it doesn’t seem to pull the data through. Any ideas why?

type: custom:auto-entities
card:
  type: grid
  columns: 2
card_param: cards
filter:
  exclude: null
  include:
    - domain: climate
      attributes:
        hvac_action: idle
      options:
        type: custom:mini-graph-card
        hours_to_show: 48
        update_interval: 60
        height: 200
        entity: null
        entities:
          - this.entity_id

Figured it out…the temperature value is in the attribute of climate, not the state. Duh!

        entities:
          - entity: this.entity_id
            attribute: current_temperature
            show_state: true