Splitting config for template:

My experience:

  1. Add this into “configuration.yaml”:
  packages: !include_dir_named conf
  1. Create a “conf” folder in the config dir.

  2. Create ANY tree structure in the “conf” folder:
    image
    where each subfolder may have other subfolders and so on.

  3. Inside any folder (let it be “network/net/asus_ac68u”, for example) create as many yaml files as you want.

  4. Every yaml file may have “sensor”, “template”, “input_boolean”, “automation”, “customize” etc sections (surely one same section per one file, i.e. one “sensor”, one “customize” etc).

The main idea is to structure a config by tasks (network devices, persons, weather, home climat, etc) - instead of piling all template sensors in one file.

Unfortunately, there is one limitation - you must use unique filenames.
I.e. you cannot have several “test.yaml” files in different folders - have to rename them to “test_router.yaml”, “test_waterpump.yaml” etc.
Created this issue, missed a moment when it was closed.

Also, if you want to exclude some functionality (like “got rid of this router”) - just remove the whole “router xxx” folder form the structure. Alternatively - rename all yaml files in this folder, replace “yaml” extension by something llike “disabled” (I use “dis”).
If you have several HA installation (apartment, country house, test setup, …) and some router is moved from one place to another - just move it’s particular folder into another installation.

Secrets may also be stored on several levels (local secrets, global secrets).

A similar approach may be used for Lovelace (dashboards, views, decluttering- (described here), button-card-templates & a brand new config-template-card global vars).

10 Likes