HSB Struggles with Kasa Smart Lamp

Openhabian 3.2
TPLink Binding
KL135 Smart Lamp

I’m trying to power this lamp on using examples of syntax from the community but not having any success. I don’t want to change the Hue and Saturation, just the brightness which is used to turn the lamp on with my Astro binding. These don’t have a power channel to switch like most other devices.

val HSBType MyColor = HSBType(new DecimalType(0),new PercentType(0),new PercentType(100))

Gives me:

The method HSBType(DecimalType, PercentType, PercentType) is undefined; line 1, column 22, length 7

What would be the correct syntax to just power one of these on?


You know you can send a single decimal as a command to Color type Item, just like Dimmer type? Any given binding may or may not implement such commands, but if it is actioned it would be expected to control device brightness only.


Thanks. That worked although I did just install the latest Beta TPLink devices as well.


You forgot new before HSBtype:

val HSBType MyColor = new HSBType(new DecimalType(0),new PercentType(0),new PercentType(100))

But anyway, just like @rossko5 says, if you only want to change brightness you can send a number. Or on/off to switch it.

1 Like

Good, question then, if I just use Rules DSL, what would be the syntax to adjust both Saturation and Hue along with bBrightness because it fails with:

failed: val new HSBType MyColor = new HSBType(new DecimalType(0),new PercentType(0),new PercentType(100))

That is one new to many :smile: when creating objects this needs to be done with the new keyword in front of it, otherwise it’s a function call.

But don’t put the new there. That’s a place to describe your variable, and new xxx is a doing word, an instruction.

In DSL rules its generally best to leave out the description altogether
val MyColor = new HSBType(...
it already knows what type its going to be