I am trying to make a rule that changes the Hue value of a HSB Type value. The rule looks like this:
val HSBType color = Light_RGB.state as HSBType
val DecimalType Hue = color.getHue()
while (Button.state == ON) {
//Hue = Hue + 10.0;
color = new HSBType(Hue,(color.getSaturation() as PercentType),(color.getBrightness() as PercentType));
sendCommand(Light_RGB,color);
Thread::sleep(250);
}
This works fine, it just doesn’t change the value. Once I uncomment the line //Hue = Hue + 10.0;
I receive Rule 'Hue Switcher': An error occured during the script execution: Could not invoke constructor: org.eclipse.smarthome.core.library.types.HSBType.HSBType(org.eclipse.smarthome.core.library.types.DecimalType,org.eclipse.smarthome.core.library.types.PercentType,org.eclipse.smarthome.core.library.types.PercentType)
. I have removed the rule ‘xxx’ when ‘yyy’ then ‘zzz’ part as that is working perfectly, just to avoid confusion.
Why is it not possible to add a value to the Hue like i want it to? Of course I would have to check for the maximum value once I want to use this in production, but this should work just fine for now, but it doesn’t.