Mqtt.things config mixes channel values

  • Platform information:
    • Docker Container
    • openHAB version: 3.2.0

When configuring a 5-channel LED Strip (RGB, WW, CW) via MQTT as one thing with three channels, I can set the Colors properly (mqtt message correctly send with correct HSB value) but when I try to set the color temperature (slider from cold white to warm white), the colder the temperature gets, the more the dimmer value gets decreased (it gets darker). There seems to be some kind of connection between the color temperature slider and the dimmer value. Example message where I set the color temperature to ā€œcoldā€ (coldest value is 153 according to tasmota docs):

{"POWER":"ON","Dimmer":13,"Color":"0000002100","HSBColor":"0,0,0","White":13,"CT":153,"Channel":[0,0,0,13,0]}

I then tried to decouple those with configuring three things with only one channel for each thing and suddenly the color temperature set via slider is send correctly with the MQTT message without interfering the dimmer value. Exampe message where I did the same as above:

{"POWER":"ON","Dimmer":100,"Color":"000000FF00","HSBColor":"0,0,0","White":100,"CT":153,"Channel":[0,0,0,100,0]}

The Value of the key ā€œWhiteā€ seems to be coupled to the Dimmer value which is fine and didnā€™t make any problems so I ignored that.

As a side note: I flashed the LED Controller with Tasmota so the expected color temperature values are from 153 to 500 which I configured with the min and max option.

Configs:
mqtt.things

Bridge mqtt:broker:mosquitto "mqttBroker" [ host="localhost", port=1883, secure=false ]
{
    // Problems with this config
    Thing topic rgbcct1 "LED Strip 1" @ "Other" {
    Channels:
        Type color: rgbcct1Color [stateTopic="stat/RGBCCT_1", commandTopic="cmnd/RGBCCT_1/HSBColor", transformationPattern="JSONPATH:$.HSBColor"]
        Type dimmer: rgbcct1Temp [stateTopic="stat/RGBCCT_1", commandTopic="cmnd/RGBCCT_1/CT", transformationPattern="JSONPATH:$.CT", min=153, max=500]
        Type dimmer: rgbcct1Dimmer [stateTopic="stat/RGBCCT_1", commandTopic="cmnd/RGBCCT_1/Dimmer", transformationPattern="JSONPATH:$.Dimmer"]
    }

    // These configs work fine
    Thing topic rgbcct1CP1 "LED Strip 1 CP1" @ "Other" {
    Channels:
        Type color: rgbcct1ColorCP [stateTopic="stat/RGBCCT_1", commandTopic="cmnd/RGBCCT_1/HSBColor", transformationPattern="JSONPATH:$.HSBColor"]
    }
    Thing topic rgbcct1CP2 "LED Strip 1 CP2" @ "Other" {
    Channels:
        Type dimmer: rgbcct1TempCP [stateTopic="stat/RGBCCT_1", commandTopic="cmnd/RGBCCT_1/CT", transformationPattern="JSONPATH:$.CT", min=153, max=500]
    }
    Thing topic rgbcct1CP3 "LED Strip 1 CP3" @ "Other" {
    Channels:
        Type dimmer: rgbcct1DimmerCP [stateTopic="stat/RGBCCT_1", commandTopic="cmnd/RGBCCT_1/Dimmer", transformationPattern="JSONPATH:$.Dimmer"]
    }
}

ledStripTest.items

// Items for "broken" things
Color rgbcct1Color "rgb1Color" <colorwheel> ["Color"] { channel="mqtt:topic:mosquitto:rgbcct1:rgbcct1Color" }
Dimmer rgbcct1Temp "rgb1Temp" <temperature> ["ColorTemperature"] { channel="mqtt:topic:mosquitto:rgbcct1:rgbcct1Temp" }
Dimmer rgbcct1Dimmer "rgbcct1Dimmer" <slider> ["Dimmer"] { channel="mqtt:topic:mosquitto:rgbcct1:rgbcct1Dimmer" }

// Items which work fine
Color rgbcct1ColorCP "rgb1Color" <colorwheel> ["Color"] { channel="mqtt:topic:mosquitto:rgbcct1CP1:rgbcct1ColorCP" }
Dimmer rgbcct1TempCP "rgb1Temp" <temperature> ["ColorTemperature"] { channel="mqtt:topic:mosquitto:rgbcct1CP2:rgbcct1TempCP" }
Dimmer rgbcct1DimmerCP "rgbcct1Dimmer" <slider> ["Dimmer"] { channel="mqtt:topic:mosquitto:rgbcct1CP3:rgbcct1DimmerCP" }

ledStripTest.sitemap

sitemap ledStripTest label="LED strip test" {
    Frame label="experimental" {
        Colorpicker item=rgbcct1Color label="Color" icon="colorwheel"
        Slider item=rgbcct1Temp label="Light temp" icon="sun"
        Slider item=rgbcct1Dimmer label="Brightness" icon="sun_clouds"
    }

    Frame label="experimentalCP" {
        Colorpicker item=rgbcct1ColorCP label="Color" icon="colorwheel"
        Slider item=rgbcct1TempCP label="Light temp" icon="sun"
        Slider item=rgbcct1DimmerCP label="Brightness" icon="sun_clouds"
    }
}

Is there a reason or a misconfiguration (or misunderstanding between things and channels)? I dived into the documentation but didnā€™t found anything that helps on this specific problem. I would prefer having just one thing because the LED Controller is one thing as well and it is much cleaner configuration wise.

edit:
I fiddled around with the configuration because I saw a missing sub path in the stateTopic. And out of nowhere the ā€œall channels in oneā€ config works just fine now (I added an on-off switch as well):

    Thing topic rgbcct1 "LED Strip 1" @ "Other" {
    Channels:
        Type switch: power [stateTopic="stat/RGBCCT_1/POWER", commandTopic="cmnd/RGBCCT_1/POWER"]
        Type color: rgbcct1Color [stateTopic="stat/RGBCCT_1/RESULT", commandTopic="cmnd/RGBCCT_1/HSBColor", transformationPattern="REGEX:(.*HSBColor.*)āˆ©JSONPATH:$.HSBColor"]
        Type dimmer: rgbcct1Temp [stateTopic="stat/RGBCCT_1/RESULT", commandTopic="cmnd/RGBCCT_1/CT", transformationPattern="REGEX:(.*CT.*)āˆ©JSONPATH:$.CT", min=153, max=500, step=1]
        Type dimmer: rgbcct1Dimmer [stateTopic="stat/RGBCCT_1/RESULT", commandTopic="cmnd/RGBCCT_1/Dimmer", transformationPattern="REGEX:(.*Dimmer.*)āˆ©JSONPATH:$.Dimmer"]
    }

What I still donā€™t understand is that changing the stateTopic has such impact on the commands where channels get mixed.

Yes.
There is no practical difference between your single-Thing and multi-Thing configurations, all the magic is in the channels.

So something else is causing the interactions. Iā€™d recommend looking at your events.log, there you should be able to pick out commands originating from your UI and state updates originating locally or from the remote device (careful note of timestamps).

Beware that when editing xxx.things files not all bindings will immediately implement some changes, and that includes MQTT. When you have things as you want them, restart binding (or openHAB) to ensure you really have a clean slate, and are not looking at some old-new mishmash effect.

1 Like

Ok, thanks for the hint with the event log, I will analyze them. Also I didnā€™t know of the delay when it comes to things file changes.

See my edit as well as I got a working solution for now with just one Thing configured with multiple channels. Nevertheless I will try to analyze what went wrong in the first place after I took a couple of days off of this topic^^