How to setup a Ikea GU10 rgb light with mqtt?

Server Win10 and OH 3.2

Having trouble to setup Ikea tradfri GU10 color light with mqtt (Zigbee2MQTT)

I can manage to send and read On/Off to the light, but cant understand how to configure in color.

  • The light and colors works well with the Zigbee2MQTT interface.
  • The light is found inside openhab and works with an On/Off item.

When creating a new channel I select “Color Value (HSB, RGB or CIE xyY)” as the light seem to send XY values.

What values should I set under:
“MQTT State Topic” and “MQTT Command Topic”?
Any advanced settings?

The mqtt content the light sends is:

“brightness”: 254,
“color”: {
“x”: 0.34146341463414637,
“y”: 0.17073170731707318
“color_mode”: “xy”,
“color_temp”: 250,
“color_temp_startup”: 347,
“linkquality”: 95,
“power_on_behavior”: “previous”,
“state”: “ON”,
“update”: {
“state”: “idle”
“update_available”: false

Thanx in advance for any help.

1 Like

Which bulb? Please share the correct page from Zigbee2MQTT

The correct page will also give you information on the correct topics to use.

To be honest I also have troubles reading the color state from a light bulb via z2m and never got it working.

However, as I only control my light via openhab I recognized that there is no need to read the color value, as I only need to write the color value (and OH will always store the correct color state in the item).

Maybe just in case you do not find a solution, that’s an acceptable workaround for you

Ahh I might be able to help here, I think.
This is what I do to get the values from json sent by zigbee devices:

  1. install the json transformation plug-in from the menu “other plug-ins”.
  2. create the channel/configure existing channel
  3. check the “show advanced “ options
  4. scroll allllll the way down and type in “incoming/outgoing value transformation” fields (both of them) the following:

“ jsonpath:$.consumer_connected

Where “consumer_connected” is the value from the json that I wanted to pick up.
So you’ll want to change that for what you want.

For example “color_temp”
So: jsonpath:$.color_temp

Also I checked and confirmed that you should be able to send back rgb values instead:

  • color_xy: To control the XY color (CIE 1931 color space) publish a message to topic zigbee2mqtt/FRIENDLY_NAME/set with payload {"color": {"x": X_VALUE, "y": Y_VALUE}}(e.g. {"color":{"x":0.123,"y":0.123}}). To read the XY color send a message to zigbee2mqtt/FRIENDLY_NAME/get with payload {"color":{"x":"","y":""}}.

Alternatively it is possible to set the XY color via RGB:

  • {"color": {"r": R, "g": G, "b": B}} e.g. {"color":{"r":46,"g":102,"b":150}}
  • {"color": {"rgb": "R,G,B"}} e.g. {"color":{"rgb":"46,102,150"}}
  • {"color": {"hex": HEX}} e.g. {"color":{"hex":"#547CFF"}}

More info here

I’d start by getting an mqtt explorer up and simulating the sending of the packages to the bulb until I got it right, before going to openHAB though.
Those lidl bulbs seem great, and somewhat complex for such tiny and cheap devices.

Edit #462893: I’m not good with the blockquote thinggiemajig….

Thanks @Pedro_Liberal for your detailed response.

From my point of view the issue is not to read the mqtt message. The real issue is, that z2m is only sending x&y values for the color but OH is expecting xyY within the color part of the mqtt message.

Therefore you would always need a rule to calculate the correct xyY (or rgb or hex color code) based of the given mqtt message and send it to the item.

Thanx for response.

Page for the light is this, if I understand correct. (and I notice some more detailed info there)

Im happy with just sending color, reading is secondary.

That is not what states.
It states that the bulb is compatible with rgb values too.
Try sending rgb instead.

Yes, maybe my head was thinking about something different than my fingers where typing :rofl:

SENDING is working fine with RGB
For READING, in the first post the mqtt message is published and if you just provide the color part with x&y attributes to openhab then OH will complain

That’s my color channel configuration:

Color mode: RGB
Command topic: zigbee2mqtt/NameOfYourLight/set
Outgoing value format: {“color”:{“rgb”:“%s,%s,%s”}}

Crap you’re right. Didn’t think about that.

But… I remember seeing in the community another post, using the openHAB zigbee binding (not z2m) and we could pick between XY, hue or auto.
So definitely this is possible to be done…

You can choose between hsb, RGB and CIE xyY (x, y, Brightness)
However the z2m format is not x,y,brightness but brightness, color {x,y}

I seem to miss something, I get Error Invalid message 'null', skipping... in Zigbee2MQTT

Using settings like:

Remove the state topic, because that’s definitely not working with RGB

What’s in the OH log?
Do you have another mqtt client to see the raw mqtt message OH has published?

In MQTT explorer I get this, does that say anything of use?

“brightness”: 242,
“color”: {
“h”: 256,
“hue”: 256,
“s”: 96,
“saturation”: 96,
“x”: 0.24242424242424243,
“y”: 0.10606060606060606
“color_mode”: “xy”,
“color_temp”: 454,
“color_temp_startup”: 454,
“linkquality”: 63,
“power_on_behavior”: “previous”,
“state”: “ON”,
“update”: {
“state”: “idle”
“update_available”: false

Also seem to be sending:
set = {“color”:{“rgb”:“33,189,197”}}

Do I need to use any special Profile like Json or so?

No profile is needed for this.

If the mqtt explorer is not showing the rgb message, than OH is not sending something.

Have you changed the items state e.g. from red to green?

Finally I think I found the problem.

I found:
Be aware that there are different types of quote marks can/will cause problems if copy/pasted: you need "" not “”.

Looked very similar in my case, but correct quote marks solved it for me with the guide from Matze0211. Thank you!

For rules to work, rules sending color update I seem to need “profile:follow” for the channel.

1 Like