Unit lost in Sitemap after transform

Hi,

I’ve created this simple sitemap with a transform.

sitemap home label="Mein Zuhause" {
  Frame label="Erdgeschoss" icon="groundfloor" {
    Text item=Energy_Consumption_CentralHeater label="Zentralheizung [JS(Wh_to_kWh.js):%.2f kWh]"
  }
}

And this little JS

// Transforms Wh Values to kWh
(function(i) {
  return (parseFloat(i)/1000.0);
})(input)

But in Simple UI, the unit of the value (kWh) is not printed.

Any suggestions on this?

Bests
Pascal

Please post your item definition. I am sure we can make good use of the UoM here

1 Like
Number  Energy_Consumption_CentralHeater    "Zentralheizung [%.2f Wh]"   <energy> (BM,gCounters)    { channel="knx:device:bridge:bm_switch_actuator_1:energy_consumption_centralheater" }

Good

Now change this to:

Number:Energy  Energy_Consumption_CentralHeater    "Zentralheizung [%.2f Wh]"   <energy> (BM,gCounters)    { channel="knx:device:bridge:bm_switch_actuator_1:energy_consumption_centralheater" }

In your sitemap:

sitemap home label="Mein Zuhause" {
  Frame label="Erdgeschoss" icon="groundfloor" {
    Text item=Energy_Consumption_CentralHeater label="Zentralheizung [%.2f kWh]"
  }
}

That’s it. Simple as that

1 Like

Even if this is a realy nice solution for the initial problem (THX for that), it doesn’t answer my question.

sitemap home label="Mein Zuhause" {
  Frame label="Erdgeschoss" icon="groundfloor" {
    Text item=Energy_Consumption_CentralHeater label="Zentralheizung [JS(Wh_to_kWh.js):%.2f] kWh"
  }
}

I think that would have worked

That was also my first idea. But it can’t parse the sitemap if you place the Unit behind the Bracket.

Sorry I don’t know