Allow packages have same filename

I am using a “splitting configuration” way with packages:

homeassistant:
  ...
  packages: !include_dir_named conf

Got this structure in my %config% directory:

where the “conf” directory contains some subdirectories & files dedicated to different parts of HA:
изображение

It works fine.

Suppose a have a file “test.yaml” in some “/network/router/asus” directory for storing sensors, helpers etc. This file is made for testing.
When I create another file “test.yaml” in some other location - then this file seems to be just ignored:

  • no sensors, helpers etc are created which are specified in this file;
  • there are no any warnings & errors in Log.

I was explained that a package’s filename is used as a key. Since keys must be unique then package files should be with unique filenames.

Since files may be located in some subfolders - then probably these “keys” could include these relative paths, so they become unique. I propose to change a way how packages are processed to allow same filenames.

I wonder if it has to do with the reloading of config files. Otherwise, I can’t really see why this is needed (and even then it is possible to build a composite key), since it’s only the contents of the YAML files that matter.

I fully agree, I myself have written code that behaves exactly the same as the code in HA, and I got caught short when the same file name was found in multiple folders, so I just used the path from the root and the filename for the hash key in my lookup table.

I have not looked at the codebase in HA where the keyed lookup is generated, but unless the data structure produced is retained for use beyond the YAML parsing (i.e. mapping integrations to files for YAML reload functionality), I would be surprised if altering the keys in the structure would have impact beyond the parser and would constitute a breaking change as was suggested here (https://github.com/home-assistant/core/issues/75327)