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
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.
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 
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.
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.
same here - would greatly appreciate this. I end up frequently having to hardcode something that is already present in secrets at various different places in automations, which just doesnāt really make sense.
+1 to this issue too. If using putting !secret in automations.yaml then I can no longer edit any of them in the UI
I just voted on this. I store my automations in Github so that others might find something useful from what Iāve done/will do. But, I am using webhooks now and even though theyāre all local, I donāt want to put those IDs out in the wild. I was making these automations via the UI. Thank you!
I found, what I hope is a solid workaround:
[solution]Secrets in automations
Can confirm that the described method is working well for using the ā!secret ā method to arm/disarm my alarmsystem.
One small thing: thereās a typo in the code: the word āalarmcodeā has to be spelled exactly the same as in the helper, so: AlarmCode instead of alarmcode.
One other āimprovementā is that as opposed to adding a variable, you should be able to use {{ states(āinput_text.alarm_codeā) | trim }} in the code: line directly.
In my case, I set up both AlarmCode and DoorCode in input_text.yaml:
alarm_code:
name: AlarmCode
initial: !secret alarm_code
max: 6 # up to 6 digits, adjust as needed
door_code:
name: DoorCode
initial: !secret door_code
max: 6
In short: