I just upgraded to Oh2.X and my rules now throw errors for the HSBType conversions back to RGB. The light only accepts RGB values.
This is the log output:
2020-04-11 22:50:06.329 [INFO ] [clipse.smarthome.model.script.vColor] - vColor=353,98,50 2020-04-11 22:50:06.331 [ERROR] [ntime.internal.engine.RuleEngineImpl] - Rule 'vMan_Color': Could not cast 353,98,50 to org.eclipse.smarthome.core.library.types.HSBType; line 109, column 16, length 32
This is my rule:
rule 'vMan_Color' when Item vColor changed then logInfo("vColor", "vColor=" + vColor.state); val red = (vColor.state as HSBType).red / 100 * 255 val green = (vColor.state as HSBType).green / 100 * 255 val blue = (vColor.state as HSBType).blue / 100 * 255 logInfo("scene.rules", "R: " + red) logInfo("scene.rules", "G: " + green) logInfo("scene.rules", "B: " + blue) end
I think this as to do with “The
HSBType state type can no longer be constructed using a
java.awt.Color object, and there is no longer a
toColor() method.” From here 2.X Migration
Anyway I can still get RGB values from the color picker?