Hi,
I am moving all my bindings to V2 in order to migrate to OH3.
So far I encountered one issue that I haven’t managed to solve yet:
I want to transform a state received from a binding.
This is my Items definition:
Number APC_TIMELEFT (gAPC) {channel="networkupstools:ups:ups:batteryRuntime" [profile="transform:JS", function="sec2min.js", sourceFormat="%.1f"]}
This is my JS transformation (sec2min.js)
(function(i) {return i / 60; } ) (input)
And this is the error message:
2021-01-29 09:13:47.407 [WARN ] [iles.JavascriptTransformationProfile] - Could not transform state '8308.0 s' with function 'sec2min.js' and format '%.1f'
I tried without sourceFormat
and with sourceFormat="%d" or "%.0f" or "%.1f s"
but get the same type of error.
(I know I could transform the seconds to minutes using the Time unit of measure, but I want a more general way using the transformation service for future use. So plese help find the error in the above syntax.)