TRADFRI LED bulb white spectrum not working in homekit

Hello,

I’m using the following setup:
-Raspberry Pi b+ V1.2
-CC2531
-Zigbee2MQTT
-OpenHab 3.0.1

I connected 4 Ikea Treadfri bulbs to the system over MQTT (mosquito).
1x IKEA LED1733G7
3x IKEA LED1739R5 (Grouped to one element in the mqtt config)

They are configured with 3 channels and Homekit meta data.
Power (switch)

  • lighting.onstate
    Brightness (dimmer)
  • lighting.brightness
    ColorTemperature (dimmer)
  • lighting.colortemperature

If i set every bulb up like this i will get the right controle in Homekit. On/off and brightness is working perfectly. I get the colored dots to change the color temperature but they are not working.

After a quick view into frontail i noticed the following warning:
2021-02-10 21:40:59.887 [WARN ] [ssories.HomekitCharacteristicFactory] - Item type Dimmer is not supported for LampeWZD_Color. Only NumberItem is supported.

So i setup a new channel for the color using a Number instead of a dimmer item.
It always shows a value between 250 and 454 that is representing the color.
After setting it up with the lighting.colortemperature metadata for homekit and rebooting the system all Devices in homekit are marked as not responding.

The homekit documentation shows:
-ColorTemperature
-Number
-Color temperature which is represented in reciprocal megaKelvin, values - 50 to 400. should not be used in combination with hue, saturation and brightness

result for:
openhab:homekit show LampeBett
729270148 LampeBett
Services:
Service Type: 00000043-0000-1000-8000-0026BB765291
Characteristics:
: class io.github.hapjava.characteristics.impl.common.OnCharacteristic
: class io.github.hapjava.characteristics.impl.lightbulb.BrightnessCharacteristic
: class io.github.hapjava.characteristics.impl.lightbulb.ColorTemperatureCharacteristic

Do i have to transform the Kelvin Value from homekit to match the number range from 250 to 454 or why is this change crashing the complete homekit connection?

This worked for me

zigbe2mqtt channel like this

  - id: temperaturemired
    channelTypeUID: mqtt:number
    label: temperature mired
    description: null
    configuration:
      postCommand: true
      retained: true
      formatBeforePublish: "%.0f"
      qos: 1
      transformationPatternOut: JS:toNumber.js
      commandTopic: zigbee2mqtt/yourid/set/color_temp
      stateTopic: zigbee2mqtt/yourid/color_temp

then i just have JS:toNumber.js


(function (i) {

  var logger = Java.type('org.slf4j.LoggerFactory').getLogger('org.openhab.transform.toNumber');

 

  var parsed = parseFloat(i);

  logger.info("toNumber: " + parsed);

  return parsed;

})(input)

add homekit metadata on the item linked to the channel. That worked for me at least