Transform scale range to other range

Hi Guys,
I have an OH2.5 on RPi

I purchased a Tuya WIFI dimmer what I could connect to OH via Tuya_Mqtt and Mosquito.
Issue is that the Tuya dimmer brightness is adjustable in a range of 1-1000. Dimmer Things / Items in OH can play in scale 0-100 range so I could play with the brightness in 0-10% range.

Is there a way to extend it?
(if I initiate the Item as Number than it works well of course)


Sure. The whole idea of Items is to represent many and various devices as idealized standard models. Leave the Dimmer Item alone, and instead do a transformation scaling in the binding channel.

Great. But what transformation service do you advise? I cannot find any which can tranform a range to another.
This is my Chanel definition:

Type dimmer : PowerDimmer   "Fényerő"     [ stateTopic="tuya/tuyadimmer_01/dps/2/state", commandTopic="tuya/tuyadimmer_01/dps/2/command" ]

That’s just maths. (As you point out, although this is “scaling”, the SCALE transform is not the one for this job.)
We can do any maths in a javascript transform.

I think you’d need two JS scripts here,one to multiply by 10 on the way out, one to divide by ten on the way in.
Similar examples in modbus binding docs -

In the MQTT channel, you’d be looking to use transformationPattern (for inbound) and transformationPatternOut

Thanks, it is working well.

Type dimmer : PowerDimmer "Fényerő"  [ stateTopic="tuya/tuyadimmer_01/dps/2/state", transformationPattern="JS:divide10.js", commandTopic="tuya/tuyadimmer_01/dps/2/command", transformationPatternOut="JS:multiply10.js" ]


Dimmer  MQTT_TuyaDimmer01_PowerDimmer  "Nappali Fényerő"  {channel="mqtt:topic:MQTT_Tuya_DIM_01:PowerDimmer"}

and the JS transformation (multiply10 is the same):

(function(inputData) {
    // on read: the polled number as string
    // on write: openHAB command as string
    var DIVIDE_BY = 10;
    return Math.round(parseFloat(inputData) / DIVIDE_BY);