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:
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.
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:
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.
Short answer is no, it’s a hard limitation, combining YAML lists won’t work without changes to the YAML parsing in Home Assistant that (might) reduce backwards compatibility. So don’t hold your breath, I would not be surprised if this never works.
That said: My long answer is, sorta/kinda. I am able to do everything I wanted without this functionality, but I had to get a little creative and in short I’m using parameterized Decluttering Cards and anchors. The anchors are then included in the decluttering card definitions.
This particular example isn’t parameterized and therefore I don’t think it has to be a Decluttering Card. That said, there are some other oddities related to parsing order that I remember struggling with and I think Decluttering Card helped solve some of those issues. Anchors are parsed early so you can’t have any variables in them but I honestly can’t remember the specifics.