Cannot convert from State to HSBType

I have the follwing rule which gives me an error in the LSP (VSCode):

rule “WLED: Adapt Color Parameter to WLED Notation”
Item WLED_Color received update
val HSBType newLEDState = triggeringItem.state
val rgb = 16777215 + newLEDState.getRGB
val mqttActions = getActions(“mqtt”,“mqtt:broker:mosquitto”)
mqttActions.publishMQTT(“wled/wztv/col”,"" + rgb)

Error message: Type mismatch: cannot convert from State to HSBType

My item definition is like this:

Color WLED_Color “Farbe” (Group_WLED)

Any ideas what causes the message and how I could prevent it from showing up?


It means what it says. An openHAB state object (which may have states like ON, CLOSED or 50% etc.) is not directly parsable by the HSB constructor.

You should be able to cast the state to HSBType
val newLEDState = triggeringItem.state as HSBType

Do you want to try a binding for WLED

Download and unzip into your openhab2-addons directory.

Its best to set a static ip on the WLED for this to work