Decimal conversion in system info binding

Hi all,

I’m using system info binding to get some infos about my CPU utilisation. This works perfect, only thing is that the average is in formar 0.x where the openhab utilisation is displayed as xx,0. (which makes the charts unreadable). I thought it would be easy to transform the value with a simple conversion rule like this:

Item:
Number loadAverage1min "Load avg. 1min [%.1f%%]" (Server) {systeminfo="LoadAverage1Min:50000:JS(mal100.js)" }
script:
(function(i){ return i * 100; })(input)

The value still remains the same - I’m transforming the temperature in the same way and it works…

How to apply this to the values from the system info binding?

Thanks for any help!

Not every binding supports transforms and it appears the System Info binding is one that does not.

You will need to do the transform in a rule and use a proxy item.

Items

Number loadAverage1min "Load avg. 1min [%.1f%%]" (Server) {systeminfo="LoadAverage1Min:50000:JS(mal100.js)" }
Number loadAverage1minProxy "Load avg. 1min [%.1f%%]" (Server)

Rule

rule "Transform load average"
when
    Item loadAverage1min received update
then
    loadAverage1minProxy.postUpdate((loadAverage1min.state as DecimalType).doubleValue * 100.0)
end

Put the proxy item on your sitemap.