Hallo Community,
I have a problem, that hopefully can be be fixed by some of you really fast. In the following rule I try to convert the variable color inside the sendCommand line to an expected DecimalType, but
rule "changeColor"
when
Item LCN_M11_Relay_2 changed from OPEN to CLOSED
then
ColorLoop = true
var HSBType currentState = Hue3LampColor.state
var int color = currentState.hue.intValue
var PercentType sat = currentState.getSaturation() // new PercentType(100) // 0-100
var PercentType bright = currentState.getBrightness() // new PercentType(100) // 0-100
while (ColorLoop == true) {
if (ColorDirection == false) {
color = color + ColorInc // ColorInc
if (color > 360)
color = 0
}
else {
color = color - ColorInc // ColorInc
if (color < 0)
color = 360
}
logInfo("changeColor", String::format ("color = %d", color))
Hue3LampColor.sendCommand(new HSBType(new DecimalType(color), new sat, new bright))
Thread::sleep(100)
}
end
I get the following error message:
09:21:10.168 [ERROR] [.script.engine.ScriptExecutionThread] - Rule āchangeColorā: An error occurred during the script execution: null
Please let me know what I have to do to get this f**king code running.
Thanks and best regards
Steffan