More efficient YAML configs for similar entities

Hi

Not sure if I am asking something sensible: I find myself creating multiple copies of the same yaml config (e.g. utility_meters) for each new device I add and want to track energy use, something like

cooking_all_energy_monthly:
  unique_id: "08uo84ytjo934yjoq3tqojpt9w4o5wyertybpojrotpq8py"
  source: sensor.cooking_all_energy
  name: "Cooking All Energy monthly"
  cycle: monthly
  net_consumption: true

And I have a bunch of similar entries just replacing “cooking all” with “climate all” or “network all” or “fridge” or “oven”.

Is there some way to just list the devices as an array of some sort in the yaml and have e.g. the utility_meter config run over the arrray?

Search for “YAML anchors”.