How to generate Action MQTT topic from variables

How to generate Action MQTT topic from variables

@D K

I’m using an Action based on a Push Button change to Publish to MQTT.
I wist to generate the MQTT topic to publish to from variables in my bucket.
How do I reference the contents of a variable in a bucket to build the MQTT topic?
Note: This is not the variable associated with the Push Button change.

For example:
I have a variable called ‘gateway’ in my bucket. In ‘gateway’ is the gateway name “Gateway1”.
The desired topic to build from this is: “Acme/Gateway1/control”
I have tried:

  • “Acme/$gateway$/control”
  • “Acme/$BUCKET.gateway$/control”
  • “Acme/$DEVICE.BUCKET.gateway$/control”

Nothing seems to work! (Note: There should be dollar signs surrounding the above “gateway”, “BUCKET.gateway” and “DEVICE.BUCKET.gateway” items, but it appears they are removed when this was submitted!)
The intent is not to hard-code the MQTT topic to be able to dynamically send to the gateway being communicated with.