[SOLVED] How to format a value with unit?


(Heiko Hegewald) #1

Hi,
I have a problem with some readings if they are unitized.
Some RFXCOM sensors sometimes provide values such as 22.000000000002 ° C. This breaks the view in the HABpanel. How can I format the values so that there is an indication of 22.0 ° C?

<div class="col col-xs-9 text-left">
    <div style="font-size: 34px">
        <span ng-if="itemvalue(config.temp_item)!= '-'">{{itemState(config.temp_item)}}</span>
        <span ng-if="itemValue(config.temp_item)=='-'">N/A</span>
    </div>
</div>

with sprintf: … I get no indication.

Thanks


(charalampos varytimos) #2

item???
[%.1f ] for 22.0
or
[%.2f ] for 22.00


(Heiko Hegewald) #3

I do not use item files. There is no way in the PaperUI to define the readiness of the value.
There are not these problems in the BasicUI, because you can define that in the sitemap, but here?
It would be nice if you could define that globally …


(Rossko57) #4

It’s part of the label, which you can edit in PaperUI. I don’t know that would have an effect for HABpanel, though.


(Heiko Hegewald) #5

I tried it. Unfortunately not.


(Rossko57) #6

This looks relevant


(Heiko Hegewald) #7

That seems to work. I will watch it. Many Thanks.