FIbaro RGBW and colour wheel

Hello,

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.

Thoughts?

Thanks

Depends on the types of redValue etc., which you didn’t show.
If you followed the examples on the forum, it’s likely a string.
So try

redValue = hsbValue.red.intValue.toString
reenValue = hsbValue.green.intValue.toString
blueValue = hsbValue.blue.intValue.toString

Your import statement is pretty unusual, too.
Commonly you would import org.openhab.core.library.types.*

Hello,

Thanks for the reply.

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?

Thanks

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.

That fixed it. Thanks for the help!

import org.openhab.core.library.types.*

var HSBType hsbValue
var String redValue
var String greenValue
var String blueValue

rule "Set RGB Value"
when
    Item RGBWWheel changed
then

    hsbValue = RGBWWheel.state as HSBType
    redValue = hsbValue.red.intValue.toString
    greenValue = hsbValue.green.intValue.toString
    blueValue = hsbValue.blue.intValue.toString

    sendCommand(RGBWRed,redValue)
    sendCommand(RGBWGreen,greenValue)
    sendCommand(RGBWBlue,blueValue)
end

I am still not able to get this working
Log shows correct value change of LRxxxColorValue
and then gives error as below -

[ERROR] [.script.engine.ScriptExecutionThread] - Rule ‘Set RGB Value for RGBW Controller’: org.eclipse.smarthome.core.library.types.HSBType

– no more further details in log

// ITEMS

String  LRRGBWControllerColorValue
String  LRRGBWControllerRedValue
String  LRRGBWControllerGreenValue
String  LRRGBWControllerBlueValue

//SITEMAP

Colorpicker item=LRRGBWControllerColorValue     label="Curtain Light Color"             icon="colorwheel"

//RULE

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

Increase debug level to get meaningful output.
You likely forgot this at the beginning of the rules file:
import org.openhab.core.library.types.*

Have you got the items bound to something? As it is, you are only defining the items.

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.

import org.openhab.core.library.types.*

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

Should the Item not be of type Color, rather than String?

What version of openhab are you using ?

Btw openhab designer complains to much :wink:
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.

My config should be there.

Kindest regards