Configuration - merge multiple arrays (sensors, automation, scripts)

Currently the only way to make the config file lean is to separate sensors, automation, scripts in separate files. Writing specific code for a device many times involves a sensor, few scripts and few automation entries, possibly extra inputs and so on. These all end up in multiple files which makes it harder to track and edit and doesn’t seem as organized as it could be.

I think it would be easier to code and track bugs if every piece of functionality could be in its own file, including sensors and associated scripts and automation snippets. This means that the configuration code should recognize that these yaml files have arrays that have already been defined elsewhere and merge them automatically.

I don’t know how easy this would be to implement, but IMHO would make code more readable, easier to debug and share.

Isn’t this possible with packages?

That’s perfect! I didn’t see any reference to packages in the articles I’ve read about getting a leaner config file. It might help to have a link so that other newbies would know this is an option.

1 Like