I’m new to OpenHAB (but with years of Home Assistant experience), and was trying to set up a ceiling light running Tasmota through MQTT.
MQTT result messages look like this:
stat/utorch2/RESULT {"POWER":"ON","Dimmer":47,"Color":"393E","HSBColor":"0,0,47","Channel":[22,24],"CT":334}
while the brightness and colour temperature commands go into cmnd/utorch2/DIMMER
and cmnd/utorch2/CT
There was no problem with the brightness, probably because it has the same 0-100 range as the dimmer item, so no transformation required. It works fine, if I change brightness of the light in HA, the slider in OpenHAB also changes.
I cannot get colour temperature to work the same way though, probably because its range is from 153-500, so I’ve specified min=153, max=500 in the MQTT thing channel:
Thing mqtt:topic:entry "Előszoba" (mqtt:broker:MQTT) {
Channels:
Type string : reachable "Reachable" [ stateTopic="tele/utorch2/LWT" ]
Type switch : power "Power" [ stateTopic="stat/utorch2/POWER", commandTopic="cmnd/utorch2/POWER" ]
Type dimmer : dimmer "Brightness" [ stateTopic="stat/utorch2/RESULT", commandTopic="cmnd/utorch2/DIMMER", transformationPattern="REGEX:(.*Dimmer.*)∩JSONPATH:$.Dimmer" ]
Type dimmer : colortemp "Color Temp" [ stateTopic="stat/utorch2/RESULT", commandTopic="cmnd/utorch2/CT", transformationPattern="REGEX:(.*CT.*)∩JSONPATH:$.CT", min=153, max=500 ]
}
with this item definition:
Group gEntryLight "Előszoba lámpa" <light> (Entry) ["Lightbulb"]
Switch EntryLightControl "Lámpa" <light> (gEntryLight) ["Control"] { channel="mqtt:topic:entry:power" }
Dimmer EntryLightBrightness "Fényerő" <light> (gEntryLight) ["Light"] { channel="mqtt:topic:entry:dimmer", autoupdate="false" }
Dimmer EntryLightColor "Színhőmérséklet" <light> (gEntryLight) ["Light"] { channel="mqtt:topic:entry:colortemp", autoupdate="false" }
Now when I set CT to 327 in Home Assistant, I can see in OpenHAB events.log that EntryLightColor
changes to about 50, which is fine, so the mapping/transformation was done from the range 153-500 where 327 is in the middle, so 50% is correct for a dimmer slider.
But in OpenHAB UI, it seems not only the displayed range of the slider has to be 153-500, but also the value, as the dot (with the value of “50”) is way off the scale on the left:
Also, if I move the slider to anywhere, no MQTT message is generated, I guess because the 0-100 value is out-of-range for 153-500. It seems there is no range mapping for the slider, even though its scale is correct.
So what can be done to map the 0-100 range of the slider correctly to the 153-500 range of the MQTT channel? Shouldn’t it be automatic when min, max values are specified?