Just realize that I should add secrets.YAML and base on information the way to do it is adding esphome/secrets.YAML with this <<: !include ../secrets.yaml
I reboot my HA and the ESPHome Addon, on my ESPHome I already see secrets editor,
however, when I add !secret on my ESPHome device I got a red X on the first line saying it did not find secrets.YAML or error.
So I did not dare to go through worrying my device will become disabled.
Does anyone know what I did wrong?
Running HA 2021.7.4 with supervised + ESPHome AddOn. The ESPHome Directory is inside the config directory.
Sorry for necroposting, but I faced some problems with this issue too. But it seems to only be a problem with the add-on “File editor” for me, not an actual problem. I run a supervised instance.
As soon as I enter the required <<: !include ../secrets.yaml in the /config/esphome/secrets.yaml file through File editor, a red exclamation pops up in File editor with a weird message:
cannot merge mappings; the provided source object is unacceptable (1:29)
1 | <<: .include ../secrets.yaml "
---------------------------------^
Initially I thought I had the same problem with the others and tried to debug. But I gave up and just thought to try to compile and upload to a node. YAML was validated, compilation completed without any errors and as soon as the firmware was uploaded, the node connected to wifi just fine. I had initially replaced the wifi_ssid name only, and went on and tried with wifi_passw after that. It worked too. So in my case it’s just a false positive on the File editor’s GUI, nothing more than that.
If someone has figured out what that message means, please let us know.
I have the same problem posted by @Tryfos. Is there a solution that the HA File Editor does not complain as described? Even knowing that it works nevertheless, it is a bit “disturbing”.
Home Assistant 2023.4.6
Supervisor 2023.04.1
Operating System 9.5
Frontend 20230411.1 - latest
PS/EDIT: Unfortunately, with this …
<<: .include ../secrets.yaml
… in /config/esphome/secrets.yaml
… I cannot update, because the update quits with this error message:
Updating /config/esphome/esp32-ha1.yaml
------------------------------------------------------------
INFO Reading configuration /config/esphome/esp32-ha1.yaml...
ERROR Error while reading config: Invalid YAML syntax:
While constructing a mapping
in "/config/esphome/secrets.yaml", line 1, column 1:
<<: .include ../secrets.yaml
^
Expected a mapping or list of mappings for merging, but found <class 'esphome.helpers.EStr'>
in "/config/esphome/secrets.yaml", line 1, column 5:
<<: .include ../secrets.yaml
^
========== [ERROR] /config/esphome/esp32-ha1.yaml ==========
That’s all inspiring, but I just kept 1 secrets.yaml file and put a symbolic link from my extended folders back to the original in config/esphome.
Then the secrets thing works in the addon, the fussy include thing can be ignored, and all is well in Mudville.
cd {to the folder trying to reference the secrets.yaml}
ln -s {Path to your esphome folder}/secrets.yaml secrets.yaml
If you want to keep all your secrets in one place, make a secrets.yaml file in the esphome directory with these contents (so it pulls in the contents of your main Home Assistant secrets.yaml file from one directory higher):
@ShadowFist
How come that you refer to the documentation and see that chevrons should not be used, whereas the docu you linked yourself does include them (and the colon)? See screenshot below:
The answer is pretty simple - my brain was mush after a long day of work and I thought you were referring to the separate ESPHome secrets yaml, instead of using the HA secrets yaml.
Apologies for misleading you - I really should learn to read properly before posting when I’m exhausted (or before the coffee kicks in)
Well, maybe I misunderstood something. Just to be clear: I have the real secrets in secrets.yaml in the same folder as the configuration.yaml, and the secrets.yaml in folder esphome should refer to it.
The bottom line for users that might stumble over this, is as follows:
Put your stuff into homeassistant/secrets.yaml
Put the following into homeassistant/esphome/secrets.yaml: <<: !include ../secrets.yaml
(the File editor will show an error message that you can obviously ignore)
Devs/people with coding skills might wish to contribute to a resolution of the (unwanted) error message from the File editor: