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

Then there is no solution.

Surely you may put "type: section" rows before each list - but then only these rows are displayed if lists are empty - and then the card will be displayed too since the WHOLE list is not empty.

If itĀ“s really not possible to hide the card when no lists elements exist (still doubt it)ā€¦

Why can auto-entities not realize thereĀ“s no element (consisting of nested, empty sub auto-entities) @thomasloven? This is working on the first level, so just wondering.

You may try to achieve this by using template option of auto-entities card.
Actually, LOT OF THINGS are possible with a template. Just learn & doā€¦

Sorry for repost, butā€¦

I have a question. I want to achieve somewhat simple setup. I want to have fold entities auto populated with auto entity like here:

obraz
But with toggles for the sections.

I played with static fold entity and was able to get whatā€™s in the screenshot but I donā€™t know how to use auto-entity to get entities for the fold row.

I know I could have the toggle for the section if I would for example create light group with all entities for area but I was thinking if there is a way to do it without this step.

Just a tipā€¦ I tried to make more items fit in a small space.

FROM:


TO:
image

This is the css-mod item I added to the code:

type: custom:auto-entities
card:
  type: entities
  style: |
    #states > div {
      margin: -15px 0px;
    }

To capture the individual divs under <div id="state"> you have to add ā€œ> divā€ in the css.

Other example: with secondary info (note that the coloring does not work like this. the screenshot was colored with the browser inspector)

image

type: custom:auto-entities
card:
  type: entities
  style: |
    #states > div {
      margin: 0px 0px;
    }
    .secondary, ha-relative-time {
      color: #ed2323;
    }

Cheers
DJ

1 Like

I really love the idea of auto-entities and this is an awesome card!

I was creating a card in another thread using apexcharts-card and custom-config-card to create a dynamically changeable plot Dynamic selection.

The only downside being, that I have to manually define the input_select.sensors_to_show. I think this is were auto-entities could come in and make this far more convenient and future proof.

Would it be possible to use auto-entities to define variables on-the-fly?

My idea was:

  • Create an input_select with the includes for auto-entities (e.g. ā€˜areaā€™, ā€˜sensorsā€™, ā€˜devicesā€™ etc.). These are static anyway and do not change when adding new devices.
  • Use this input_select as include parameter for auto-entities. Auto-entities would then create a list of e.g. all areas
  • Create a variable of the auto-entities list and forward it to the next card.

Would this be possible?
My current code is

type: vertical-stack
cards:
  - type: entities
    entities:
      - entity: input_select.days_back_to_show
        name: Number Of Days To Show
      - entity: input_select.sensors_to_show   #this is what auto-entities would need to supply
        name: Select Sensor
  - type: custom:config-template-card
    entities:
      - input_select.days_back_to_show
      - input_select.sensors_to_show
    variables:
      sensor: states['input_select.sensors_to_show'].state
      span: states['input_select.days_back_to_show'].state+'d'
      days: |
        -states['input_select.days_back_to_show'].state+'d'+'1d'
    card:
      type: custom:apexcharts-card
      graph_span: ${span}
      span:
        start: day
        offset: ${days}
      series:
        - entity: ${sensor}
          stroke_width: 2
          group_by:
            func: raw

EDIT:
I think it should be something along the lines of this, but I am not sure how auto-entities passes on the entities it uses, so I am not sure if it can populate a series.

type: vertical-stack
cards:
  - type: entities
    entities:
      - entity: input_select.days_back_to_show
        name: Number Of Days To Show
  - type: custom:auto-entities
    card:
      type: custom:config-template-card
      variables:
        sensor: states['input_select.sensors_to_show'].state
        span: states['input_select.days_back_to_show'].state+'d'
        days: |
          -states['input_select.days_back_to_show'].state+'d'+'1d'
      card:
        type: custom:apexcharts-card
        graph_span: ${span}
        span:
          start: day
          offset: ${days}
        series:
#          - entity: ${sensor}    this would need to be populated
            stroke_width: 2
            group_by:
              func: raw
              #duration: 1min
    entities:
      - input_select.days_back_to_show
    filter:
      include:
        - domain: sensor

@AleXSR7001 I do not think you will be able to achieve what you want.

First of all, when calling domain: sensor auto-entities will return ALL of your sensors.
So making graphs for ALL of them at the same time, while trying to preview large time spans, such as 10 days, will definately make your tab crash.

Second, try this as a simple example:

    type: custom:auto-entities
    card:
      type: entities
    filter:
      include:
        - domain: sensor
          options:
            type: custom:apexcharts-card
            graph_span: 1h
            span:
              start: day
              offset: 1h
            series:
              - entity: this.entity_id ### this is how you achieve auto-entities 
                                      ### to pass the entity_id 
                stroke_width: 2
                group_by:
                  func: raw
                  duration: 1min

You will have this result

As you can see, auto-entities pass the entity_id twice and apexchars-card does NOT accept an entity value on the main config, so it throws an error that value.entity is extraneous

What you CAN do, is to use the stock history graph and the hui-element card.
However you will not be able to go days back, but only hours back.

