Merging Lists in Lovelace YAML mode

I’ve got YAML mode enabled and working. Now I’m trying to dynamically construct a list of “chips” in a Mushroom card, alongside some hard-coded items. Basically this is what I’m trying to do:

cards:
  - type: custom:mushroom-chips-card
    chips:
      - !include ./resources/some_chips.yaml
      - type: alarm-control-panel
        entity: alarm_control_panel.alarmo
      - !include ./resources/more_chips.yaml
    alignment: center

some_chips.yaml/more_chips.yaml look more or less like this:

- type: conditional
  conditions:
    - entity: vacuum.kirby
      state_not: docked
  chip:
    type: template
    entity: vacuum.kirby
    icon: mdi:robot-vacuum
    tap_action:
      action: more-info
    icon_color: |-
      {% if not is_state("vacuum.kirby", "cleaning") %}
        red
      {% endif %}
    content: '{{ states("vacuum.kirby") }}'
...

Where the chips.yaml cards are just lists of chips. The !included items don’t show up. I can do this:

cards:
  - type: custom:mushroom-chips-card
    chips: !include ./resources/some_chips.yaml
    alignment: center
  - type: custom:mushroom-chips-card
    chips:
      - type: alarm-control-panel
        entity: alarm_control_panel.alarmo
    alignment: center
  - type: custom:mushroom-chips-card
    chips: !include ./resources/more_chips.yaml
    alignment: center

But I can’t seem to get one card with all the chips in it. I’ve flailed around a bit trying to use anchors, but… Nothing seems to work. I think I must be missing something here, some way to get all the lists to merge/append.

Anybody have any hints for me?

Ask here…you may get some headway.

Thanks for the reply, after a good night’s sleep and some additional Googling, it appears the YAML spec doesn’t support merging sequences, which is the problem I am running into.

Basically, no matter which syntax we use, including merging anchors:

cards:
  - <<: *some_anchor
  - !include some_file.yaml
  - More
  - Stuff

Will be interpreted as:

cards:
  - ["anchor", "contents"]
  - ["yaml", "file", "contents"]
  - More
  - stuff

Or exploded:

cards:
  - - anchor
    - contents
  - - yaml
    - file
    - contents
  - More
  - stuff

In other words, we get a nested list. YAML can’t (and/or doesn’t) flatten lists, as there’s currently not an unambiguous way to append to sequences. Some parsers have played with it, but it’s definitely not standardized.

I suppose I’ll have to come up with another way to do this. Probably a bunch of anchors and some declutter cards.