Using secrets in a path

I’ve just been through my configuration files moving sensitive information into a secrets.yaml file.

Everything works swimmingly with the exception of replacing the Hue API key in a sensor config.

For example, I wanted to replace this: -

- platform: rest
  resource: http://192.168.1.99/api/<api key here>/sensors/7
  ...

with: -

- platform: rest
  resource: http://192.168.1.99/api/!secret hue_api_key/sensors/7
  ...

That doesn’t work, is there a syntax, or another way to substitute the API key value?

Thanks,

Andy.

It’s a shame, but the usability of the !secret variables is frustratingly limited (probably due to the not-so-bright syntax or form), and can not be used anywhere ‘inline’. For this to work for you, you have to define the whole ‘http://…’ url as a !secret var

2 Likes

Thanks for your help! I may try that approach.

Andy.

Thanks for this! Not the pretties way to do it, but it’ll do.