Using JS to MQTT return value

I have an item configured:

UID: mqtt:topic:8b07ced21b:fc1c2de3e2
label: Efergy E2
thingTypeUID: mqtt:topic
configuration: {}
bridgeUID: mqtt:broker:8b07ced21b
  - id: energy_kWh
    channelTypeUID: mqtt:number
    label: Energiankulutus
    description: ""
      stateTopic: rtl_433/602024/energy_kWh
      transformationPattern: JS(divByTwo.js):%f
      unit: kWh

And a js script is in the folder (and transformation enabled):

        return f / 2;

But openhab gives me an error:

2021-08-28 00:28:13.509 [WARN ] [t.generic.ChannelStateTransformation] - Transformation service JS(DIVBYTWO.JS) for pattern %f not found!

Can anybody tell me what is wrong with my config?

Syntax error

This topic was automatically closed 41 days after the last reply. New replies are no longer allowed.