MQTT Binding passing URL in message

Hi,

I have a requrement to pass a url as an MQTT message. Due to the : and /'s it’s not working.

Can these be escaped in any way?

mqtt=">[internal:chromecast/CA-Office/command:command:*:casturl|http://tx.sharp-stream.com/http_live.php?i=teamrock.mp3]"

Many Thanks,
Chris

Try using a backslash:

http\:\/\/tx.sharp-stream.com

If that doesn’t work I’m out of ideas.

You could use a transformation instead of a literal message value as described under “transformation” here:

transformation Rule defining how to create the message content. Transformations are defined in the format of TRANSFORMATION_NAME(transformation_function). Allowed values are ‘default’ or any of the transformers provided in the org.openhab.core.transform bundle. Custom transformations can be contributed directly to the transform bundle by making the Transformation available through Declarative Services. Any other value than the above types will be interpreted as static text, in which case this text is used as the message content.

So you could have JS(myurl.js) having the content:

result = "http://tx.sharp-stream.com/http_live.php?i=teamrock.mp3";

Thanks I’ll take a look at this approach later. Seems like it might do what I want.

Cheers for the pointer.

The black slashes didn’t work, it still saw the : and caused it to fail.