Color Mode on Ledvance Light

Hi

I am trying to figure out how to define a Zigbee2MQTT Ledvance item in OpenHab 4. I have several Hue Color lights working in OpenHAB via Zigbee2MQTT, but I cannot figure out how to control the color of the Zigbee2MQTT light below. The Hue devices I have working are using the color_mode=xy, but Ledvance seems to be using the type “color_temp”. Anyone got this working?

Can anyone give me a hint on how to get this working?

Any help appreciated.

{
“brightness”: 254,
“color”: {
“x”: 0.4599,
“y”: 0.4106
},
“color_mode”: “color_temp”,
“color_temp”: 370,
“linkquality”: 91,
“state”: “OFF”,
“update”: {
“installed_version”: 34825552,
“latest_version”: 34891088,
“state”: “available”
}
}

The color temp is for white color (cold, warm)
I use it with a string channel and send coolest, cool, neutral, warm, warmest for white light.

Thing code:

  - id: Whitetemp
    channelTypeUID: mqtt:string
    label: White temp
    description: null
    configuration:
      commandTopic: zigbee2mqtt/LedvanceStrip1/set/
      postCommand: true
      retained: false
      formatBeforePublish: '{"color_temp":"%s"}'
      stateTopic: zigbee2mqtt/LedvanceStrip1/get/color_temp

I use a hsb type item with rgb color channel…
thing code:

  - id: color_rgb
    channelTypeUID: mqtt:color
    label: FarbeRGB
    description: null
    configuration:
      postCommand: false
      retained: false
      formatBeforePublish: '{"color":{"r":%1$d,"g":%2$d,"b":%3$d}}'
      commandTopic: zigbee2mqtt/LedvanceStrip1/set
      colorMode: RGB
      stateTopic: zigbee2mqtt/LedvanceStrip1/get
      off: "0"
      on: "1"

If I link a color item I can send a hsb color and it works fine
Greets

The code below works perfect. Thanks a lot. :slight_smile:

Is the on/off code required?

  - id: color_rgb
    channelTypeUID: mqtt:color
    label: ColorRGB
    description: null
    configuration:
      postCommand: false
      retained: false
      formatBeforePublish: '{"color":{"r":%1$d,"g":%2$d,"b":%3$d}}'
      commandTopic: zigbee2mqtt/vilde/lights/color/set
      colorMode: RGB
      stateTopic: zigbee2mqtt/vilde/lights/color/get
      off: "0"
      on: "1"

Also, may I kindly ask for a config snippet from your brightness/dimmer configuration. I am starting to believe that my item configuration for zigbee2mqtt lights are configured far from ideal, though dimming seems to work for me. :wink:

The config below works, but I suspect that the topics are quite from ideal?

  - id: brightness
    channelTypeUID: mqtt:dimmer
    label: Brightness
    description: null
    configuration:
      commandTopic: zigbee2mqtt/vilde/lights/color/set/brightness
      min: 0
      stateTopic: zigbee2mqtt/vilde/lights/color/brightness
      max: 254
      off: OFF
      on: ON

Should I have used “FormatBeforePublish” in this config as well?

Now I have rewritten the config as follows. I am not sure if the “get” part is correct? I can adjust brightness from OpenHAB, but direct changes via the dashboard in Zigbee2MQTT is not reflected in OpenHAB. Is that by design, or is my config still not ideal?

  - id: brightness
    channelTypeUID: mqtt:dimmer
    label: Brightness
    description: null
    configuration:
      min: 0
      formatBeforePublish: '{"brightness": %s}'
      max: 254
      commandTopic: zigbee2mqtt/vilde/lights/color/set
      stateTopic: zigbee2mqtt/vilde/lights/color/get
      transformationPattern: '{"brightness": %s}'
      off: OFF
      on: ON

I think the on off setting is for the possibility to sending ‘OFF’ to switch off the light.
Try yourself :wink:
I don’t know :smile:

My brightness channel is reflected if I change from zigbee2mqtt…

  - id: brightness
    channelTypeUID: mqtt:dimmer
    label: Helligkeit
    description: null
    configuration:
      postCommand: false
      retained: false
      min: 0
      formatBeforePublish: "%s"
      max: 254
      commandTopic: zigbee2mqtt/LedvanceStrip1/set/brightness
      step: 1
      stateTopic: zigbee2mqtt/LedvanceStrip1/brightness
      off: "0"
      on: "1"

Also here, try the on off parameters. It is working for me…
Greets

Everything seems to be working for me now. The only thing I am not 100 percent sure about is if my OpenHAB should be able to pick up changes made directly via the Zigbee2MQTT GUI? If I change a value directly in the Z2MQTT, the value in OpenHAB isn’t adjusted accordingly. Is that a configuration problem, or is it by design?

Thanks for your help.

I think it’s a configuration problem. But it doesn’t bother me cause I only use openhab, not z2m.

Greets

Yes, I think you are right. I must be a configuration issue. I am able to receive data from the PIR sensors in Z2M so it should be possible to get info from the light back to OpenHAB via Z2M. I don’t need to be able to control the light directly via Z2M, so I think I will manage just fine. Thanks for your help.

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