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

Cannot use these 2 filter options together.
Either:
ā€“ include
ā€“ include + exclude
ā€“ template

1 Like

Ah, thank you for pointing that out! I swapped it out with the Custom Button Card and itā€™s working perfectly now.

hello i am new to this hoping you can give me some advice

i want to hide/show an entity based on a different entity (sensor) status:

  • ā€œmedia_player.androidā€ should only be displayed when
  • ā€œsensor.lg_tv_power_stateā€ is ā€œonā€

this is probably pretty simple with templates but i am struggling with the syntax. maybe somebody can give me a code example of a similar scenario working (i.e. an auto-entity card filtering an entity based on another entityā€™s status)

thank you!

If Iā€™m understanding correctly then you donā€™t even need the auto-entity card; you can just this with a conditional card. Is this what youā€™re wanting?

type: conditional
conditions:
  - condition: state
    entity: sensor.lg_tv_power_state
    state: 'on'
card:
  type: media-control
  entity: media_player.android

2 Likes

im sorry yes forgot to report back. managed it meanwhile with the condition card which proved to be the better way of doing this anyway. thanks

Templated Gauge card.
post

1 Like

Hi! First, i love this card!

I am triying to automatically create popups with buble card, each of one has inside another autoentites card to create a grid with mushroom template card.

I have been triying many ways but not luck. I donā€™t even know if this is possible.

Is there any chance that you give a hand?

Million thanks!

This would be the schema:

Is it possible that only the light group is displayed and not the individual lamps in the group. Havenā€™t found anything about this yet.

With exclude: and group: I can exclude the lamps from the group, but I then have to enter this for each group.

I tried with a wildcard but this works, does anyone know why? Iā€™ve already tried with " ".

type: custom:auto-entities
show_empty: false
card:
  show_name: true
  show_icon: true
  show_state: false
  type: glance
  title: Lichter an
  state_color: true
  columns: 2
filter:
  include:
    - domain: light
      state: 'on'
      options:
        tap_action:
          action: toggle
    - type: ''
  exclude:
    - name: AU_Wand
    
    - group: light. *
    
    
  sort: null
  method: friendly_name

how can i set between each friendlyname missmatch a divider?

type: custom:auto-entities
card:
  type: entities
  title: Proxmox LXC
  state_color: true
filter:
  include:
    - device_model: LXC
      entity_id: '*status'
      options: {}
    - entity_id: '*cpu_auslastung'
      options: {}
  exclude: []
sort:
  method: friendly_name
  reverse: true
  ignore_case: false
  numeric: false
  ip: false

Can anybody help me please? I canā€™t get this combination of cards to work.

The idea is to have a card that only shows up when thereā€™s an update. If itā€™s an update from HACS, it shows witch update it is (instead of only having a number of how many updates HACS has). The updates from within home assistant are already specified, so they show up as well)

Hereā€™s the code:

type: custom:auto-entities
show_header_toggle: false
card:
  type: entities
  title: Add-on & Integratie Updates
  show_header_toggle: false
  filter:
    include:
      - domain: update
        state: 'on'
      - entity_id: sensor.hacs
        state: '! 0'
  show_empty: false
  sort:
    method: last_triggered
- type: markdown
  title: HACS Updates
  content: |-
    {%- if is_state('sensor.hacs','0') -%}
      <b><font color=green>No updates</font></b>
    {%- else -%}
      <table width=100%>
      {%- set hacs_updates = state_attr('sensor.hacs','repositories') -%}
      {%- for hacs_update in hacs_updates -%} 
        <tr><td><b><font color=red>{{[hacs_update][0]['display_name']}}</b></font></td><td>{{[hacs_update][0]['installed_version']}}</td><td>{{[hacs_update][0]['available_version']}}</td></tr>
      {%- endfor -%}
      </table>
    {%- endif -%}

Ofcourse it doesnā€™t need to be a markdown card at the bottom, if anybody can figure out how to show the attributes in the entities card part, itā€™s cool to. I just want it to show me the specifications of the updates from HACS, when there are updates.

I think i found it, but if anybody has a batter way of doing this, i would like to hear it.

This is what i have now:

type: custom:auto-entities
filter:
  include:
    - domain: update
      state: 'on'
    - entity_id: sensor.hacs
      state: '! 0'
show_empty: false
sort:
  method: last_triggerd
