[SOLVED] HSBType fails in Script

For the ambiguous function call, explicetly cast it to one or the other:

item.sendCommand(HSBType::fromRGB(125, 125, 125) as Command)

Similar problems occur when using DecimalType with sendCommand and postUpdate.

1 Like

Sorry to inform that this does not work for HSBVAlue:
Group_DMX_LivingRoom.members.filter[l|l.state.toString != hsbOff.toString].forEach[l| sendCommand(l,hsbOff as Command) ]

or
Group_DMX_LivingRoom.members.filter[l|l.state.toString != hsbOff.toString].forEach[l| l.sendCommand(hsbOff as Command) ]

seems like hsbvalue can not be casted to command:(

Command should be State

http://www.eclipse.org/smarthome/documentation/javadoc/org/eclipse/smarthome/core/library/items/ColorItem.html

Can still not figure out how to get rid off the ambigouse error:

Group_DMX_LivingRoom.members.filter[l|l.state.toString != hsbOff.toString].forEach[l| l.sendCommand(hsbOff as State) ]

or

Group_DMX_LivingRoom.members.filter[l|l.state.toString != hsbOff.toString].forEach[l| l.send(hsbOff as Command) ]

or
Group_DMX_LivingRoom.members.filter[l|l.state.toString != hsbOff.toString].forEach[l| l.postUpdate(hsbOff as HSBType) ]

does fix the problem

When all else fails, use .toString and move on to more interesting problems.

I would have expected pretty much all of those to work. I’m not sure what is going on but when you use toString it will force the code down a different path that should eliminate the error.

rule “SD_Rotgbfb”
when

Item SD_Red_Schalter received command
then

var DecimalType hue = new DecimalType(240) // 0-360; 0=red, 120=green, 240=blue, 360=red(again)
var PercentType sat = new PercentType(100) // 0-100
var PercentType bright = new PercentType(100) // 0-100
var light = new HSBType(hue,sat,bright)

SD_Red.sendCommand(light)

end

Ich habe das Problem, sendCommand ist Unterstrichen und der Compiler verweigert den Befehl

Item:
Color SD_Red “Rot” { channel=“hue:0210:1:bulb2:color” }
Switch SD_Red_Schalter
SSitemap: Switch item=SD_Red_Schalter mappings=[ON=“Click”]

Ich benutze Visual Studio Code mit Addon openhabian

ich bitte um Hilfe

danke