A little guidance needed to develop an addon that will create 20 custom template sensors in the configuration.yaml

I would like to develop an add on that has rather simple functionality.
It will take the name of a /dev/ttyUSB port from the configuration GUI as input.
Using this port name it will create about 20 custom template sensors in the configuration.yaml

Although I don’t think an add on can modify the configuration.yaml file. So is there a way that the add on could write an include file with the template sensors and then the user would just need to reference that include file in the configuration.yaml?

How do I go about doing this?
Many many years ago I wrote a lot of code and shell scripts. Was also a Unix Sys Admin
I have read the add on doco but it is very light on. Or maybe there is better doco somewhere else?

Thanks in advance

Why would you want to use addons for this?
As it seem a one-time operation, a simple script would do.

That is my problem. I am not sure if I need to develop an an addon, integration or just a script.
How would a script acheive this?

You could use yaml includes, e.g., in configuration.yaml

template: !include templates.yaml

or

template: !include_dir_list templates_dir

then your script would generate the content

See

1 Like

Yes this is the easiest to implement.
Thanks