[SOLVED]Question aboute [%.1f °C], [%d %%], [%.3f kW]

Hello all,

I no that one is for temp one for humidity and last one i for power.
I no there are many more sings out there, but i don’t no the sings for it.
Is there a website where all the sings are on with some explanation?
For now i would like one for ppm, but will have to use more in the
in the future. So it would be nice if there is a website with the sings on it. (Don’t no what there are called so i called the sings)

Greetings

What you are asking about is called String formatting. For example:
[%.1f °C]: %.1f means that at that point a floating point number is to be filled in, with 1 digit after the decimal separator (the .), followed by the unit degrees Celcius in this case, but that could be anything.
[%d %%]: %d means that a integer number is to be filled in there, and it should be followed by a percentage sign (%), but as the % is already a special character, it is escaped by adding another % in front of it.
[%.3f kW]: Same as the first example, but then with 3 digits after the decimal separator, and a unit of kilo watts.

As OpenHAB is made in Java I looked up a random resource describing some more of the options, but there is many more resources to be used:

Now what the brackets do, is basically say “This concerns the state representation field, and not the label”, as mentioned here:

4 Likes

Thanks for the reply and the links.
I go and read-up on it, thanks.

Greetings

@diado thanks for marking the title [Solved].:+1:

It’s also good to click the square box (lower right corner) on the post that provided the solution. It’s also very good to click the heart icon (also in lower right corner) on a helpful post. This give the person that took time to reply a “like” and show’s that you appreciate their time and effort. As an example, you can see the like I gave @RolfV for the helpful info. I also bookmarked this for future reference.:wink:

Thanks again

1 Like