Include file lists "destructuring-way"

Hello everyone,

I’m currently restructuring my ui-lovelace.yaml splitting with !include.
The problem I’m facing is that I would like to include many files, each of these files being a list of entities, but I can’t make it work.

Example:

parent.yaml:

card:
  type: picture-elements
  image: /local/ui/floorplan/floorplan-background.png
  elements:
    - action: none
      image: /local/image1.png
      type: image
    - !include elements.yaml

elements.yaml

 - action: none
    image: /local/image2.png
    type: image
 - action: none
    image: /local/image3.png
    type: image
 - action: none
    image: /local/image4.png
    type: image

this is not possible because it expects an element and elements.yaml returns a list, so I’m searching for a way of including it in a destructured way (all elements, but not as a list), not sur if i’m clear enough ^^

Many thanks in advance for those who will help me on that :smiley:

PS: this is an example, I know that in this example i could just move all elements of parent into elements.yaml and import it with

elements: !include elements.yaml

but in my real context I have to keep it that way and have some elements declared in the parent.yaml and others imported in different files

What you need is lovelace_gen
An custom integration

Thanks @deluxestyle for your answer! I didn’t know of lovelace_gen, seem like a wonder and I will try it, but I am not sure how it would solve my precise problem… Would you mind indicating how to use it to do so please?

try this

parent.yaml:

card:
  type: picture-elements
  image: /local/ui/floorplan/floorplan-background.png
  !include elements.yaml

elements.yaml

elements:
 - action: none
    image: /local/image2.png
    type: image
 - action: none
    image: /local/image3.png
    type: image
 - action: none
    image: /local/image4.png
    type: image