Entity as a variable

Hi,

I’m splitting my configuration into mutiple file/card so it’s easier to share my custom dashboard with people.
But I can’t find a way to pass an entity through different file.
Here a sample of code of what I would like to do

FileA.yaml

views:
  - type: custom:grid-layout
    title: home
    cards:
      - type: custom:mod-card
        variables:
          climate_entity = climate.entity
        card: !include FileB.yaml

FileB.yaml

 type: custom:button-card
 entity: variables.climate_entity

so when someone want to duplicate my dashboard, he just have to change the entity(climate_entity) in FileA and if I update the code in FileB the user is not impacted.

Here is a list of things I tried:

  • &anchor = work only into one file
  • using template to reference the information = become really complexe for entity like climate or weather
  • custom: button-card = can’t pass an entity as variable
  • input_text

Any idea is more than welcome.

!include only works in YAML mode.

yes, I’m in YAML mode, the example is just to show the variable passing between file.
The rest of the code is just for show.