YAML configuration reloading: add secrets, packages and custom_components

Hello everyone,

I would like to request the possibility to reload

  • secrets.yaml
  • packages
  • custom_components

Because adding integrations (both via UI or manually) requires a restart before you can use a new secret. If the secrets.yaml did not contain the information before the last boot, the system will throw and error and claim that it is missing. This prevents restart.

Same for packages and custom_components. Instead of checking if the files are really there (which they are), Home Assistant reports that they are missing and prevents restart.

=> 2-3 reboots are needed and each step has to be performed in a separate reboot.

Fix: Manual reloading as described

Thank you for your consideration

There is no way to have a reload for “packages” since there is no “packages” integration.

the way packages work is that anything configured inside of a package will be reloaded when the main integration is reloaded.


if I configure a template sensor in a package it will get reloaded as soon as I tell HA to reload templates (along with all of the other template integration configurations).

Likewise reloading secrets would require reloading all the integrations that use your secrets. HA has no way of knowing which these are and some of them may be integrations that are not capable of being reloaded (require a restart instead).

This is just false. Just now I added a brand new secret that never existed before. Like this:

test: hello world

Then I made a brand new template sensor that leveraged this secret (in a package btw since all my stuff is in packages):

  - sensor:
      name: Secret test
      state: !secret test

Then I did reload template entities and got this:

There was no config check error saying I needed to restart to acknowledge this secret nor was there an error on reload. In fact without a restart at all this worked without issue.

So please provide more details on what you’re seeing. Because I have no issues using secrets without restarting as long as the integration itself is reloadable.

Neither of these makes sense for the reasons pointed out by others above. Integrations are reloadable and these aren’t integrations. If an integration is reloadable then you can reload it with new secrets while in a package without issue like I just did above. If you use an integration that’s yaml configurable and not UI-reloadable then make a feature request for that. That way others can vote it up as well.

This really isn’t possible.

A custom component can completely change how Home Assistant runs. It can have pip dependencies that forces HA to change which versions of components are installed affecting any number of other intgrations. It can actually override and change things in HA that affect the runtime of any number of other components. You can install custom components that literally displace core components with an entirely new runtime that changes every aspect of it from startup to shutdown.

Custom components aren’t config, they are actually a change to the code that is running HA. You may think what you installed is just a new component but actually it can change many other parts of the runtime in any number of ways. And tbh that’s not actually something that should be easy, there’s a reason there’s warnings in the logs for all custom components.

Now one thing that could be possible is for a custom component that is yaml configurable to have that config be UI-reloadable. So you only have to restart once to get the component installed and running, not twice. I can’t say how likely that feature request is to get taken up but it is possible.

Thank you for this additional information.

Well, somehow the system knows which secrets are in the secrets.yaml, because when I add a package that calls for a secret that I only just uploaded in a new secrets.yaml file, I get the error message that this secret is unknown.
So it seems that secrets are read during boot and then not updated again until you manually reload sensors or something like that (which is why I asked for packages reloading). System then blocks restarting if a new secret is defined in a package.

Yes, it seems to work if, and only if you are able to reload the specific type of package you were adding.

I have had this issue many times, that’s why I decided to add this feature request.

To reproduce:

  • upload new secrets.yaml file with newly added secret (I sometimes work locally and then upload… it’s just more comfortable than using the editor on mobile devices)
  • create a new yaml for e.g. “home connect” or for “ista ecotrend” using secrets and upload to packages subfolder (as registered in configuration.yaml)
  • perform configuration check

I get an error message about the secret and cannot restart. I would be surprised if you do not.

So I have to remove the package, reboot with only the new secrets.yaml and then add the package’s yaml file. And of course reboot again.

I just added the following to my secrets.yaml

home_connect_client_id: test
home_connect_client_secret: test

They did not exist before as I have never used this integration. I also have a packages setup to I added a file called home_connect.yaml to one of my packages (all my packages have their own folder that is !include_dir_named) with the following:

client_id: !secret home_connect_client_id
client_secret: !secret home_connect_client_secret

Then I ran config check. It passed
Screen Shot 2022-05-05 at 1.04.16 PM

Ran it from the UI too, also passed there.

So I’m not really sure what you’re doing but I definitely don’t have to restart twice for new secrets. Even when using packages and even when the integration is brand new. Maybe something about how you’re uploading changes is doing weird things? I just modify the files so I’m not entirely sure what you mean by “upload new secrets.yaml file”.

Hmmmm, that is indeed weird.
Okay, background: I am not a fan of setting everything up via the UI. Takes too long.
I like to have everything in yaml files and then just upload the files and restart. Done.

So what I do is edit the yamls locally (e.g. the secrets.yaml) and then I upload it via VSC addon.
I create a new, dedicated home_connect.yaml and upload via VSC (usually I actually just upload my “packages” folder).

And then I hit the check configuration button in the UI. And boom, secrets problem.

I will test it again via VSC editing instead of upload