opened 05:56AM - 09 Jun 20 UTC
closed 07:32AM - 22 Jun 20 UTC
bug
Issue: JavaScript transformation
## Expected Behavior
Using 2.5.5 snapshot #…111, everything worked out normal. JS transform was used to add an offset to a watermeter counter in order to create the grand total water consumption in qubic meters.
## Current Behavior
After upgrade to 2.5.6 snapshot #131 or newer, JS transformation from sitemap item label doesn't longer work out. Sitemap line item (see below) needs to be disabled to make other group members working again. Other transforms defined vs paperUI items definition still work out.
## Steps to Reproduce (for Bugs)
**Sitemap line item:**
Text item=WassermesserSensor_1_GasEnergyCounter label="Wasserzähler Stand **[JS(wasseruhr_offset.js):%s]**" icon="watermeter"
**JavaSript file:**
(function(i) {
var scale = " m3"; //workaround for display of the unit m3
var total = parseFloat(i) + 623.162; //sum of the water meter offset 623,162 m3 and the HomeMatic counter value
var new_total = total.toFixed(3); //limits the digits after the dot to 3
return new_total.toString().replace('.', ',') + scale; //replaces dot by comma and adds the unit m3
})(input)
## Your Environment
Windows10, openHAB2.5.5, snapshot #111