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

of courseā€¦ sorry I missed that. Still, no sure Im doing it as it should now:

  - type: custom:auto-entities
    card:
      type: entities
      title: All Scripts auto
      show_header_toggle: false
    filter:
      include:
        - domain: script
          options:
            secondary_info: last-triggered
    sort:
      method: attribute
      attribute: last_triggered
      reverse: true

it does make a difference, but is not consistent over the full list:

the scripts which havenā€™t been triggered yet donā€™t show a secondary_info line, do they cause havoc? Why are they not listed at the bottom ?

That may very well be the problem. last_triggered is a rather new feature which I havenā€™t looked into yet, but since Itā€™s a timestamp I imagine it should require some special treatmentā€¦

1 Like

sure, I made the PR for showing it on Lovlace-cards secondary_info in the first placeā€¦
Just now added the ā€˜bugā€™ discussion to add a ā€˜neverā€™ on that row if not yet triggered: https://github.com/home-assistant/home-assistant-polymer/issues/4428

awaiting that, do you have any suggestions for the order in this auto-card? Could I maybe only show the last 5 last_triggered entities by adding count: 5, to prevent constant re-rendering of the view?

please let me put forward another challenge I canā€™t find the solution for yet. Id like to auto create a card with all views to be able to create a ā€˜Castā€™ card. I now have this manually setup:

  - type: entities
    title: Cast Control
    show_header_toggle: false
    entities:

      - type: cast
        name: Home
        view: 'home'

      - type: cast
        name: System
        view: 'home_assistant'

      - type: cast
        name: Lights
        view: 'lights'

I can add all 23 tabs (ā€¦) of course, but couldnā€™t I somehow use the auto-entities card to create this. Simply follow the setup in ui-lovelace.yaml, and read the title (name) and path (view) into this cardā€¦

edit probably no, since these arenā€™t entitiesā€¦maybe something like lovelace_gen could do thisā€¦

Hi there,
Iā€™m trying to use auto-entities,layout-card and the button card to show lights as buttons if they are on.

It works like a charm but I like to put a header over the buttons (e.g. markdown card). I set the parameter show_empty:false in auto-entities-card. If there are no lights on, the auto-entities-card is not shown. But how could I hide a the header?

Example:

- type: vertical-stack
  cards:
          - type: markdown
            content: '#### Eingeschaltete Lampen'
          - type: custom:auto-entities
            show_empty: false
            filter:
              include:
                - domain: light
                  state: "on"
                  options:
                     type: custom:button-card
                     entity_id: this.entity_id
            card:
              type: custom:layout-card
              layout: horizontal
              min_columns: 3

struggling with the exclude of an attribute to be unavailable, please help me how I should code it in the auto-entities config:

  - type: custom:auto-entities
    card:
      type: entities
      title: Multiple lights
      show_header_toggle: false
    filter:
      include:
        - domain: light
          options:
             type: custom:multiple-entity-row
             entity: this.entity_id
             toggle: true
             primary:
               entity: this.entity_id
               attribute: brightness
               name: Bri
               unit: '%'
             secondary:
               entity: this.entity_id
               attribute: color_temp
               name: Color
             tertiary:
               entity: this.entity_id
               attribute: rgb_color
               name: Rgb
             info:
               entity: this.entity_id
               name: Rgb
               attribute: rgb_color
      exclude:
        - attributes:
            color_temp: unavailable

everything works, up to the excludeā€¦ Shows all of my lights, with the 3 attributes.

Of course I will create two configs, 1 for color_temp and one for rob_color, but for now this is an exercise.

I can use the template filter to do this:

    {%- for light in states.light %}
      {%- if light.state == "on" and light.attributes.color_temp != unavailable %}
        {{ light.entity_id}},
      {%- endif %}
    {%- endfor %}

but because of the mentioned caveat (no auto reload) I donā€™t wat to use that.

Please have a look what I should do? thanks!

update

once you know what to look for, things get nice:

  - type: custom:auto-entities
    card:
      type: entities
      title: Multiple lights
      show_header_toggle: false
    filter:
      include:
        - domain: light
          state: 'on'
          attributes:
            rgb_color: '! none'
          options:
             type: custom:multiple-entity-row
             toggle: true
             secondary_info: last-changed
             primary:
               entity: this.entity_id
               attribute: brightness
               name: Bri
               unit: '%'
             secondary:
               entity: this.entity_id
               attribute: rgb_color
               name: Rgb

        - domain: light
          state: 'on'
          attributes:
            color_temp: '! none'
          options:
             type: custom:multiple-entity-row
             toggle: true
             secondary_info: last-changed
             primary:
               entity: this.entity_id
               attribute: brightness
               name: Bri
               unit: '%'
             secondary:
               entity: this.entity_id
               attribute: color_temp
               name: Color

