Transformation service SCRIPT for pattern graaljs:invertpercent.script not found!

Hey guys, after upgrading to OH4, my transformation doesn’t work anymore. This worked fine in OH3 and in an older OH4 Milestone. JavaScript Scripting (Nashorn) is installed. My textual thing

 `Type rollershutter : SchlafzimmerRollo  [ stateTopic="stat/wemos_SchlafRollo/RESULT" , transformationPattern="JSONPATH:$.Shutter1.Position∩SCRIPT:graaljs:invertpercent.script" ,  commandTopic="cmnd/wemos_SchlafRollo/ShutterPosition", transformationPatternOut="SCRIPT:graaljs:invertpercent.script" , stop = "stop" ]`

My “invertpercent.script” in transform

(function(i) {

var percent_shelly = parseInt(i,10);
var percent_oh = (100.0- percent_shelly);
return percent_oh.toFixed(0);

})(input)

brings this error in Log.

Transformation service SCRIPT for pattern graaljs:invertpercent.script not found!

Thanks for help
Joe

Hi Joe,

as Release openHAB 4.0.0 · openhab/openhab-distro · GitHub says under the core changes header:

SCRIPT transformation has been removed and replaced with language-specific transformations: JS, RB, PY, DSL, GROOVY, etc. See Transformations | openHAB

This was a breaking change from a milestone to another.

Please install the JavaScript Scripting add-on (not the Nashorn version), rename your script to .js and use JS instead of SCRIPT for the transformation type, you don’t need to add the script type after the transformation type anymore:

Type rollershutter : SchlafzimmerRollo  [ stateTopic="stat/wemos_SchlafRollo/RESULT" , transformationPattern="JSONPATH:$.Shutter1.Position∩JS:invertpercent.js" ,  commandTopic="cmnd/wemos_SchlafRollo/ShutterPosition", transformationPatternOut="JS:invertpercent.js" , stop = "stop" ]`

Please let me know when it works or you need help!

Best regards,
Florian

1 Like