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

Just wanted to share this little thing i came up with:

Auto entities lists all my areas and creates a area-card with temp, humidity and luxā€¦ still working on how to get a different icon for each area, dont wanna rename my rooms, but could be a possibilityā€¦

type: custom:auto-entities
filter:
  template: |
    [ {% for omrade in areas()|sort %}
      {{ 
        {
        'type': 'custom:streamline-card', 
        'template': 'klimakort',
        'variables': [
        {'entry': omrade}
          ]
        } 
      }} 
      , 
    {% endfor %}  ]
  include: []
  exclude: []
card:
  square: false
  type: grid
  columns: 2
show_empty: true
card_param: cards
sort: {}

and a decluttering card (streamline-cardā€¦ because that has a gui-editor lol)

streamline_templates:
  klimakort:
    card:
      type: custom:mushroom-template-card
      primary: '{{area_name(''[[entry]]'') | title }}'
      secondary: >-
        {% set temp = (area_entities('[[entry]]') | select('is_state_attr',
        'device_class', 'temperature') | map('states') | select('is_number') |
        map('float') | list or [0]) | average | round(1) %}

        {% set hum = (area_entities('[[entry]]') | select('is_state_attr',
        'device_class', 'humidity') | map('states') | select('is_number') |
        map('float') | list or [0]) | average %}

        {% set lux = (area_entities('[[entry]]') | select('is_state_attr',
        'device_class', 'illuminance') | map('states') | select('is_number') |
        map('float') | list or [0]) | average | round(1) %}

        {{ [ ('šŸŒ”ļø' ~ temp|int ~ 'Ā°C') if temp, ('šŸ’§' ~ hum | int ~ '%') if hum,
        ('šŸ”†' ~ lux | int ~ 'lx') if lux] | select() | join(' ') }}
      icon: hue:room-office
      entity: '[[entry]]'
      fill_container: true
      tap_action:
        action: navigate
        navigation_path: '#popup-[[entry]]'
      layout: vertical

2 Likes

Doesnā€™t the normal area card do exactly what the custom area template card youā€™re making does? Even shows the icons for each area

Yes it does but imo its fugly and dosent fit the rest of my design :see_no_evil:

I just activated all ā€œlast seenā€ attributes of the entities:
image

It should be possible to sort the entities regarding to their last seen status or not?
Can anybody help me to get the correct yaml working?
I am struggling with it :frowning:

edit:
got it:

type: custom:auto-entities
card:
  type: entities
filter:
  include:
    - entity_id: sensor.*_last_seen
sort:
  method: last_changed
  numeric: false
  reverse: false
1 Like

Does this mean that, if I have 20 sensors with a specific attribute I want to show on this card, I need to create 20 template sensors out of that attribute to be able to use the auto entities card?

Probably that advice was given when Entities card was not supporting ā€œattributeā€.

Alright, Iā€™ve come back to this - I have a lot of great auto-entities cards made on my dashboard now and yet itā€™s the original one that is messing with me the worst. Hereā€™s what Iā€™ve got:

type: custom:auto-entities
show_empty: true
card_param: chips
card:
  type: custom:mushroom-chips-card
  alignment: justify
filter:
  include:
    - domain: scene
      area: Living Room
      options:
        type: entity
        content_info: name
        tap_action:
          action: toggle
  exclude: []
sort:
  method: friendly_name

This is nice, except that it causes the scene to toggle on instantly. This is kind of abrupt when Iā€™m wanting to set the scene when we have guests.

Hereā€™s the data from the chips card if I want to have it call the action to turn on a scene:

type: custom:mushroom-chips-card
chips:
  - type: entity
    entity: scene.SCENENAME
    icon_color: accent
    tap_action:
      action: perform-action
      perform_action: scene.turn_on
      target:
        entity_id: scene.SCENENAME
      data:
        transition: 5

Iā€™ve tried just copying and pasting the tap-action into the options field in Auto Entities but it does not want to pick a specific entity to target. Iā€™m not even messing with the transition value until I can get the auto entities - chips interaction to work. The syntax I used to try to accomplish that is

tap_action:
  action: perform-action
  perform_action: scene.turn_on
  target:
    entity_id: []

What am I missing?

Not using any mushrooms. Try this way:

type: custom:auto-entities
card:
  type: entities
filter:
  include:
    - domain: switch
      options:
        type: simple-entity
        tap_action:
          action: perform-action
          perform_action: switch.toggle
          target:
            entity_id: this.entity_id

