Variable substitution in settings

hi

trying and failing on something like:

mqtt:
  broker: mqttbroker
  username: !secret mqtt_user
  password: !secret mqtt_password
  topic_prefix: 'esp/${name}'

that prefix I cannot write like that… replacement does not take place.

As I’d like to come to includes and harmonise the settings, any chance to do something like that??

thanks so much!

Edit:
found: this
seems I cannot - really ??? How to keep a swarm of esp’s in sync with code changes… ???

Hi Andy16,

If you add or change a secret to the secrets.yaml, you need to restart HA in order for it to be pulled into HA.
This may be why your stuff didn’t work.

If you did that, I didn’t have a lot to go on in the question, and I guessed the most likely.

hi - thanks for reply!
It was not for the secrets but for the topic_prefix that I cannot concat with a variable…

You didn’t share much of your code, but I don;'t see why not.

I don’t recognize that. (Wait, is the $ the path thing?. not sure. You didn’t share enough to actually help here…)

Maybe this will inspire you, I variable the hell put of my MQTT Discovery stuff in this blueprint.
HA_Blueprints/Automations/Octoprint_Additional_Buttons_Helper.yaml at d1c15d75a7b5fa3042d60f7eee2d7633ea8a27a3 · SirGoodenough/HA_Blueprints · GitHub.