How to use secrets in automations.yaml

As of 2021.4 it appears that we are no longer can use secrets in automations.yaml files. When I try to open any automation for editing via Configuration->Automations I get a “Error loading automation (500)” popup and this in the logs:

  File "/usr/local/lib/python3.8/site-packages/yaml/constructor.py", line 100, in construct_object
    data = constructor(self, node)
  File "/usr/src/homeassistant/homeassistant/util/yaml/loader.py", line 306, in secret_yaml
    raise HomeAssistantError("Secrets not supported in this YAML file")
homeassistant.exceptions.HomeAssistantError: Secrets not supported in this YAML file

Previously I use secrets to hide sensitive information in my automations.yaml about my network architecture when posting my config to GitHub.

Is there a new recommended way to use secret values inside of automations?

1 Like

Yes, I would like to know how. I got some webhook_id in the automation file I would like not to show in plain site.

Secrets in automation managed by the frontend is a no-go.
There is a workaround, apparently, (Automation editor exposing !secret values · Issue #3065 · home-assistant/frontend · GitHub) that allows you to still use secrets in automations, but then then those “pure yaml” automations won’t be visible in the frontend.

There are probably ways to move your secrets out of the automations, though.
Just show us some samples.

I have a rest_command that needs user and password. It is called from an automation. Using data: user: pass: in the automation is very useful.