Ui template or ui text formated string

Hey guys, I have a telegram from smartmeter, and it looks like this when I debug,

That looks very good. But when I feed this to ui template or ui text, then it looks like this,


Can anyone tell me, how to keep the format?

You need to replace the new lines with <br> tags.

One way is a change node using the regular expression (?:\r\n|\r|\n) which replaces DOS \r\n as well as Unix \n
Untitled 2

You need the display to use a fixed-width font and to retain the line-feeds. In HTML, the easy way to do that is to wrap the text with <pre>...</pre>. You can use a template to do that.

I tried your suggestion,


But the result wasn't quite good yet....


@TotallyInformation You were right. This is the result,

The fixed-width font was automatically set, by the way.
Only pitty a little bit that the font was changed, but I can live with that.

@TotallyInformation and @jbudd , thank you all guys for your help, I appreciate it very much.

Is that output to a template? I tried it with a UI text node.

Anyway of course Julian's answer was better! :grinning:


You can change the font in Dashboard. Using CSS.

@TotallyInformation , you were right again. Here is the result,

I am not very familiar with HTML and CSS but I managed,


1 Like

That's why the internet was invented :grinning:

I always have to look stuff up as well.

@TotallyInformation , indeed, and I learned most of W3schools. :grinning:

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.