Secrets in automations

i would like to use secrets in automations like this:

service: alarm_control_panel.alarm_arm_home
target:
  entity_id: alarm_control_panel.alarm_myhome
data:
  code: !secret alarm_code

You can do that.

Apparently you can’t.

2 Likes

how can i do that? i read something about edititng manually an automation but it can’t be edited via UI no more…

Click the yaml mode button in the automation editor.

i did that but after saving, it changes in:

service: alarm_control_panel.alarm_arm_home
target:
  entity_id: alarm_control_panel.alarm_myhome
data:
  code: null

This is still an issue.

If you use the UI, even in yaml mode, the !secret is corrupted it seems :frowning:

The Automation Editor has several known limitations and bugs, some of which occur when toggling between Visual/YAML modes.

Here’s a post from over a year ago that reports the inability to correctly handle !secret

The problem was reported in the GitHub Frontend repository (earlier this year) but the Issue was never addressed:

All this to say that !secret is supported in automations, but mishandled by the Automation Editor.

+1 from me on this.
I just changed over from yaml to be able to use UI and yaml, and to be able to use category, label and so on which is new.
But secrets is a problem because i like to share my automations and use secrets to not risk sending an ID of some kind by accident.

1 Like

Appreciate this is an ancient FR, but this limitation still exists and it’s frustrating - would love to see the UI editor support !secret, or at least not throw an error if you edit an automation/script which is stored in the same YAML file as a !secret.