thomasloven / lovelace-auto-entities

🔹Automatically populate the entities-list of lovelace cards
MIT License
1.24k stars 113 forks source link

bulk rename entites #289

Closed Kilowatt-W closed 1 year ago

Kilowatt-W commented 2 years ago

Hello there,

thx for you nice work, I really like it.

I would have an idea 👍 maybe its possible to make something like a bulk-rename for filtered entities ?

bulk_rename:
  - from: "battery"
  - to: ""
  - from: WIFI
  - to: "WLAN"

When I select some entities its most of the time with the same useless text in the display like :

WIFI Signal xxx WIFI Signal xx1 . ..

This information could be removed because its always the same.

I saw this feature in the custom:battery-state-card and find it really usefull.

Maybe you can get it from there or implement something similar ?

Greetings from Austria

Kilowatt

ildar170975 commented 2 years ago

If you are speaking about a "changing a displayed name" - it is already possible (as well as many other things) with a template option:

  - type: custom:auto-entities
    card:
      type: entities
    unique: true
    show_empty: true
    filter:
      template: |-
        {% set BATTERIES = states.sensor | specify your criteria here -%}
        {%- for battery in BATTERIES -%}
          {%- set NAME = battery.entity_id -%}
          {%- set NAME_SHORT =  NAME.split('sensor.battery_')[1] -%}
          {{
            { 'entity': NAME,
              'name': NAME_SHORT,
              'secondary_info': 'last-changed'
            } }},
        {%- endfor %}
    sort:
      method: state
      numeric: true

изображение