🔹 Auto-entities - Automatically fill cards with entities

Testing in developer tools shows the first returns an array, the second does not. So for second you could try…

[
  {% for state in states.input_datetime %}
     {{ {'entity': state.entity_id, 'type': "button" } }},
  {% endfor %}
]

template-entity-row actions are templatable, but you need to return an object for the main action config, being tap_action for what you are after. See doco for more.

I do not recall this option in multiple-entity-row.
As well as

Perhaps you confused multiple-entity-row with a template-entity-row?

Thanks everyone, I got it working now.

Testing in developer tools shows the first returns an array, the second does not. So for second you could try…

This was one problem.

Perhaps you confused multiple-entity-row with a template-entity-row?

This was the other problem.

1 Like

so 2 of the sweetest new features in A-E beta currently, ignore_case in rename, and advanced state filter allowing an operator and entity_id:

  - type: custom:auto-entities
    show_empty: false
    card:
      type: entities
      uix:
        style: |
          .card-content {
            max-height: 200px;
            overflow-y: scroll;
          }
      state_color: true
    filter:
      include:
        - label: batterij
          state:
            operator: "<"
            entity_id: input_number.battery_alert_level
#       template: >
#         {%- set alert_level = states('input_number.battery_alert_level')|int %}
#         {%- set ns = namespace(batt_low=[]) %}
#         {%- for s in label_entities('batterij')
#           if is_number(states(s)) and states(s)|int < alert_level
#           and has_value(s) %}
#         {%- set ns.batt_low = ns.batt_low + [s] %}
#         {%- endfor %}
#         {{ns.batt_low}}
    sort:
      method: state
      numeric: true
    rename:
      method: friendly_name
      find:
        - " Batterij"
        - " Battery"
        - " level"
      trim: true
      ingore_case: true

thx Darryn for implementing this!

4 Likes

Can you tell me how to make a list of unavailable devices? Not entities, but devices. If a device is completely unavailable, its entities are also unavailable.

{% set ns = namespace(devices=[]) %}

{% for entity in states if entity.state == 'unavailable' %}
  {% set device = device_attr(entity.entity_id, 'name') %}
  {% if device and device not in ns.devices %}
    {% set ns.devices = ns.devices + [device] %}
  {% endif %}
{% endfor %}

{{ ns.devices | count }}

In a template sensor, that would be something like:

template:
  - sensor:
      - name: Unavailable Devices
        unique_id: unavailable_devices
        icon: mdi:lan-disconnect

        state: >
          {{
            states
            | selectattr('state', 'eq', 'unavailable')
            | map(attribute='entity_id')
            | map('device_name')
            | reject('equalto', none)
            | unique
            | list
            | count
          }}

        attributes:
          devices: >
            {{
              states
              | selectattr('state', 'eq', 'unavailable')
              | map(attribute='entity_id')
              | map('device_name')
              | reject('equalto', none)
              | unique
              | sort
              | list
            }}
2 Likes

Thank you. I created a template sensor and it started displaying the devices. Could you please fully share the card to display this custom:auto-entities

I do not use auto-entities myself, so no clue about that.

I can't display a list of devices. If I create a regular sensor to display an attribute as the main property, it complains about the length of the status text.

Dear colleagues, the issue of removing unavailable devices remains open. I am unable to implement this.

You can definitely solve this with the info you have. The auto entities card support templates. Otherwise, display this in a markdown card: remove the count, sort and add newlines.

States are limited to 255 characters. You can put this in an attribute though (and make the state e.g. the count).