Create automations with actions using secrets using the frontend

Hello,

Is there any way to reference !secret values when using the frontend to edit automations?

Currently the only way I have found to do this is to use a flat file that contains any automations that reference secrets.

eg:

action:
  - service: alarm_control_panel.alarm_arm_away
    data:
      code: !secret studio_alarm_code
      entity_id: alarm_control_panel.studio_alarm

I have tried both YAML and the Visual Editor in the frontend but I just get errors when I try and run the automation, if I remove any !secret then they work fine.

I would like to do everything in the frontend if possible, like this ?

Thanks!

1 Like

If my understanding is correct, using secrets.yaml only hides the values in the textual representation of files that !secret is used. Once the file is compiled to be ran, the secrets are slotted in in place of every !secret; secrets are not variables that are checked and passed on the fly. Even if you got this working, it would be like storing SSNs in the HTML of a website, and no different than storing the code in there directly. However, a big difference is that your dashboard is hopefully private to just you.

If you are really expecting prying eyes and have found a way to use secrets in action sequences, why not just create scripts for those specific service calls and call those scripts instead of the service calls directly? However, anybody who has access to your UI is going to have access to your scripts.

Sorry I don’t really understand your reply.

I don’t want to store the same alarm code in multiple different files (dupliction), and if I post any code to a website, github etc I don’t want the secret to be displayed - those are the reasons for me using secrets.

My question purely relates to the frontend, but after quite a bit of searching I’m pretty sure the frontend just doesn’t support them.

UI automations don’t support secrets.

2 Likes