Set Item Value - Solved


I’m trying to assign 3 x RGB Values (GA KNX Binding Type 5.001) to HSB in order to control a LED Strip. For testing only I’ve created a test-button to start the rule.
It works fine with absolute values for rValue,gValue,bValue e.g. 255,120,50

KNX Items
Number rValue { channel=“knx:device:bridge:generic:ga_rValue” }
Number gValue { channel=“knx:device:bridge:generic:ga_gValue” }
Number bValue { channel=“knx:device:bridge:generic:ga_bValue” }

rule “Test”
Item Test changed
var Number red=rValue
var Number green=gValue
var Number blue=bValue
var HSBType hsb = HSBType::fromRGB(red, green, blue)
sendCommand(highboard_color, hsb)

Any help?

[ERROR] [ntime.internal.engine.RuleEngineImpl] - Rule ‘Test’: An error occurred during the script execution: Could not invoke method: org.eclipse.smarthome.core.library.types.HSBType.fromRGB(int,int,int) on instance: null

My solution…

val Number red = (rValue.state as Number).intValue
val Number green = (gValue.state as Number).intValue
val Number blue = (bValue.state as Number).intValue