RGB + CCT OH3 Colorpicker

How to set up connection to the GRB - CCT tasmota light bult with OH3 (visual configuration) and Tassmota MQTT.

I have tryed to create 5 dimmer items which read the curent state from mqtt

  - id: B1_02_R
    channelTypeUID: mqtt:dimmer
    label: B1_02_R
    description: null
      stateTopic: /home/Tasmota_B1-02/stat/RESULT
      transformationPattern: JSONPATH:$.Channel[0]

after some of the slider changed value, javascript will be executed all slider values will be extracted and mqtt command is sent to to change RGB + CCT value for the bulb…

var SE = Java.type("org.openhab.core.model.script.actions.ScriptExecution");
var TA = Java.type("org.openhab.core.model.script.actions.Things");
var ZDT = Java.type("java.time.ZonedDateTime");  
var logger = Java.type("org.slf4j.LoggerFactory").getLogger("org.openhab.model.script.Rules.Examples");

mqttActions = TA.getActions("mqtt","mqtt:broker:openhub33qnap")

redVal = itemRegistry.getItem("SonnoffB102_B102R").getState()
redVal255 = parseInt(255 * (redVal / 100))
greenVal = itemRegistry.getItem("SonnoffB102_B102G").getState()
greenVal255 = parseInt(255 * (greenVal / 100))
blueVal = itemRegistry.getItem("SonnoffB102_B102B").getState()
blueVal255 = parseInt(255 * (blueVal / 100))
whiteVal = itemRegistry.getItem("SonnoffB102_B102W").getState()
whiteVal255 = parseInt(255 * (whiteVal / 100))
warmwhiteVal = itemRegistry.getItem("SonnoffB102_B102WW").getState()
warmwhiteVal255 = parseInt(255 * (warmwhiteVal / 100))

cmdval = "" + redVal255 + "," + greenVal255 + "," + blueVal255 + "," + whiteVal255 + "," + warmwhiteVal255
logger.info("val:" + cmdval); 

mqttActions.publishMQTT("/home/Tasmota_B1-02/cmnd/Color1", cmdval)

generally it works, but if I move the slider in the quick way, there the never ending message loop is starting… Slider 1 changed value → the script will be executed → mqtt message is sent to the bulb → the buld send the color update mqtt message → OH3 Rule is listing to changes and update the slider → never ending loop…

What is the best way to visual controll all the RGB+CCT leds with OH3?

If OH is the only system that will control your light, than maybe just remind the state topic as you do not need to get current color state.

OH will always remember the last state of the item (unless you restart the system and the state of not restored) and there is only little to no benefit of reason current state

This topic was automatically closed 41 days after the last reply. New replies are no longer allowed.