How do you use secrets in lovelace-ui.yaml

When I try to use a secret from my secret.yaml file in the form of

  - hold_action:
      action: call-service
      service: envisalink.alarm_keypress
        entity_id: alarm_control_panel.home_alarm
        keypress: !secret envisalink_bypass

I get an error “unknown tag !<!secret> at line 17, column 44: … press: !secret envisalink_bypass ^”

I try single and double quoting it, error goes away, but it literally seems to try to send that text vs. the alarm bypass code string from my secrets file.

I haven’t been able to find an example of the proper usage of !secrets in a lovelace yaml file.

Any guidance would be very much appreciated.


P.S. I did restart HA after I updated the secrets file. I also double checked spelling, etc.


I don’t believe you can use secrets in the lovelace yaml config, though happy to be corrected.
The workaround I’d create is a template sensor that pulls the data from your secrets and use this sensor for your keypress.
EDIT you may not be able to use a sensor, use input_text instead:

    initial: !secret base_url

Thanks for the response and tip, I’ll try that.

I was convinced it should work based on people saying in past posts that some version of HA broke the ability to use secrets in Lovelace and then a later version fixed the issue…