thanks Thomas and @benct for creating 2 magical cards working together!

8 Likes

Hi! Is it possible to support expanding a light group in to the component entities? Liek you do with group, but with light group.

Thank you,

James

No. For all intents and purposes a light group is a light. There are no ways for the frontend to extract itā€™s constituents.

OK; thanks. Thatā€™s a shame. Currently have to specify the groups twice (as light groups to use them as lights and as group groups!) in order to tidy up my lovelace.yaml and use the group card.

building on my post above excluding the entities color_temp: ā€˜! noneā€™ I am now trying the opposite, and only show lights with color_temp: 'none', or automations with last_triggered: 'none' bit that fails completely.

Canā€™t we filter on a not set attribute?

Found a solution by myself. I wrap it in a conditional card. Only problem is that I need a group with all lights to handle the condition (auto-entities filters the same group than). Thatā€™s not the perfect way because new lights need to be added to the group but it works.

Is it possible to use Jinja2 templates in attributes filter?

something like this:

filter:
  include:
    - attributes:
      last_seen: "< {{(as_timestamp(now())-3600)}}"

or it is needed to use the template filter with the mentioned restriction?

Edit: And if the template filter is used is it possible to set the options for another card like include filter?

1 Like

One of the last updates to this card has stopped working correctly with geo_location entities that can come and go. I am getting the dreaded yellow bar error when an entity is no longer available instead of it just disappearing. When I refresh it disappears. This was always automatically handled but one of the latest updates has stopped.
image

1 Like

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

I finale found the way to do soā€¦:

  - type: custom:auto-entities
    card:
      type: entities
      title: Lights only brightness
      show_header_toggle: false
    filter:
      exclude:
        - domain: light
          attributes:
            rgb_color: '! none'
        - domain: light
          attributes:
            color_temp: '! none'
      include:
        - domain: light
          attributes:
            brightness: '! none' # filter browser_mod
          state: 'on'
          options:
             type: custom:multiple-entity-row
             toggle: true
             secondary_info: last-changed
             primary:
               entity: this.entity_id
               attribute: brightness
               name: Bri
               unit: '%'

what surprised me was I needed to declare the exclusions almost completely double, and could not ad both attributes under the same exclusion. anyways, this give me exactly what I hoped for, (next to the other auto-entities lights cards, explicitly Including the rgb_color and color_temp lights)
nice!

Turns out this is actually a problem with fold-entity-row, which is fixed in release 12.

1 Like

I have two questions. First, how can I specify a list to the name filter? For example, I would only like to only display entities that have friendly names of ā€œ550ā€, ā€œ231Nā€, ā€œ235ā€, ā€œ235Nā€ or ā€œ553Kā€.

Secondly, the documentation says that one can nest auto-entities. Iā€™m not exactly sure if that is the same thing that is done on multiple cards on the example image (for example, the card ā€œBasic filtersā€ has multiple sections with different auto-entities). I tried to replicate this, but did not get it working. If possible, could you post a example configuration of a card that has multiple section of different auto-entities.

Thank you as always, your work with these custom cards is phenomenal.

Easiest way is to add one filter for each name:

include:
  - name: "550"
  - name: "231N"
  - name: "235"
  ...

Of course, if thereā€™s a regularity to the names, you might be able to match them with a regular expression like:

include:
  - name: /[0-9]{3}[NK]?/

Nesting auto-entities means to put one auto-entities inside another, like

type: custom:auto-entities
  card:
    type: custom:auto-entities

As I say, it can be done, but I donā€™t see any reason to do it.

The cards in the picture uses section rows to divide different filtered parts, like in the 5th example in the readme on github.

1 Like

@thomasloven I am using this card. Config:

          - type: entities
            entities: 
              - type: custom:auto-entities
                card:
                  type: custom:fold-entity-row
                  head:
                    type: section
                    label: Current Incidents
                  open: true
                filter:
                  include:
                    - entity_id: "geo_location.nsw_fire_service_feed_*"
                    - entity_id: "geo_location.lightning_strike_*"
                  exclude:
                    - state: unknown
                show_empty: true
                sort:
                  method: state

Set to sort by state but this happens:

image

Obviously sorting alphabeticallyā€¦ is there any way to sort by the numeric value of the state?

Yes.

1 Like

Thanks. Missed that option. Cheers.

1 Like