Read value from knx (0-100) and convert to 0-359

Hi all!
I’m trying to make three sliders on knx visu to control rgb led strip. Brightness and saturation sliders works great because they is 0-100. But HUE value must be 0-359 and from knx i can get only 0-100 value.
I need transform 0-100 from knx to 0-359 in OH.
There is my config that i can’t get working:

		Type dimmer        : hue "kitchen2hue" [ position="13/5/0", readTransform="JS(convert.js)"]
		Type dimmer        : saturation "kitchen2sat" [ position="13/5/1" ]
		Type dimmer        : brightness "kitchen2br" [ position="13/5/2" ]		


Number hue 			{ channel="knx:device:bridge:dummy:hue" } 
Dimmer saturation		{ channel="knx:device:bridge:dummy:saturation" }
Dimmer brightness		{ channel="knx:device:bridge:dummy:brightness" }


rule "hue"
    Item hue changed
var DecimalType hueINT = hue.state
var PercentType saturationINT = saturation.state
var PercentType brightnessINT = brightness.state
var HSBType lightOBJ = new HSBType(hueINT, saturationINT, brightnessINT)


(function(i) {
    if(input >= 0)
	return input / 100 * 359;
	return null;

You didn’t ever say what’s not working.

transform not working
just nothing happens

Your KNX channels are not linked to these Items.

I’m not convinced you can link a dimmer type channel to a Number type Item. Does it work without the transform?

as i know dimmer item can’t be >100
saturation and brightness works

Your saturation and brightness dimmer type channels are linked to Dimmer type items.
Does your linking of dimmer type channel to a Number type Item work, without the transform?

no, it does not work. it was the last attempt to make it work))

So if you link your KNX dimmer type channel (no transform) to a 0-100 Dimmer type Item, you should be able to do your scaling maths in the rule instead.

Alternatively, create a number type KNX channel.

I tried similar transformations with no results. It looks like readTransform is not implemented within KNX binding.

That’s right, it is not. Nowhere in the binding docs does it suggest it is.

Alternative, you can apply a transform profile to incoming channels.

I tried a transform profile as well, but with no effect. Can you tell me what is wrong here:

Number EG_GW_Hzg_Stellgroesse_Ist     "Hzg Stellgröße Ist [%d]"  {channel="knx:device:bridge:EG_GW_RCTLR:EG_GW_Hzg_Stellgroesse_Ist"  [profile="transform:JS", function="multiply_by_100.js"]}

Oh wait, are you still on OH2? Transform profile not working with Number types in OH2.

Thanks, I’m indeed still on OH2 :frowning:

Well, you’re “goosed” then :crazy_face:
KNX binding does not support transformations.
Transform profiles do not work with Numbers in OH2.

You’ll need a proxy Item and a simple rule, the old-fashioned way.

1 Like

Yeap, I know the old-fashioned way quite well. It’s OK for now.
I’ll try to find some time this summer to face OH3 …
Many thanks so far!