New !include option?

Would like to see an option that allows you to define all the component options in a single file and merge it with the entire configuration.

Setup a my_light.yaml and allow you to include…
automation:
customization:
script:
group:
etc…

Then have that file merge it’s sections with all the other .yaml files that you have.

Most breakouts are based off component + definition. So if you add a temporary component (i.e. christmas tree light) then later you have to go remove all the remnants.

Thoughts?

2 Likes

I’m not sure this is the answer but I agree that all these remnants are a pain with the holiday lights coming and going. Being able to do the groups and customizations in one component file would be cool. for me though, I do a global search on my configuration to find all the little pieces.

I would like this if for no other reason than it keeps me from having to bounce around between configuration, automation, group and customization files while I’m trying to setup a new component.
#include” probably would not be the correct syntax since it would look like a comment, but pick another special character like $include or %include and you have a winner.

These files need to be able to be nested as well.
So I could include a generic “lights.yaml” file and that file includes individual components for my hue, and oshram lights.

But that also begs the question, is this an extension to YAML and are we able to do that?

Sorry shouldn’t have used the “#include”, I updated the post to follow the current “!include” syntax. Ultimately it would be a different alternative to the multiple !include options, except this one would merge all the files to allow for “object” configurations that includes all components that are related.

Another thought is a utility that would “compile” the files (merge them) and produce a “configuration.yaml” file that would be used by HASS at startup.

I actually think the utility idea is an awesome idea. Having a script that could compile correctly formatted yaml files into their appropriate directories would be awesome. folder structure could look something like this:

.homeassistant
–components
--------backyard_switch.yaml <- this would be a master file with different ‘objects’ - customization, group membership, etc
–customize
–group
–sensor

I’m good with the utility. Anything to help organize the file a little better. Currently breaking it out by “type” is nice, but I think we need to go farther.

Yeah - that is a really good idea.

I work profressionally in control systems, and this is typically how a project is set up, by equipment, rather than by function.

I agree. It would be nice to containerize each device\sensor\equipment and all it’s interaction into one file. Let HASS merge all the containers\objects into its master config file. The more I add devices the more burdensome it gets to open multiple files (I know could keep it all in one, but that’s even a bigger pain) just to integrate a component, script, automation, sensor, group, customize, etc.

I’m hoping someone picks this up. To much scripting\python for me to tackle.

@happyleaves FYI. Since you worked on the original !include. :slight_smile:

Did anything come of this? I was fighting with the display problems several people seem to be having this week and decided just to create a default_view group and put everything in that. I wrote a quick utility to go out and find all the devices in HA and create a text file. It sure would be nice if I could do that dynamically and put it into an include file when I restart to add a new device. It would take two reboots but until they get the UI issues straightened out, it would let me keep working.

@turboc Actually, it was implemented with the new “Package” functionality. Exactly what I was looking for. Now you can put all the options for one device in its own YAML file and HA will merge it behind the scenes.

1 Like

Just posting a link I found for anyone else looking