I have a custom card YAML configuration that look like this (but more long)
type: vertical-stack
title: My ESP DEVICE
- type: horizontal-stack
cards:
- type: entities
entities:
- entity: switch.esp_my_presence_detector_engineering_mode
name: engineering mode
- entity: switch.esp_my_presence_detector_control_bluetooth
name: bluetooth
- type: horizontal-stack
cards:
- type: entity
entity: sensor.esp_my_presence_detector_move_energy
name: move energy
- type: entity
entity: sensor.esp_my_presence_detector_still_energy
name: still energy
... more here...
Where “esp_my_presence_detector” is the name of an esphome device.
I want to share that exact configuration with other devices, Is there a way to convert that into a reusable template or similar, where I can replace esp_my_presence_detector for another thing? Similar to ESPHOME sustitutions?
There do not appear to be any custom cards in the config you have shown. They are all core dashboard cards that do not support templates (v-stack, h-stack, entities and entity cards).
type: vertical-stack
title: My ESP DEVICE
- type: custom:decluttering-card
template: my_super_template
variables:
- SWITCH_TYPE_1: engineering_mode
- SWITCH_NAME_1: engineering mode
- SWITCH_TYPE_2: control_bluetooth
- SWITCH_NAME_2: bluetooth
- type: custom:decluttering-card
template: my_super_template
variables:
- SWITCH_TYPE_1: move_energy
- SWITCH_NAME_1: move energy
- SWITCH_TYPE_2: still_energy
- SWITCH_NAME_2: still energy
...
Also, you can call this “my_super_template” in auto-entities in a loop for every required device, but suggest you to start with just a simple call of the template (step 1).