I am simply listing the scenes with their picture, like this (decluttering card template):

    - type: custom:auto-entities
      card:
        type: grid
        columns: 8
      card_param: cards
      filter:
        include:
          - domain: scene
            area: '[[area_id]]'
            options:
              type: custom:button-card
              template: button_scene

resulting in:

or with a simple listing:

      - type: custom:auto-entities
        card:
          type: entities
          title: Nu scening
          card_mod:
            class: class-header-margin
        show_empty: false
        filter:
          include:
            - attributes:
                dynamics: dynamic_palette

resulting in

and nothing gets initiated automatically

what happens if you just leave out the action?

Edited the original post - realized I had the bad syntax in instead of the working one on the original example

@Ildar_Gabdullin why no mushroom cards? I have been using these cards since day 1 - I like the look and the ease of configuration.

@Mariusthvdb The lack of action on each button gets me a nice list on the dashboard with no way to easily apply them from the dashboard. Using

action: 
  action: toggle

Works, but it applies the scene with zero fade. There is no option with the toggle to have a transition - I tried.

Do not like round design, do not like seeing lot of space wasted.
I already proposed you a way of defining a target, did it work in your card?

I get the mushroom cards arenā€™t for everyone. As far as your example, thatā€™s essentially the same as I have, which works by instantly applying the scene. My goal is to have a transition period.

How oddā€¦ if I click these scene pictures, theyā€™re applied directly.
Maybe it is the mushroom specifics toying with you hereā€¦ I try to avoid Mushroom though, so cant really help you there

you are aware of Scenes - Home Assistant ?
meaning, you cant click on the scene itself to have it have a transition, you need to add that to the action data

nevermind me, you had that in your example aboveā€¦ sorry

Found my answer in the auto entities docs. Here is the working YAML to put in options:

type: entity
content_info: name
tap_action:
  action: call-service
  service: scene.turn_on
  target:
    entity_id: this.entity_id
  data:
    transition: 5

Hi,
Iā€™m trying to exclude lights that are in a group, why does not this work?

type: custom:auto-entities
show_empty: false
card:
  show_name: true
  show_icon: true
  show_state: false
  type: entities
  title: All lights that are on
  state_color: false
filter:
  include:
    - domain: light
      state: "on"
      options:
        tap_action:
          action: toggle
  exclude:
    - domain: group
sort:
  method: name

The group ā€œHobbyrumā€ should not be in the listā€¦ right?

How did you create the light group? Old style via YAML? Or new style via the Helper GUi?

If you did it via the GUI, it will likely be part of the light domain and not excluded by your filter. The entity_id will confirm it either way.

please search this thread, there is a rather large section about the exact same issue you are trying to solve now

1 Like

yes, via guiā€¦ .I will check further in this thread, thanks

If you use the current groups you can set in the UI, then these are still a light.something entity ā†’ they are under the light domain, not the group domain (then it would be group.something). I believe group is an integration. Try it with

exclude:
  - integration: group
If that fails, have a look at this

šŸ”¹ Auto-entities - Automatically fill cards with entities - #1489 by loocd

I have a somewhat more complicated setup where I want to hide both groups as well as their members and display those separately. Iā€™ve managed to get this done with the help of @Christian-1982 and @Mariusthvdb.

Iā€™ve made some adjustments to perfect this, so let me know if this is what you need. But Iā€™m fairly sure that you just need to fix your exclude statement.

hi all how would you include this:

light.lamp01

min_color_temp_kelvin: 2000
max_color_temp_kelvin: 6666
min_mireds: 150
max_mireds: 500
effect_list:
  - blink
  - breathe
  - okay
  - channel_change
  - candle
  - fireplace
  - colorloop
  - finish_effect
  - stop_effect
  - stop_hue_effect
supported_color_modes:
  - color_temp
  - xy
effect: null
color_mode: null
brightness: null
color_temp_kelvin: null
color_temp: null
hs_color: null
rgb_color: null
xy_color: null
color:
  h: 25
  hue: 25
  s: 45
  saturation: 45
  x: 0.382
  "y": 0.354
color_temp_startup: 370
linkquality: 51
power_on_behavior: null
update:
  installed_version: 16786434
  latest_version: 16786692
  progress: 5.82
  remaining: 17153
  state: updating
update_available: false
friendly_name: Lys Econic 2
supported_features: 44

i want to display the progress in % I can make a template sensor like this

{{ state_attr('binary_sensor.loftlampe02_update_available' , 'update').progress }}

then I get the progress but not sure how to do this in auto entities if possible?

i have tried like bellow but not there yet

filter:
  include:
    - domain: light
      attributes:
        update.progress: < 100

anybody knows ?