Help for syntax MQTT Thing channel with JSONPath and JS

Hi all
I use VenusOS for my PV system and collect the data via MQTT
everything works as expected, but the BMS data for MinVoltageCellID and MaxVoltageCellID contents the CellID e.g. “C1” or “C16”
I use a JS-script to remoce the “C” in the MQTT value

(function(data) {
  var returnValue = data.slice(1);
  return returnValue[0]
})(input)

This works fine in OH 3.4.2, but under OH 4.3.3 I cannot combine JSONPath and JS in a Thing-file

within the UI I can add both to the channel definition

UID: mqtt:topic:MQTTVenusOS:VenusOSMQTT
label: VenusOSMQTT
thingTypeUID: mqtt:topic
configuration: {}
bridgeUID: mqtt:broker:MQTTVenusOS
channels:
  - id: CELLTEST
    channelTypeUID: mqtt:string
    label: CellTest
    description: ""
    configuration:
      stateTopic: N/VRMPortalID/battery/1/System/MinVoltageCellId
      transformationPattern:
        - JSONPATH:$.value
        - JS:CellID.js

But how I have to handle this in a Thing-file
how to combine transformationPattern=“JSONPATH:$.value” and JS.CellID.js

Here my Thing definition

Bridge mqtt:broker:myBroker "VENUSOS Broker" [
    host="<IP-Adress",
    port=<Brokerport>,
    clientID="openhabClient"
] {
    Thing topic batteryVoltages "Battery 1 Voltages" {
        Channels:

            Type string : CellLow "Cell ID Low" [ stateTopic="N/VRMPortalID/battery/1/System/MinVoltageCellId", transformationPattern="JSONPATH:$.value" ]
            Type string : CellHigh "Cell ID High" [ stateTopic="N/VRMPortalID/battery/1/System/MaxVoltageCellId", transformationPattern="JSONPATH:$.value" ]

    }
}


Hope, somebody can help, because I don’t wanna create the channels via UI

BR Uwe

And I see, that I created the post under item, sorry

What you need to do is in the description under the transformation pattern field in the UI.

Applies transformations to an incoming MQTT topic value. A transformation example for a received JSON would be “JSONPATH:$.device.status.temperature” for a json {device: {status: { temperature: 23.2 }}}. You can chain transformations by listing each transformation on a separate line, or by separating them with the intersection character ∩.

So you’d use JSONPATH:$.value∩JS:CellID.js

1 Like

Sorry, this does not work
I add this to the thing-file and in the Codeview in the UI it looks so

      transformationPattern:
        - JSONPATH:$.valuenJS:CellID.js

But what is needed is this below

      transformationPattern:
        - JSONPATH:$.value
        - JS:CellID.js

How can I separate this that both works
This is the result

Corrected: missed the n
But it still not work

When I create a MQTT channel via UI I can add JSONPath and JS
image
image

When I use your definition it looks so
image

My fould
I should wait until the system have complettly load the thing file
Now it works like a charme

Thanks to Rikoshak