String to cards?

Hi all!

I wonder this, is there any way to get a string, break it into elements, and create different cards for each element?

For example it you have an entity with this value “1, 2, 3”, and you want to take it to create 3 button cards with 1, 2, 3 title respectively

Thanks!

type: vertical-stack
cards:
  - type: entities
    entities:
      - entity: input_text.test_text
  - type: custom:auto-entities
    card:
      type: horizontal-stack
    card_param: cards
    filter:
      template: >-
        {% set SENSORS = states('input_text.test_text') -%}
        {%- for INDEX in range(3) -%}
        {{
          {
            'type': 'button',
            'entity': 'sun.sun',
            'name': SENSORS.split(' ')[INDEX]
          }
        }},
        {%- endfor %}

изображение

1 Like

Million thanks!!!

1 Like

Do you think is there any way to apply Card Mod styles to the child cards? (button in this case)

Thanks!

Goto auto-entities thread & search for “card_mod”.

1 Like