Just fired up a Fibaro RGBW dimmer I recently bought. All is good, except using the colour wheel. When I select a colour, I get the message:
Error during the execution of rule 'Set RGB Value': org.eclipse.xtext.util.PolymorphicDispatcher$NoSuchMethodException: Couldn't find method ''_assignValue'' for objects [JvmVoid: (eProxyURI: rgbw.rules#xtextLink_::0.2.0.2.0.0::0::/1), <null> hsbValue <XCastedExpressionImpl>, 238.39999999999998,58.59375,50.19607843137255, org.eclipse.xtext.xbase.interpreter.impl.DefaultEvaluationContext@1614203a, org.eclipse.xtext.util.CancelIndicator$1@28c0da7b]
Rule:
import org.openhab.core.library.types.HSBType
rule "Set RGB Value"
when
Item RGBWWheel changed
then
hsbValue = RGBWWheel.state as HSBType
redValue = hsbValue.red.intValue
greenValue = hsbValue.green.intValue
blueValue = hsbValue.blue.intValue
sendCommand(RGBWRed,redValue)
sendCommand(RGBWGreen,greenValue)
sendCommand(RGBWBlue,blueValue)
end
I’ve had a look on the internet, but am pretty stumped. One place suggested those sorts of errors are to do with type problems, but can’t figure out what the solution would be.
I added .toString to the end of each RGB line, and changed the import statement to import all types, but the problem is still there. OpenHAB designer complains about the hsbValue = RGBWWheel.state as HSBType line, stating : Couldn’t resolve reference to JvmIdentifiableElement ‘hsbValue’. Designer always seems a bit quirky and complains about stuff so not sure if that’s relevant?
Check variable types. hsbValue should be of type HSBType and red/green/blueValue need to be strings.
As with (almost) any programming language, you need to declare variables before you can use them.
What’s missing in your code is
var HSBType hsbValue
var String redValue
var String blueValue
var String greenValue
after the ‘import’ line.
I haven’t used Designer, so can’t tell how that’s supposed to work there, but you can simply manually edit the rules file.
var HSBType hsbValue
var String redValue
var String greenValue
var String blueValue
rule "Set RGB Value for RGBW Controller"
when
Item LRRGBWControllerColorValue changed
then
hsbValue = LRRGBWControllerColorValue.state as HSBType
redValue = hsbValue.red.intValue.toString
greenValue = hsbValue.green.intValue.toString
blueValue = hsbValue.blue.intValue.toString
sendCommand(LRRGBWControllerRedLoadLevelTarget,redValue)
sendCommand(LRRGBWControllerRedLoadLevelTarget,greenValue)
sendCommand(LRRGBWControllerRedLoadLevelTarget,blueValue)
end
Strangely my log level is at DEBUG already and still i dont get any meaningful information about the error, i thought in OH2 we dont need to use import the statement or do we ? anyways i used the import statement as below still cannot get rid of error.
hi Stuart, I am not binding these items to anything as they were meant to be used inside the rule and sitemap only so basically String LRRGBWControllerColorValue is used in sitemap tied to Colorpicker and then in rules individual color load level Items are used like LRRGBWControllerRedLoadLevelTarget (<<-- this is bound to real dimmer device using mios binding)
rest all items defined can be ignored as they are redundant from pervious code attempt
The problem is i am not even reaching that stage where value if being assigned to this item, it just gives error on script and exits.
Guys I tried all that was suggest on forum and still not getting this to work … any help
import org.eclipse.smarthome.core.library.types.*
var HSBType hsbValue
var String redValue
var String greenValue
var String blueValue
rule "Set RGB Value for RGBW Controller"
when
Item RGBWControllerColorValue changed
then
hsbValue = RGBWControllerColorValue.state as HSBType
redValue = hsbValue.red.intValue.toString
greenValue = hsbValue.green.intValue.toString
blueValue = hsbValue.blue.intValue.toString
sendCommand(LRRGBWControllerRedLoadLevelStatus,redValue)
sendCommand(LRRGBWControllerGreenLoadLevelStatus,greenValue)
sendCommand(LRRGBWControllerBlueLoadLevelStatus,blueValue)
end
// Items
String RGBWControllerColorValue
//sitemap
Colorpicker item=RGBWControllerColorValue
ERROR remains one line in the Log with log level at DEBUG
[ERROR] [.script.engine.ScriptExecutionThread] - Rule ‘Set RGB Value for RGBW Controller’: org.eclipse.smarthome.core.library.types.HSBType
Btw openhab designer complains to much
What i do see is that you do not have a master switch to turn the rgbb on.
Please lookup my old post about this.
If you donnot find it let me know.