I am trying to split my configuration for better maintainability but I think I am doing something wrong.
My requirement is to put repeated info like mqtt info etc into a common yaml file and then include this in all ESP device yamls I create. While I am able to do this, there are 2 issues I am facing:
I am not able to access the secrets values in the include subfolder inside the ESPHome folder.
One of my requirement is to be able to override newer configuration variables for a component in future in specific device yamls. I dont seem to find a way out of that.
For 1 , I get an error Error reading file /config/esphome/include/secrets.yaml: [Errno 2] No such file or directory: '/config/esphome/include/secrets.yaml'
I tried including the following line in mqttinfo.yaml but still get the same error: <<: !include ../secrets.yaml
ESPHome doesn’t seem to be following the order of finding the secrets.yaml by going to the parent esphome directory, it keeps searching in the esphome/include.
For 2. I would want to include additional options, for eg. reboot_timeout: 0s in some device yaml in future. like eg below:
sorry for jumping in this conversation but I have to ask: does this mean that I willl end up with two secrets.yaml files? one for the main configuration.yaml and one inside the esphome folder? is this allowed and this is the way things are supposed to be setup? I am really new at this and I am trying to organize the configurations so I can manage future device integrations.
However if you include this line in the secrets.yaml file that is in the esphome folder:
<<: !include ../secrets.yaml
This will pull all the secrets from your existing secrets.yaml file in the /config folder.
So you can enter the esphome specific secrets in either file, but both must exist.
Also if your home assistant secrets file is not in the root of the /config folder you would have to adjust the include path in the esphome secret file.
Hi, I dont think the solution of referring the base secret file from the esphome secret file is straight forward. At least I was not able to make it work the way Otto Winter suggested and how @tom_l has suggested here.
Please see this thread where I raised this issue and ultimately fixed it by compiling a custom version of esphome by making a simple change in the dockerfile. I know everybody may not want to compile a custom version of esphome but then i couldnt make it work any other way.
ESPHome does not look the the secret file there. There is an ESPHome folder in your config dir, after installing ESPHome. You have to add the secrets file there for the items you want to use in the ESP config.
Hi @Lifelogger , that’s exactly I don’t want. I don’t want to maintain two different copies of secrets. I have one secrets in the home assistant config folder and i want to refer to that in esphome. And that’s what I have achieved by what I wrote above.
Thank you, I hoped something changed in the meanwhile.
The strange thing is that in this official guide: Configuration Types — ESPHome
The above example about packages it suggest that may work.
Am I wrong or it is an error of the documentation?