How to use labeled template integrations

I’ve spent days trying to figure this out. I have a set of template sensors that are conceptually related, and are included using template: !include templates.yaml. This includes a mix of binary_sensors and sensors.

There’s another set of template sensors that are not conceptually related, and I want to split their definitions into a separate file. These are only sensors.

From what I can understand from the article on splitting the configuration, this can be done with labels, something like this:

template: !include templates.yaml
template other: !include other_templates.yaml

However, I am not able to find the sensors from other_templates.yaml - the ones in templates.yaml show up and work the way they should. If I copy the definitions from other_templates.yaml into templates.yaml it works fine.

Am I misunderstanding how to use the labels?

Did you make sure to restart HA? Neither reloading templates alone or a full YAML reload from the Dev Tools will not load new files.

FWIW, packages are so much easier than messing with all those !include tags and labels:

In addition to easy, they are very flexible allowing you to organize the configurations to your preference. If you want a file to just contain the template binary sensors of one room, you can do that. If you want one file to contain configurations from multiple integrations because they function together, you can do that too.

Not sure why labelled include doesn’t work here, but a better way is to include a full subdirectory, imo:

template: !include_dir_merge_list platforms/templates/

1 Like

Yep, same here:

template: !include_dir_merge_list templates

and a whole stack of separate files in config/templates.

Thanks, packages seem to be the best solution. Still not sure why the labels didn’t seem to work - I could have sworn I’d tried restarting, but after days of trying, I can no longer say for sure what’s been tried.

You realize we are not suggesting packages, right?
Package is a feature I never used and that doesn’t seem to be relevant, here.

You didn’t, true. Didgeridrew certainly did seem to. The feature seems to do exactly what I want (group conceptually related configuration) in exactly the way I want it to, so I’m not sure why it wouldn’t be relevant.

Ah sorry, missed his response.