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.
my_device.yaml is as follows:
substitutions:
base_topic: 'home/tank_controller'
esphome:
name: tank_controller
platform: ESP8266
board: d1_mini
wifi:
ssid: !secret secondary_ssid
password: !secret secondary_ssid_pswd
<<: !include include/mqttinfo.yaml
api:
etc etc
I have the mqtt yaml file in esphome\include\mqttinfo.yaml
mqtt:
broker: !secret mqtt_broker
username: !secret mqtt_uname
password: mqtt_pswd
topic_prefix: ${base_topic}
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:
my_device.yaml in future:
substitutions:
base_topic: 'home/tank_controller'
esphome:
name: tank_controller
platform: ESP8266
board: d1_mini
wifi:
ssid: !secret secondary_ssid
password: !secret secondary_ssid_pswd
<<: !include include/mqttinfo.yaml
reboot_timeout: 0s
api:
etc etc
Can somebody help me on both of these.