Creating packages with subfolders for config splitting

I need help on creating packages.
I have many IOT controller to incorporate into HA.
I am able to incorporate one controller using !includes like this in my configuration file and by having created a folder named controller1 and added the 6 yaml files into it:

group: !include controller1/groups.yaml
sensor: !include controller1/sensors.yaml
switch: !include controller1/switches.yaml
input_number: !include controller1/input_numbers.yaml
rest_command: !include controller1/rest_commands.yaml
automation: !include controller1/automations.yaml

it works!

BUT WHAT I NEED TO DO IS TO ADD 5 controllers like that.
When i try to add more !includes with the same name : group, automation, input_number etc… it doesnt like it.

SO I TRIED to packages … with

homeassistant:
packages: !include_dir_named packages

and creating a folder named : packages with other folder inside of it … like this: folder1: controller1, folder2: controller2… etc… and in each i put the 6 yaml files with all respectives names, also renamed every entities inside the 6 yaml files respectively for each controller.

i get error like :
expected a dictionary for dictionary value @ data[‘packages’][‘sensors’]

i then tried with :

homeassistant:
packages: !include_dir_merged_named packages

i get error like :
expected dict for dictionary value @ data[‘packages’][‘analog_output_1’][‘name’]

Please can someones help me make packages …

Thank you!

1 Like

Couldn’t you just simply use folder inclusion instead? It sounds like what you are trying to do. I do it this way and I find it much easier to manage the individual files:

script: !include_dir_merge_named scripts/
1 Like

Thanks , i found it … in my yaml files there was no component déclaration! !!
Screenshot 2021-01-05 232838

Thanks