MQTT publish

Raspberry pi running V2.2

I have a value I want to send out to MQTT and be picked up by other deivces.

I cant work out how to make a generic ‘take the value and publish it’ set up

as the item currently stands

//Number Output_mqtt {mqtt=">[mybroker:home/outputs:command:0:0],>[mybroker:home/outputs:command:1:1],>[mybroker:home/outputs:command:2:2]"}
Number Output_mqtt {mqtt=">[mybroker:home/outputs:command:*:.*]"}

The commented out line on top does work, but only for values 0, 1 and 2 as it suggests.
I guess I could the value through a map and set a load of possible values, and more just in case,
but I wanted to just have one line that wouldnt care what the value is, just send it out.

Is there a reason why the wildcard approach doesnt work?

FYI, I found the item setup somewhere and gave it a go but now it publishes ‘.*’

I changed the item to

Number Output_mqtt {mqtt=">[mybroker:home/outputs:command:*:*]"}

and it only publishes ‘*’

so the first ‘*’ isnt actually a wild card maybe???

Having read the documentation try this:

Number Output_mqtt {mqtt=">[mybroker:home/outputs:command:*:${command}]"}

I remember that one and it didnt work

But I found that this appears to work at the minute but Ill do some more checks of differing values and see how it goes

Number Output_mqtt {mqtt=">[mybroker:home/outputs:command:*:default]"}