card:
  type: custom:stack-in-card
  title: Add-on & Integratie Updates
  mode: vertical
  cards:
    - type: custom:auto-entities
      card:
        type: entities
        show_header_toggle: false
      filter:
        include:
          - domain: update
            state: 'on'
      show_empty: false
      sort:
        method: last_triggerd
    - type: custom:auto-entities
      card:
        type: markdown
        content: |-
          {%- if is_state('sensor.hacs','0') -%}
            <b><font color=green>No updates</font></b>
          {%- else -%}
            <table width=100%>
            {%- set hacs_updates = state_attr('sensor.hacs','repositories') -%}
            {%- for hacs_update in hacs_updates -%} 
              <tr><td><b><font color=red>{{[hacs_update][0]['display_name']}}</b></font></td><td>{{[hacs_update][0]['installed_version']}}</td><td>{{[hacs_update][0]['available_version']}}</td></tr>
            {%- endfor -%}
            </table>
          {%- endif -%}
      filter:
        include:
          - entity_id: sensor.hacs
            state: '! 0'
      show_empty: false
      sort:
        method: last_triggerd

Hi, some time has passed since the last message, but now Iā€™m back on my card and I would like to fix it permanentlyā€¦
Have you found a new (working) way to monitor all the devices on the network
Thanks

Hi, yes I have a way of monitoring all my network devices. But it involves my unifi network devices. Never got back to using nmap. Since the unifi integration does enough for me.

Hi,

I was hoping that i could get some help. I am looking for two things.

I borrowed some of a script from this thread to show all my devices that are lights/on. I have a kasa power strip setup with my cable modem so I can reboot it. However it always is on & needs to be on. The script below shows everything but i cant seem get the exclusion to work.

type: custom:auto-entities
card:
  type: entities
filter:
  include:
    - entity_id: light.*
      state: 'on'
      options:
        type: custom:mushroom-update-card
        entities:
          - this.entity_id
        tap_action:
          action: call-service
          service: homeassistant.turn_off
          service_data:
            entity_id: this.entity_id
  exclude:
    - device: TP-LINK_Smart Plug_3BFF


While this does work - the cable modem which is the device above - still shows up. I also tried the entity but that doesnt work either.

2nd question:

How can I setup an auto-entities based on an integration?

For example I use the Lutron integration - how can i get it working?

`type: custom:auto-entities
card:
  type: entities
filter:
  include:
    - device_manufacturer: lutron
      device: lutron
  exclude: []
`

This for some reason doesnt work. Any ideas?

Hi i have a question: is it possible to fill vertical stacks + child items from one auto entities card?

I try something like this:

    type: custom:auto-entities
    show_empty: false
    card:
      type: custom:layout-card
      layout_type: custom:grid-layout
    filter:
      template: >-
        {%- set area = 'Wohnzimmer'-%}
        {%- set domains = states | selectattr('entity_id',
        'in',area_entities(area)) | map(attribute='domain') | unique | list -%} 
        {%- for domain in domains  -%}
        {% set entities = states   | selectattr('entity_id',
        'in',area_entities(area))  | selectattr('domain', 'eq', domain) 
         | list -%}  
           {{{ 'type': 'vertical-stack',
               'title': domain,
               'cards':
               [{'type': 'entity', 
                 'entity': 'light.bad'}]}}},
           {%- for entity in entities  -%}
               {{{ 'type': 'entity',            
                   'entity': entity.entity_id, }}},
           {%- endfor %}{%- endfor %}

This gives me a vertical stack for every domain i have. The only entity in the stack is ā€œlight.badā€ which i manually put in there. The other loop gives me all other entities but there are single cards not put into the vertical stack.

any way to achieve every domain + entities of that domain go into a vetical stack?

PS: i have a working example but with two auto entities card. so one creates another and i think this slows down the generating

how can i count all entities through this nested loop?

      {%- set areas = states.light | selectattr('state','eq', 'on') |
      map(attribute='entity_id') | map('area_name') | unique | reject('none')  |
      list -%}  {%- for area in areas  -%}   {%- set entity_filter = ''
      %}          {% set entities = states.light   | selectattr('state','eq',
      'on') | selectattr('entity_id', 'in', area_entities(area)) |
      rejectattr('entity_id', 'in', entity_filter) | list -%}       
           {{entities | length }}         
         {%- for entity in entities  -%}
         {%- endfor %}{%- endfor %} 

gives me the output
image

how to ged 6 instead of 5 and 1?

So, it looks like you are trying to get a count of lights that are on. But, you start with a list of areas with lights on.

I believe you have two areas with lights on. So, for each of those in the loop, you will get a count for {{ entities | length }}.

Your first area has 5 lights on and the second has 1 light on.

If you are going to keep this path of doing it, you will need a counter to add each length to.

If you do just want to get a count of lights on, you could use

{% set lights_on = states.light | selectattr('state','eq', 'on') | list | length -%}
{{ lights_on }}

You could put your reject entity list back in there. I kept it out to be clean.

so how would i do this?

It depends on what you want your final output to be. You will need to explain that for an answer.

i want to have the exact same script that i posted.
and the output should be a single number instead of one number for every area.

so even if i would have 3 areas it should still be a single number.

otherwise i would need a script to get the count of all lights which have the state ā€˜onā€™ and are assigned to an area (not to none)

i think your script would give me all lights even if they are not assigned to an area