Return of: Inline JS transformation not working

Hi, I’m trying to use Inline JavaScript on a MQTT transformation - ultimately I need to do a basic inline if, but for now I’m just trying to get the concept to work.

I’ve looked at some examples in other posts on here, but I’m not getting any joy. I’ve smarted out and found that I probably need to have installed the “JavaScript Scripting” official automation addon, and restarted for good measure.

I’m using OH3.5 and working through the UI. When I attempt to put inline JavaScript into the MQTT Incoming Value Transformation for a Thing’s Channel, I get this in the log:

[WARN ] [t.generic.ChannelStateTransformation] - Transformation service JS for pattern |(parseFloat(input)) not found!

I’ve tried subtle changes to the formatting, and even tried to just do JS:|10 to hard code a value to be returned, but no joy.

Can anybody point to the blindingly obvious thing I missed here?

This is the thing from the thing file that has built itself:

{
          "uid": "mqtt:topic:emonpi:EmonPi:EmonPi_Import",
          "id": "EmonPi_Import",
          "channelTypeUID": "mqtt:number",
          "itemType": "Number",
          "kind": "STATE",
          "label": "EmonPi Import",
          "description": "",
          "defaultTags": [],
          "properties": {},
          "configuration": {
            "min": 0.0,
            "stateTopic": "emon/emonpi/power1",
            "transformationPattern": "JS:| parseFloat(input) / 1000",
            "unit": "W"
          },
          "autoUpdatePolicy": "DEFAULT"
        }
  • Platform information:
    • Hardware: amd64
    • OS: Linux/5.14.21-150400.24.49-default
    • Java Runtime Environment: 11.0.18
    • openHAB version: 3.4.0.RC1

Well fixed it.

Turns out there are multiple JavaScript things you can install, and you specifically need to install JavaScript Transformations, and not just JavaScript. Hope this is of use to somebody in the future.