Outgoing Value Format on MQTT thing?

Running OpenHab 2.5.8. Regarding this setting on an MQTT thing…

Outgoing Value Format

Format a value before it is published to the MQTT broker. The default is to just pass the channel/item state. If you want to apply a prefix, say "MYCOLOR,", you would use "MYCOLOR,%s". If you want to adjust the precision of a number to for example 4 digits, you would use "%.4f".

I have a WiFi ESP chip that I’ve programmed up to turn on various blinds around the house. It will receive for example “HALLOPEN” to a “openhab/blinds/trigger” topic that causes the ESP chip to then switch a MOSFET sending a logical key press to an infrared remote therefore opening the hall blinds. Another example would be send “BEDROOMSCLOSE” to close the bedroom blinds via a different IR remote.

I figured based on the description above, on my Hallway blinds thing for example, I could put “HALL,%s” in the “Outgoing Value Format” box above, in the hope that the thing would prefix the “CLOSE” command on a rollershutter item type that is sent with “HALL” therefore sending “HALLCLOSE” but this does not work.

Am I reading the text of what this setting is supposed to do incorrectly? If so what is the easiest way to achieve this?

Argh… NVM… seems no pattern to transform the output is supported on a rollershutter. Bottom of this page :frowning: Any other simple solution to this?

You could use a rule to publish data to MQTT

Thanks, yeah I thought about using rules but figured with advancements in the mqtt binding with pattern transformations etc it should be doable in the paperui

You can use a transformation. A simple MAP transformation might be sufficient. If not a JavaScript transformation can do pretty much anything.

I though that meant only that the default is %s, without frills. The openHAB command is passed unaltered to MQTT payload.
I’d expect “HALL,%s” to produce a payload like HALL,down or HALL,56

But you can’t get from openHAB command DOWN to payload text CLOSE by formatting alone, so some transformation will be needed.