Formatting of number items with dimension/UoM on a widget?

The possibility to use units of measure on items with automatic conversion is great - at least when presenting data on a sitemap. I have the following configuration and it is formatted on the sitemap as I expect.

/* Item */    
Number:Speed Precipitation_d2      "Precipitaion [%.1f mm/h]"

/* Sitemap *
Text item=Precipitation_d2

The problem is that the following widget code (1) provides the result below, and (2) doesn’t work - I assume because it is a string. Am I doing something wrong or what do I have to do to format the number value as I want?

<!-- (1) -->
<div class="name green">{{itemValue('Precipitation_d2')}}</div>

<!-- (2) -->
<div class="name green">{{itemValue('Precipitation_d2') | number:1}}</div>

Skärmavbild 2020-12-09 kl. 11.01.40

I finally found the solution. If I was better at searching the community, I would probably have found the solution quicker :grinning:

https://community.openhab.org/t/sprintf-with-new-numbers/47405

1 Like