The output of that is a secret, but very relevant here.
I will take a guess that the transform returns a numeric only, without units.
It doesn’t matter what you think the units are, if you don’t specify them to openHAB.
You don’t need to convert anything in your transformation, just append the correct unit to the incoming value, "1234.0 Wh", and let the framework sort it out.
That does rely on the binding passing quantity states through the number type channel. Some do, some don’t.
What’s supposed to happen.
The Number:Energy type item has a different default display format that adds the kWh unit.
Note that’s independent of the [%.2f…] you specified. Those strings are ignored in the OH3 UI that you use.
The underlying thing is a knx thing with DPT13.010 which should return Wh. So as I understand you right, I don’t have to convert the value. Instead I only need to work with the UoM and OpenHab will do the rest.
But how can I avoid to see Wh? For example I’ve created a Chart which shows me the daily consumption. It displays Wh but I wan’t to see kWh. Also when creating Pages I can’t see an option to define the UoM.
You can define the display format (thus override the default) in the item’s metadata - state description - pattern. Use the format string you used e.g. %.2f