type: vertical-stack
cards:
  - type: entities
    entities:
      - entity: input_select.hours_to_show
      - entity: input_select.sensors_to_show ### define options such as 'sensor', 'binary_sensor', 'light' etc
  - type: custom:config-template-card
    entities:
      - input_select.hours_to_show
      - input_select.sensors_to_show
    variables:
      hours: states['input_select.hours_to_show'].state
      sensors: states['input_select.sensors_to_show'].state
    card:
      type: custom:auto-entities
      card:
        type: entities
      filter:
        include:
          - domain: ${sensors}
            options:
              type: custom:hui-element
              card_type: history-graph
              hours_to_show: ${hours}
              entities:
                - entity: this.entity_id

1 Like

I am not concerned about the amount of sensors as I would be adding a second and maybe third input_select.
So I would most like have

  1. days to show
  2. area to show
  3. device type/domain to show

So in the end it would be around 1-5 sources (same as now).

I think this is a ā€œmissingā€ feature im auto-entities. It can only handle the parameter ā€œentitiyā€ and not ā€œentitiesā€, so it cannot fill the series: entities:.

I will try my luck in the auto-entities github and ask if it could be added as a feature :slight_smile:

Hi.

I am in need with auto-entities and showing an attributeā€¦ I want to show the IP of a device_tracker item, under developer_tools i can see that attribute is availble but i just canā€™t seem to get it showing in the auto-entities listā€¦

The following code is the working

type: custom:auto-entities
card:
  type: entities
  title: Home
filter:
  include:
    - domain: device_tracker
  exclude:
    - state: unavailable
    - state: not_home
sort:
  method: name

I know the following fixed entities card wil work :

type: entities
title: Entities card sample
entities:
  - type: attribute
    entity: device_tracker.desktop
    attribute: ip

Anyone an idea how to get that working with auto-entities ?

Try this:

type: custom:auto-entities
card:
  type: entities
  title: Home
filter:
  include:
    - domain: device_tracker
      options:
        type: attribute
        attribute: ip
  exclude:
    - state: unavailable
    - state: not_home
sort:
  method: name

It works if ALL trackers have this attribute.
Otherwise it will show ā€œ-ā€ for those trackers which do not have.
For example, ASUSWRT-based trackers do have ip attribute, Life360-based & ping-based (which is strange for me) - do not.

Yessss, it works !.. Thank a lot, i was struggeling for long time now :Dā€¦ And indeed some items have a - but that is just fineā€¦

Thanks again

Has anyone figured out how to filter by the new entity categories in Auto-entities? Does it need an enhancement to support that?

Hey =)
i have two booleans.
and the second should only be shown when the first is activated ā€¦

input_boolean.weekend
input_boolean.task_1

also:
if input_boolean.weekend is active then show me input_boolean.task_1. // if not, then not

that has to go somehow via a template value ā€¦ but that just doesnā€™t want to.
maybe I think wrong too?

card:
  type: entities
  entities:
    - entity: input_boolean.task_01
filter:
  include:
    - entity_id: input_boolean.weekend
      state: '{{ is_state(''input_boolean.weekend', ''on'') }}'

Why not using a stock Conditional row inside Entities card?

can you tell me how ? =)

type: entities
entities:
  - input_boolean.test_boolean
  - type: conditional
    conditions:
      - entity: input_boolean.test_boolean
        state: 'on'
    row:
      entity: input_boolean.test_boolean_2
1 Like

madness ā€¦ thatā€™s not more?
Thanks alot!

can we somehow manage that the card is only shown when ā€œinput_boolean.test_booleanā€ is activated?
now it is so that you can still switch here, and as soon as it is active, the boolean ā€œtest_boolean_2ā€ is shown.

This is far beyond auto-entities main topic here, it should not be discussed here.

type: conditional
conditions:
  - entity: input_boolean.test_boolean
    state: 'on'
card:
  type: entities
  entities:
    - input_boolean.test_boolean
    - type: conditional
      conditions:
        - entity: input_boolean.test_boolean
          state: 'on'
      row:
        entity: input_boolean.test_boolean_2

Also you may use state-switch custom card.

1 Like

Hi everyone,
I opened an issue/feature request on Github but I am not sure if this will be implemented or implementable.

So I was wondering if anybody had any idea if somehow I could use auto-entities to create variables which I could then feed into my target card?

This is what it looks like, but I am having to use input_select for the entity drop-down, something that auto-entities would be ideal for .
image

type: entities
entities:
 - entity: input_select.days_back_to_show
   name: Number Of Days To Show
 - entity: input_select.sensors_to_show
   name: Select Sensor
type: custom:config-template-card
entities:
  - input_select.days_back_to_show
  - input_select.sensors_to_show
variables:
  sensor: states['input_select.sensors_to_show'].state
  span: states['input_select.days_back_to_show'].state+'d'
  days: |
    -states['input_select.days_back_to_show'].state+'d'+'1d'
card:
  type: custom:apexcharts-card
  graph_span: ${span}
  span:
    start: day
    offset: ${days}
  series:
    - entity: ${sensor}
      stroke_width: 2
      group_by:
        func: raw

Anybody have an idea?