[SOLVED] Transform Mobus Values to right dimension

  • Platform information:
    • Hardware: RaspberryPi4
    • openHAB version: 4.2.1

I added my Inverter with modus tcp to Openhab.
I’m able to get values from the registers.
So I added the mobus Data to a thing and then created an Item (Value as a Number) from the thing.
This all works.
I added the Active Power as an Int32 Value and I get the right value, but in the wrong dimension.
So I tried to add a read transformation to the Value but the value didn’t change.

JS( | parseFloat(inputData) / 1000 )

so I tried to add a gain to the value. This transforms the value, but not as I expected
If the value is 725 I did not get as result 0.725 as I expected.
It seems to be rounded to an Integer and I get 1

Maybe this is due to a wrong state format string in the item?
In the items metadata “State Description” set the pattern to %.3f %unit%
This should give your three fraction digits.

I do the something similar reading from modBus for momentary power and it works.
In my case the gain/offset is set to 0.01 W, pattern to %.2f %unit%

Thanks a lot!
It works