MQTT - Osram Lightify Flex RGBW

Hello community, I bought an Osram Lightify Flex RGBW led stripe about two weeks ago. Until yesterday I had it paired with my Hue hub. But now I want it to use it with my CC2531 and zigbee2mqtt.

I already have 4 Osram SmartPlugs, 2 Aqara door/window contacts and a Aqara MagicCube working perfectly with this setup.
But I don’t know how to find out the correct topics for color, brightness, saturation…
So far I can only set it ON and OFF.

This is the correponding part from my thing file:

Thing topic osramLightifyFlexRGBW "Osram Lightify Flex RGBW 01" @"MQTT" {
        Type switch : state  
            [ stateTopic="zigbee2mqtt/lightifyflex01", transformationPattern="JSONPATH:$.state", commandTopic="zigbee2mqtt/lightifyflex01/set", on="ON", off="OFF" ]

Can’t comment about color and saturation, but this works for ON/OFF and brightness.

Thing topic zigbee2mqtt "My Light" @ "Bedroom" {
        Type switch : power  "Power"               [ stateTopic="zigbee/0xb0ce1814030ac279", transformationPattern="JSONPATH:$.state",
                                                    commandTopic="zigbee/0xb0ce1814030ac279/set", on="ON", off="OFF" ]
        Type dimmer : dimmer "Dimmer"              [ stateTopic="zigbee/0xb0ce1814030ac279",
                                                    commandTopic="zigbee/0xb0ce1814030ac279/set", transformationPattern="JSONPATH:$.brightness", formatBeforePublish="{\"brightness\":%s}" ]
1 Like

Many thanks! Brightness is working now.
Next step would be to get a channel of type “colorRGB” (which seems to be in the format (51,52,53)) to publish something like that:
{“color”: {“r”:50,“g”:51,“b”:52}}

Can this be achieved too by using “formatBeforePublish”?

I only know it through the paper ui with an outgoing transformation and a an colorRGB channel of a generic MQTT Thing. You could use a JS Transformation like this:

(function(i) {

    var rgb = i.split(",");
    osramrgb1 = {"r":rgb[0],"g":rgb[1],"b":rgb[2]}
    osramrgb2 = {"color":osramrgb1}
    return JSON.stringify(osramrgb2);


Glad you got brightness working.:+1:

I don’t own an RGB light to test with but see what this formatBeforePublish does.


EDIT: Also see this github link

That format before publish will probly not give you the needed transformation and it’s for color temp which is a single numeric value.
I tested the Javascript Transformation and it works as expected but you need the 2.5M1 release for this. It outputs exactly this format from an openhab color item :


What’s working too - at least most of the time - is (after experimenting for hours):


That’s why I put this in my things file:

Type colorRGB : colorRGB "Color RGB"
            [ commandTopic="zigbee2mqtt/lightifyflex01/set", formatBeforePublish="{\"color\":{\"rgb\":\"%s\"}}" ]

But it seems I have problems with my zigbee range and I don’t want to tear off the led stripe from my sideboard for testing.
The response in zigbe2mqtt is:

  zigbee2mqtt:info 4/7/2019, 8:22:51 AM MQTT publish: topic 'zigbee2mqtt/lightifyflex01', payload '{"state":"ON","brightness":20,"linkquality":0,"color_temp":50,"color":{"x":0.314,"y":0.3241}}'
1 Like

Ah if zigbee2mqtt doesnt actually need the “r”:,“g”:,“b”: prefixes in the json and can just accepts and parse a 123,123,123 format that would indeed be easier and less cpu intensive than a JS transform.
I use the Osram RGBW led strip with the Openhab Zigbee binding and I have the same range problems, I think the Osram stripe in general just hasnt got the best range compared to other zigbee products.

What I still do not understand is the “color_temp” setting. What does it do? I can send and receive it, but it doesn’t change anything visible to me.

I know there are some Bulbs which have two modes, one CT and one Color. Maybe zigbee2mqtt uses the same json format for all color/ct product but as the osram strip doesnt have a ct mode the setting doesnt actually do anything. But this is just guessing as I dont use zigbee2mqtt.

did you finally was able to set the color from openhab?
I can’t set the color from openhab, if i send via mqtt.fx


Than i get the expected green.

my mqtt.things:

    Thing topic TischLampe "Schreibtisch Lampe" @ "Schlafzimmer"
            Type string : TischLampe_state [commandTopic="zigbee2mqttSZ/TischLampe/set", stateTopic="zigbee2mqttSZ/TischLampe", transformationPattern="JSONPATH:$.state", formatBeforePublish="{ \"state\": \"%s\" }"]
            Type dimmer : TischLampe_bright [commandTopic="zigbee2mqttSZ/TischLampe/set", stateTopic="zigbee2mqttSZ/TischLampe", transformationPattern="JSONPATH:$.brightness", formatBeforePublish="{ \"brightness\": \"%s\" }"]
            Type colorRGB : TischLampe_RGB "Farbe Tischlampe RGB" [ commandTopic="zigbee2mqtt/TischLampe/set", stateTopic="zigbee2mqttSZ/TischLampe", transformationPattern="JSONPATH:$.color", formatBeforePublish="{\"color\":{\"rgb\":\"%s\"}}" ]


String SchreibtischLampe_State "Schalterstand Schreibtischlampe [%s]"  <light> {channel="mqtt:topic:mosquitto:TischLampe:TischLampe_state"}
Color SchreibtischLampe_color "FarbeSchreibtisch Lampe [%s]" <light> {channel="mqtt:topic:mosquitto:TischLampe:TischLampe_RGB"}
Dimmer SchreibtischLampe_brightness "Helligkeit Lampe [%s]" <light> {channel="mqtt:topic:mosquitto:TischLampe:TischLampe_bright"}

If a change the color i get following error msg from openhab.

2019-12-19 20:30:35.316 [WARN ] [ab.binding.mqtt.generic.ChannelState] - Command '{x=0.1707, y=0.7139}' not supported by type 'ColorValue': {x=0.1707, y=0.7139} is not a valid RGB syntax

How do you change the colour?
Can you show the log for when you change the colour, please?

If i send via mqtt.fx


to zigbee2mqttSZ/TischLampe/set gets lets say purple, zigbee2mqtt log shows:

Dec 19 22:48:06 zigbeeSZ npm[704]: zigbee2mqtt:info  2019-12-19 22:48:06: MQTT publish: topic 'zigbee2mqttSZ/TischLampe', payload '{"state":"ON","last_seen":"2019-12-19T22:48:06+00:00","brightness":100,"linkquality":2,"color":{"x":0.3158,"y":0.3252},"color_temp":155}'

so it gets automatically converted…

if I use the a colorpicker element from my sitemap.

Colorpicker item=SchreibtischLampe_color icon="colorpicker"

and change the color using this colorpicker.
No mqtt message is generated.
and I get the message i showed in openhab.log

2019-12-19 23:53:23.336 [WARN ] [ab.binding.mqtt.generic.ChannelState] - Command '{x=0.3158, y=0.3252}' not supported by type 'ColorValue': {x=0.3158, y=0.3252} is not a valid RGB syntax

You still haven’t shown me the full log when you change this colorpicker…

What gets sent by openHAB on MQTT?

Remove the stateTopic and tranformation pattern in the colorRGB channel for testing

i was blind


is wrong if I use the right Zigbee2MQTT instance then i can change the color :slight_smile:


Please tick the thread as solved

1 Like

the strange thing is that i can’t close it :frowning:

Hope it’s ok to revive this old thread, but my issue really relates to this
First thanks for your exmaples here, helped me a lot.

I noticed today, that I can’t control the color of my Osram Flex anymore.

Thing config (taken from posts above)

Type colorRGB : color "Farbe"              [ stateTopic="zigbee2mqtt/osram-flex-2", commandTopic="zigbee2mqtt/osram-flex-2/set", transformationPattern="JSONPATH:$.color", formatBeforePublish="{\"color\":{\"rgb\":\"%s\"}}" ]

Item config

Color					Osram_Flex02_Color				"Farbe Lampe [%s]"						<light>			(gOsramFlex2)								{channel="mqtt:topic:mosquitto:osram02flex:color"}

If I change the color via BasicUI OH log says:
Osram_Flex02_Color changed from 91,73,50 to 4,53,50

But MQTT logs:

Any hints, where the “125” comes from? Maybe an issue with zigbee2mqtt (1.16.2)?

Does this help?

1 Like

Yes, that’s it!
I absolutely did not associate that behavior with the output option in zigbee2mqtt
Thanks for your hint, really appreciate it!

I’d had better checked that thread you referred to before asking here :wink: