My secrets are never loaded and are shown as mypass: null
in automations yaml. What might be wrong?
configuration.yaml:
default_config:
....
secrets: !include secrets.yaml
secrets.yaml:
# Use this file to store secrets like usernames and passwords.
# Learn more at https://www.home-assistant.io/docs/configuration/secrets/
mypass: test
Developer logs show:
Log Details (ERROR)
Logger: homeassistant.setup
Source: setup.py:104
First occurred: 7:24:34 PM (1 occurrences)
Last logged: 7:24:34 PM
Setup failed for secrets: Integration not found.
Remove this line
secrets: !include secrets.yaml
Secrets is not an integration, it’s a built-in substitution tool. I’m curious why you thought you needed that line in your configuration?
2 Likes
I thought I need it, because still without it, I’m having the issue that my secret definitions in automations are cleared to null
.
Eg in my example, the action I defined is:
data:
pw: !secret mypass
service: rest_command.test
When saving and coming back to the automation, it is always:
data:
pw: null
service: rest_command.test
When you say “When saving and coming back to the automation, it is always…”
Where are you saving it and with what tool?
1 Like
I’m using the HA ui dialog. I tried both saving the secret in the ui input fields, as well as in the yaml
view.
Interestingly, the configuration.yaml
then contains just a blank for the pw
property:
action:
- data:
pw:
- service: rest_command.test
Now what is strange: if I edit the property directly in the configuration.yaml
:
action:
- data:
pw: !secret mypass
- service: rest_command.test
Then in the view of the automation, the secret is actually resolved to its real value:
data:
pw: test
Is this intended? Should the ui just simply show the !secret pw
?
I don’t know, I don’t use the UI editor
petro
(Petro)
April 17, 2020, 3:20am
8
Secrets don’t work in the GUI. Only in yaml
So but what if I use secrets, and then lateron will edit the automation in the UI? will that override my secret values inside the automation?
petro
(Petro)
April 18, 2020, 3:16pm
10
It will overwrite the field. Not what’s in the secret
Isn’t this a really bad behavior?
I mean: I configure the !secret in the yaml. A few weeks later, I edit the automation in the UI, not remembering that I had set a secret. And in the UI you cannot see it, because the secret is resolved to its real value.
When you then save the automation from the UI, the secret will be written as cleartext into the field of the automation, and thus into the yaml.
Yet, as I might have forgotten that I’m using a secret in this automation, this will then expose my secrets to the configuration files
petro
(Petro)
April 18, 2020, 5:51pm
12
Secrets were never intended for automations. They were intended for passwords in configurations.
So passwords in automations have to be written in cleartext always? That hurts…
petro
(Petro)
April 18, 2020, 7:06pm
14
They only are that way because you’re using the automation editor. Just don’t use it. Move that automation into a separate section not controlled by the UI
As a new user I’ve just spent ages trying to work out what I was doing wrong with the UI and trying to specify a secret, and this is why!
Ahhhh!!!
Perhaps the documentation page could be updated to say secrets cannot be used in the UI ? It would have saved me a lot of frustration.
How do I do that please? An include in configuration.yaml ?
EDIT: Never mind, figured it out