I’ve been racking my brain on this and after 12 hours I definitely stuck but perhaps, there is an issue with the TP-Link binding.
I’m using OH 2.5 and the beta TP-Link binding (Beta 30-8-2019). I have a virtual switch item that I’m using to issue groups changes to several KL130 light bulbs (these are the ones that have fulll color and white temperature control). I can turn them on, set the temperature but changing the color is no go. To diagnose, I’ve been using one of the bulbs to test (item office_lamp_c). Here are the relevant bits…
(I can provide the complete blocks if needed)
.Items:
// Groups
Group Lights
Group:Switch:OR(ON,OFF) internal (Lights)
Group:Switch:OR(ON,OFF) external (Lights)
Group internalColor // this would be the group to control the bulb color
Group internalClrTmp
// virtual switches
String scene_vs
Switch office_lamp_p "Office Lamp" <switch> (Lights,internal) { channel="tplinksmarthome:kl130:6FF206:color" }
Number office_lamp_ct "Office Lamp Color Temperature [%dK]" (Lights,internalClrTmp) { channel="tplinksmarthome:kl130:6FF206:colorTemperatureAbs" }
Color office_lamp_c "Office Lamp Color" <colorwheel> (Lights,internalColor) { channel="tplinksmarthome:kl130:6FF206:color" }
.sites:
Frame label="Controls" {
Group item=Lights {
Selection item=scene_vs label="Scenes" mappings=[0="Default", 1="TV Lighting", 2="Fireplace Lighting"]
}
}
.rules:
import org.eclipse.smarthome.core.library.types.HSBType
import org.eclipse.smarthome.core.library.types.DecimalType
import org.eclipse.smarthome.core.library.types.PercentType
rule "Scene Selection"
when Item scene_vs received command
then
if (receivedCommand == "0") {
val HSBType myColor = new HSBType(new DecimalType(0),new PercentType(0),new PercentType(5))
var Number myColorTemp = 2700
internal.sendCommand(ON)
office_lamp_c.sendCommmand(myColor)
internalClrTmp.sendCommand(myColorTemp)
}
end
The error I am getting, which is visible in openhab.log file is:
[ERROR] [ntime.internal.engine.RuleEngineImpl] - Rule ‘Scene Selection’: ‘sendCommmand’ is not a member of ‘org.eclipse.smarthome.core.library.items.ColorItem’; line 14, column 9, length 35
What is strange is that I should be able to directly use an HSB string, like so:
office_lamp_c.sendCommmand("0,0,5")
That is literally take from the event.log, when I control the light via the Kasa app…
[vent.ItemStateChangedEvent] - office_lamp_c changed from 0,0,100 to 0,0,5
However, in both case, I get that same error.
After reviewing similar posts about controlings hues for other bulbs I’m at a lost for what might be wrong. I’ve tried declaring the vars outside the block (i.e. above the rule name and below the imports) as well as directly referenings the libraries and not using the imports. I consistently get the same error.
I don’t think I’ve missed anything but if I have please let me know. There are some other quirks and issues I’ve noticed using the Kasa bulbs (which I absolute love and are priced right) that I haven’t posted about yet (and beta is beta) but this error doesn’t make much sense to me.