Problems with converting numeric items

I have a project were im reading alot of modbus values.
This numbers comes inn as value with 4 number were you need to devide it by 100 to get the right number (1000= 10,00 celsius)

For this i have been using Javascript Transformation as suggested on forum and modbus driver. I have used the Javascript transformation on items file like this.

Number  V3601Utetemp "Temperatur utetemp [JS(devideTemp.js):%s]" <temperature> { modbus="input:23" }

This works for basic UI, but for logging and habpanel this does not work.

This should probably be in the driver, but how do i do that?

.js

(function(i){
	return (i / 100).toFixed(2).toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",") + '°C';
})(input)

Basic UI - This works
bilde

Logging (RRDJ4)
bilde

Habpanel
bilde

What i thought was that the item files should be something linke this:

Number  V3601Utetemp "Temperatur utetemp" <temperature> { modbus="input:23:transformation=JS(devideTemp.js)" }

But it does not work.

That should be about right. What does not work exactly?

In this case it still shows the same value just that it removed the “%”.
Was thinking that it was ignoring the :transformation=JS(devideTemp.js)" part of it

bilde

The presentation is about what you put in the Item’s label, you took out the part telling it to display C
Try

Number  V3601Utetemp "Temperatur utetemp [%.2f °C]" ....

That’s where you first had your transform, it altered the display value but not the Item actual value.

Applying the transform to the modbus binding instead will work on the number before it gets put into the Item,
I would guess your transform is actually failing - should be able to see that in your log? - because the transform is trying to put a string with a comma and ‘°C’ into a purely Number Item.

You need to change your transform so it that just does the numeric part.
The modbus binding v1 page includes an example of a divide-by-10 transform. You should be easily able to make a divide-by-100 version

You were correct, also i needed to change the Modbus driver abit.
it works with this:

Number  V3601Utetemp "Temperatur utetemp [%.1f °C]" <temperature> { modbus="<[input:23:transformation=JS(devideTemp.js)]" }