Commit a Byte-value to a KNX dimmer

Hello,

inside a rule, i would like to commit the position of a KNX dimmer as Byte value (e.g. DPT 5.004) instead of percentage value.

my things:

Type dimmer 	: Licht  "Licht" 	[ switch ="1/3/100", position="1/3/102+<1/3/104", increaseDecrease="1/3/101" ]	

inside a rule, i can use

Licht.sendCommand(50)

and the light will be switched to 50%. But for an easier calculation, my idea is to commit a Byte-value of 128 for a 50% output.
Does anybody has a idea, if this is possible?

You could just use a proxy function to transform your byte value into percentage. In Javascript (I am not using DSL Rules anymore it would be something like

function byteToPercent(input) {
    input = input / 255 * 100;
    return input.toFixed(0);
}

and then “events.sendCommand(yourItem, byteToPercent(128))”…

I guess this should also possible with importing a proxy script into a DSL rule.

1 Like