I work with Openhab 3.4.3 and Jython scripting.
My goal is to assign a previously defined colour to a colour item in the script.
I have the colour in HEX format (FFFFFF).
The direct assignment via (core.utils) sendCommandCheckFirst(itemRegistry.getItem(“MyColorItem”), “FFFFFF”) does not work.
→ ‘FFFFFF’ is not an accepted command type for ‘MyColorItem’.
Even if I change the format to #FFFFFF I get the same error.
I found out that I have to set the colour as HSB value.
sendCommandCheckFirst(itemRegistry.getItem(“MyColorItem”), “18.529411764705856, 80.95238095238095, 98.82352941176471”)
→ Works.
I have already written a hex2hsb.js transformation. However, I do not know how to integrate it correctly.
myrule.log.info(Transformation.transform(“JS”, “transform/hex2rgb.js”, “#FFFFFF”)) gives me #FFFFFF as result. Of course, I have installed the JS transformation as a plug-in.
Can anyone tell me what I am doing wrong?
Translated with DeepL Translate: The world's most accurate translator (free version)