Openhab 4.3 zigbee2mqtt color temperature in mired not working

I just read in the release notes of Openhab 4.3 that MQTT HomeAssistant support should be much better now and that we can work directly with the discovered items from zigbee2mqtt instead of manually creating things for this.

I just tested this and the color channel worked perfectly. But I’m having some issues with the color temperature channel.

My lamps all have the color temperature in mired, but for some reason Openhab is always sending the values in kelvin. This is how I configured the item:

Number:Temperature NUM_ZIGBEE_PC_1_Temp "PC Zimmer 1 Temperatur" <temperature> ["ColorTemperature"] {channel="mqtt:homeassistant:4ce1d806:zigbee2mqtt_5F0x0017880100d20f2a:light#color-temp", unit="mired"}

In the sitemap I added the new Colortemperaturepicker like this:

Colortemperaturepicker item=NUM_ZIGBEE_PC_1_Temp label="Temperatur [%s]"

Here is the lamp configuration of the MQTT homeassistant topic:

{"availability":[{"topic":"zigbee2mqtt/bridge/state","value_template":"{{ value_json.state }}"},{"topic":"zigbee2mqtt/pc_1/availability","value_template":"{{ value_json.state }}"}],"availability_mode":"all","brightness":true,"brightness_scale":254,"command_topic":"zigbee2mqtt/pc_1/set","device":{"identifiers":["zigbee2mqtt_0x0017880100d20f2a"],"manufacturer":"Philips","model":"Hue white and color ambiance GU10 (8718696485880)","name":"pc_1","sw_version":"67.108.5","via_device":"zigbee2mqtt_bridge_0x00124b0024c12a85"},"effect":true,"effect_list":["blink","breathe","okay","channel_change","candle","fireplace","colorloop","finish_effect","stop_effect","stop_hue_effect"],"max_mireds":500,"min_mireds":150,"name":null,"object_id":"pc_1","origin":{"name":"Zigbee2MQTT","sw":"1.42.0","url":"https://www.zigbee2mqtt.io"},"schema":"json","state_topic":"zigbee2mqtt/pc_1","supported_color_modes":["xy","color_temp"],"unique_id":"0x0017880100d20f2a_light_zigbee2mqtt"}

And here is how the discoverd Thing looks like in the API Explorer:

{
  "channels": [
    {
      "linkedItems": [],
      "uid": "mqtt:homeassistant:4ce1d806:zigbee2mqtt_5F0x0017880100d20f2a:effect",
      "id": "effect",
      "channelTypeUID": "mqtt:ha-string-advanced",
      "itemType": "String",
      "kind": "STATE",
      "label": "Effect",
      "defaultTags": [],
      "properties": {},
      "configuration": {
        "component": "select",
        "config": [
          "{\"availability\":[{\"topic\":\"zigbee2mqtt/bridge/state\",\"value_template\":\"{{ value_json.state }}\"},{\"topic\":\"zigbee2mqtt/pc_1/availability\",\"value_template\":\"{{ value_json.state }}\"}],\"availability_mode\":\"all\",\"command_topic\":\"zigbee2mqtt/pc_1/set/effect\",\"device\":{\"identifiers\":[\"zigbee2mqtt_0x0017880100d20f2a\"],\"manufacturer\":\"Philips\",\"model\":\"Hue white and color ambiance GU10 (8718696485880)\",\"name\":\"pc_1\",\"sw_version\":\"67.108.5\",\"via_device\":\"zigbee2mqtt_bridge_0x00124b0024c12a85\"},\"enabled_by_default\":false,\"icon\":\"mdi:palette\",\"name\":\"Effect\",\"object_id\":\"pc_1_effect\",\"options\":[\"blink\",\"breathe\",\"okay\",\"channel_change\",\"candle\",\"fireplace\",\"colorloop\",\"finish_effect\",\"stop_effect\",\"stop_hue_effect\"],\"origin\":{\"name\":\"Zigbee2MQTT\",\"sw\":\"1.42.0\",\"url\":\"https://www.zigbee2mqtt.io\"},\"unique_id\":\"0x0017880100d20f2a_effect_zigbee2mqtt\"}"
        ],
        "nodeid": "0x0017880100d20f2a",
        "objectid": [
          "effect"
        ]
      }
    },
    {
      "linkedItems": [],
      "uid": "mqtt:homeassistant:4ce1d806:zigbee2mqtt_5F0x0017880100d20f2a:last_seen",
      "id": "last_seen",
      "channelTypeUID": "mqtt:ha-string-advanced",
      "itemType": "String",
      "kind": "STATE",
      "label": "Last seen",
      "defaultTags": [],
      "properties": {},
      "configuration": {
        "component": "sensor",
        "config": [
          "{\"availability\":[{\"topic\":\"zigbee2mqtt/bridge/state\",\"value_template\":\"{{ value_json.state }}\"},{\"topic\":\"zigbee2mqtt/pc_1/availability\",\"value_template\":\"{{ value_json.state }}\"}],\"availability_mode\":\"all\",\"device\":{\"identifiers\":[\"zigbee2mqtt_0x0017880100d20f2a\"],\"manufacturer\":\"Philips\",\"model\":\"Hue white and color ambiance GU10 (8718696485880)\",\"name\":\"pc_1\",\"sw_version\":\"67.108.5\",\"via_device\":\"zigbee2mqtt_bridge_0x00124b0024c12a85\"},\"device_class\":\"timestamp\",\"enabled_by_default\":false,\"entity_category\":\"diagnostic\",\"icon\":\"mdi:clock\",\"name\":\"Last seen\",\"object_id\":\"pc_1_last_seen\",\"origin\":{\"name\":\"Zigbee2MQTT\",\"sw\":\"1.42.0\",\"url\":\"https://www.zigbee2mqtt.io\"},\"state_topic\":\"zigbee2mqtt/pc_1\",\"unique_id\":\"0x0017880100d20f2a_last_seen_zigbee2mqtt\",\"value_template\":\"{{ value_json.last_seen }}\"}"
        ],
        "nodeid": "0x0017880100d20f2a",
        "objectid": [
          "last_seen"
        ]
      }
    },
    {
      "linkedItems": [],
      "uid": "mqtt:homeassistant:4ce1d806:zigbee2mqtt_5F0x0017880100d20f2a:linkquality",
      "id": "linkquality",
      "channelTypeUID": "mqtt:ha-number-advanced",
      "itemType": "Number",
      "kind": "STATE",
      "label": "Linkquality",
      "defaultTags": [],
      "properties": {},
      "configuration": {
        "component": "sensor",
        "config": [
          "{\"availability\":[{\"topic\":\"zigbee2mqtt/bridge/state\",\"value_template\":\"{{ value_json.state }}\"},{\"topic\":\"zigbee2mqtt/pc_1/availability\",\"value_template\":\"{{ value_json.state }}\"}],\"availability_mode\":\"all\",\"device\":{\"identifiers\":[\"zigbee2mqtt_0x0017880100d20f2a\"],\"manufacturer\":\"Philips\",\"model\":\"Hue white and color ambiance GU10 (8718696485880)\",\"name\":\"pc_1\",\"sw_version\":\"67.108.5\",\"via_device\":\"zigbee2mqtt_bridge_0x00124b0024c12a85\"},\"enabled_by_default\":false,\"entity_category\":\"diagnostic\",\"icon\":\"mdi:signal\",\"name\":\"Linkquality\",\"object_id\":\"pc_1_linkquality\",\"origin\":{\"name\":\"Zigbee2MQTT\",\"sw\":\"1.42.0\",\"url\":\"https://www.zigbee2mqtt.io\"},\"state_class\":\"measurement\",\"state_topic\":\"zigbee2mqtt/pc_1\",\"unique_id\":\"0x0017880100d20f2a_linkquality_zigbee2mqtt\",\"unit_of_measurement\":\"lqi\",\"value_template\":\"{{ value_json.linkquality }}\"}"
        ],
        "nodeid": "0x0017880100d20f2a",
        "objectid": [
          "linkquality"
        ]
      }
    },
    {
      "linkedItems": [],
      "uid": "mqtt:homeassistant:4ce1d806:zigbee2mqtt_5F0x0017880100d20f2a:power_on_behavior_select",
      "id": "power_on_behavior_select",
      "channelTypeUID": "mqtt:ha-string",
      "itemType": "String",
      "kind": "STATE",
      "label": "Power-on behavior",
      "defaultTags": [],
      "properties": {},
      "configuration": {
        "component": "select",
        "config": [
          "{\"availability\":[{\"topic\":\"zigbee2mqtt/bridge/state\",\"value_template\":\"{{ value_json.state }}\"},{\"topic\":\"zigbee2mqtt/pc_1/availability\",\"value_template\":\"{{ value_json.state }}\"}],\"availability_mode\":\"all\",\"command_topic\":\"zigbee2mqtt/pc_1/set/power_on_behavior\",\"device\":{\"identifiers\":[\"zigbee2mqtt_0x0017880100d20f2a\"],\"manufacturer\":\"Philips\",\"model\":\"Hue white and color ambiance GU10 (8718696485880)\",\"name\":\"pc_1\",\"sw_version\":\"67.108.5\",\"via_device\":\"zigbee2mqtt_bridge_0x00124b0024c12a85\"},\"enabled_by_default\":true,\"entity_category\":\"config\",\"icon\":\"mdi:power-settings\",\"name\":\"Power-on behavior\",\"object_id\":\"pc_1_power_on_behavior\",\"options\":[\"off\",\"on\",\"toggle\",\"previous\"],\"origin\":{\"name\":\"Zigbee2MQTT\",\"sw\":\"1.42.0\",\"url\":\"https://www.zigbee2mqtt.io\"},\"state_topic\":\"zigbee2mqtt/pc_1\",\"unique_id\":\"0x0017880100d20f2a_power_on_behavior_zigbee2mqtt\",\"value_template\":\"{{ value_json.power_on_behavior }}\"}"
        ],
        "nodeid": "0x0017880100d20f2a",
        "objectid": [
          "power_on_behavior"
        ]
      }
    },
    {
      "linkedItems": [],
      "uid": "mqtt:homeassistant:4ce1d806:zigbee2mqtt_5F0x0017880100d20f2a:power_on_behavior_sensor",
      "id": "power_on_behavior_sensor",
      "channelTypeUID": "mqtt:ha-string-advanced",
      "itemType": "String",
      "kind": "STATE",
      "label": "Power-on behavior",
      "defaultTags": [],
      "properties": {},
      "configuration": {
        "component": "sensor",
        "config": [
          "{\"availability\":[{\"topic\":\"zigbee2mqtt/bridge/state\",\"value_template\":\"{{ value_json.state }}\"},{\"topic\":\"zigbee2mqtt/pc_1/availability\",\"value_template\":\"{{ value_json.state }}\"}],\"availability_mode\":\"all\",\"device\":{\"identifiers\":[\"zigbee2mqtt_0x0017880100d20f2a\"],\"manufacturer\":\"Philips\",\"model\":\"Hue white and color ambiance GU10 (8718696485880)\",\"name\":\"pc_1\",\"sw_version\":\"67.108.5\",\"via_device\":\"zigbee2mqtt_bridge_0x00124b0024c12a85\"},\"enabled_by_default\":false,\"entity_category\":\"diagnostic\",\"icon\":\"mdi:power-settings\",\"name\":\"Power-on behavior\",\"object_id\":\"pc_1_power_on_behavior\",\"origin\":{\"name\":\"Zigbee2MQTT\",\"sw\":\"1.42.0\",\"url\":\"https://www.zigbee2mqtt.io\"},\"state_topic\":\"zigbee2mqtt/pc_1\",\"unique_id\":\"0x0017880100d20f2a_power_on_behavior_zigbee2mqtt\",\"value_template\":\"{{ value_json.power_on_behavior }}\"}"
        ],
        "nodeid": "0x0017880100d20f2a",
        "objectid": [
          "power_on_behavior"
        ]
      }
    },
    {
      "linkedItems": [],
      "uid": "mqtt:homeassistant:4ce1d806:zigbee2mqtt_5F0x0017880100d20f2a:update_state",
      "id": "update_state",
      "channelTypeUID": "mqtt:ha-string-advanced",
      "itemType": "String",
      "kind": "STATE",
      "label": "Update state",
      "defaultTags": [],
      "properties": {},
      "configuration": {
        "component": "sensor",
        "config": [
          "{\"availability\":[{\"topic\":\"zigbee2mqtt/bridge/state\",\"value_template\":\"{{ value_json.state }}\"},{\"topic\":\"zigbee2mqtt/pc_1/availability\",\"value_template\":\"{{ value_json.state }}\"}],\"availability_mode\":\"all\",\"device\":{\"identifiers\":[\"zigbee2mqtt_0x0017880100d20f2a\"],\"manufacturer\":\"Philips\",\"model\":\"Hue white and color ambiance GU10 (8718696485880)\",\"name\":\"pc_1\",\"sw_version\":\"67.108.5\",\"via_device\":\"zigbee2mqtt_bridge_0x00124b0024c12a85\"},\"enabled_by_default\":false,\"entity_category\":\"diagnostic\",\"icon\":\"mdi:update\",\"name\":\"Update state\",\"object_id\":\"pc_1_update_state\",\"origin\":{\"name\":\"Zigbee2MQTT\",\"sw\":\"1.42.0\",\"url\":\"https://www.zigbee2mqtt.io\"},\"state_topic\":\"zigbee2mqtt/pc_1\",\"unique_id\":\"0x0017880100d20f2a_update_state_zigbee2mqtt\",\"value_template\":\"{{ value_json['update']['state'] }}\"}"
        ],
        "nodeid": "0x0017880100d20f2a",
        "objectid": [
          "update_state"
        ]
      }
    },
    {
      "linkedItems": [],
      "uid": "mqtt:homeassistant:4ce1d806:zigbee2mqtt_5F0x0017880100d20f2a:update_available",
      "id": "update_available",
      "channelTypeUID": "mqtt:ha-switch-advanced",
      "itemType": "Switch",
      "kind": "STATE",
      "label": "pc_1",
      "defaultTags": [],
      "properties": {},
      "configuration": {
        "component": "binary_sensor",
        "config": [
          "{\"availability\":[{\"topic\":\"zigbee2mqtt/bridge/state\",\"value_template\":\"{{ value_json.state }}\"},{\"topic\":\"zigbee2mqtt/pc_1/availability\",\"value_template\":\"{{ value_json.state }}\"}],\"availability_mode\":\"all\",\"device\":{\"identifiers\":[\"zigbee2mqtt_0x0017880100d20f2a\"],\"manufacturer\":\"Philips\",\"model\":\"Hue white and color ambiance GU10 (8718696485880)\",\"name\":\"pc_1\",\"sw_version\":\"67.108.5\",\"via_device\":\"zigbee2mqtt_bridge_0x00124b0024c12a85\"},\"device_class\":\"update\",\"enabled_by_default\":false,\"entity_category\":\"diagnostic\",\"name\":null,\"object_id\":\"pc_1_update_available\",\"origin\":{\"name\":\"Zigbee2MQTT\",\"sw\":\"1.42.0\",\"url\":\"https://www.zigbee2mqtt.io\"},\"payload_off\":false,\"payload_on\":true,\"state_topic\":\"zigbee2mqtt/pc_1\",\"unique_id\":\"0x0017880100d20f2a_update_available_zigbee2mqtt\",\"value_template\":\"{{ value_json['update']['state'] == \\\"available\\\" }}\"}"
        ],
        "nodeid": "0x0017880100d20f2a",
        "objectid": [
          "update_available"
        ]
      }
    },
    {
      "linkedItems": [
        "COLOR_ZIGBEE_PC_1"
      ],
      "uid": "mqtt:homeassistant:4ce1d806:zigbee2mqtt_5F0x0017880100d20f2a:light#color",
      "id": "light#color",
      "channelTypeUID": "mqtt:ha-color",
      "itemType": "Color",
      "kind": "STATE",
      "label": "Color",
      "defaultTags": [],
      "properties": {},
      "configuration": {
        "component": "light",
        "config": [
          "{\"availability\":[{\"topic\":\"zigbee2mqtt/bridge/state\",\"value_template\":\"{{ value_json.state }}\"},{\"topic\":\"zigbee2mqtt/pc_1/availability\",\"value_template\":\"{{ value_json.state }}\"}],\"availability_mode\":\"all\",\"brightness\":true,\"brightness_scale\":254,\"command_topic\":\"zigbee2mqtt/pc_1/set\",\"device\":{\"identifiers\":[\"zigbee2mqtt_0x0017880100d20f2a\"],\"manufacturer\":\"Philips\",\"model\":\"Hue white and color ambiance GU10 (8718696485880)\",\"name\":\"pc_1\",\"sw_version\":\"67.108.5\",\"via_device\":\"zigbee2mqtt_bridge_0x00124b0024c12a85\"},\"effect\":true,\"effect_list\":[\"blink\",\"breathe\",\"okay\",\"channel_change\",\"candle\",\"fireplace\",\"colorloop\",\"finish_effect\",\"stop_effect\",\"stop_hue_effect\"],\"max_mireds\":500,\"min_mireds\":150,\"name\":null,\"object_id\":\"pc_1\",\"origin\":{\"name\":\"Zigbee2MQTT\",\"sw\":\"1.42.0\",\"url\":\"https://www.zigbee2mqtt.io\"},\"schema\":\"json\",\"state_topic\":\"zigbee2mqtt/pc_1\",\"supported_color_modes\":[\"xy\",\"color_temp\"],\"unique_id\":\"0x0017880100d20f2a_light_zigbee2mqtt\"}"
        ],
        "nodeid": "0x0017880100d20f2a",
        "objectid": [
          "light"
        ]
      }
    },
    {
      "linkedItems": [],
      "uid": "mqtt:homeassistant:4ce1d806:zigbee2mqtt_5F0x0017880100d20f2a:light#color-mode",
      "id": "light#color-mode",
      "channelTypeUID": "mqtt:ha-string-advanced",
      "itemType": "String",
      "kind": "STATE",
      "label": "Color Mode",
      "defaultTags": [],
      "properties": {},
      "configuration": {}
    },
    {
      "linkedItems": [
        "DIMM_ZIGBEE_PC_1_Temp"
      ],
      "uid": "mqtt:homeassistant:4ce1d806:zigbee2mqtt_5F0x0017880100d20f2a:light#color-temp",
      "id": "light#color-temp",
      "channelTypeUID": "mqtt:ha-number",
      "itemType": "Number",
      "kind": "STATE",
      "label": "Color Temperature",
      "defaultTags": [],
      "properties": {},
      "configuration": {}
    },
    {
      "linkedItems": [],
      "uid": "mqtt:homeassistant:4ce1d806:zigbee2mqtt_5F0x0017880100d20f2a:light#effect",
      "id": "light#effect",
      "channelTypeUID": "mqtt:ha-string",
      "itemType": "String",
      "kind": "STATE",
      "label": "Lighting Effect",
      "defaultTags": [],
      "properties": {},
      "configuration": {}
    },
    {
      "linkedItems": [],
      "uid": "mqtt:homeassistant:4ce1d806:zigbee2mqtt_5F0x0017880100d20f2a:update#json-attributes",
      "id": "update#json-attributes",
      "channelTypeUID": "mqtt:ha-string-advanced",
      "itemType": "String",
      "kind": "STATE",
      "label": "JSON Attributes",
      "defaultTags": [],
      "properties": {},
      "configuration": {
        "component": "update",
        "config": [
          "{\"availability\":[{\"topic\":\"zigbee2mqtt/bridge/state\",\"value_template\":\"{{ value_json.state }}\"},{\"topic\":\"zigbee2mqtt/pc_1/availability\",\"value_template\":\"{{ value_json.state }}\"}],\"availability_mode\":\"all\",\"command_topic\":\"zigbee2mqtt/bridge/request/device/ota_update/update\",\"device\":{\"identifiers\":[\"zigbee2mqtt_0x0017880100d20f2a\"],\"manufacturer\":\"Philips\",\"model\":\"Hue white and color ambiance GU10 (8718696485880)\",\"name\":\"pc_1\",\"sw_version\":\"67.108.5\",\"via_device\":\"zigbee2mqtt_bridge_0x00124b0024c12a85\"},\"device_class\":\"firmware\",\"entity_category\":\"config\",\"entity_picture\":\"https://github.com/Koenkk/zigbee2mqtt/raw/master/images/logo.png\",\"json_attributes_template\":\"{\\\"in_progress\\\": {{ iif(value_json['update']['state'] == 'updating', 'true', 'false') }} }\",\"json_attributes_topic\":\"zigbee2mqtt/pc_1\",\"latest_version_template\":\"{{ value_json['update']['latest_version'] }}\",\"latest_version_topic\":\"zigbee2mqtt/pc_1\",\"name\":null,\"object_id\":\"pc_1\",\"origin\":{\"name\":\"Zigbee2MQTT\",\"sw\":\"1.42.0\",\"url\":\"https://www.zigbee2mqtt.io\"},\"payload_install\":\"{\\\"id\\\": \\\"0x0017880100d20f2a\\\"}\",\"state_topic\":\"zigbee2mqtt/pc_1\",\"unique_id\":\"0x0017880100d20f2a_update_zigbee2mqtt\",\"value_template\":\"{{ value_json['update']['installed_version'] }}\"}"
        ],
        "nodeid": "0x0017880100d20f2a",
        "objectid": [
          "update"
        ]
      }
    }
  ],
  "statusInfo": {
    "status": "ONLINE",
    "statusDetail": "NONE"
  },
  "editable": true,
  "label": "zigbee2mqtt PC Zimmer 1",
  "bridgeUID": "mqtt:broker:4ce1d806",
  "configuration": {
    "topics": [
      "binary_sensor/0x0017880100d20f2a/update_available",
      "light/0x0017880100d20f2a/light",
      "select/0x0017880100d20f2a/effect",
      "select/0x0017880100d20f2a/power_on_behavior",
      "sensor/0x0017880100d20f2a/last_seen",
      "sensor/0x0017880100d20f2a/linkquality",
      "sensor/0x0017880100d20f2a/power_on_behavior",
      "sensor/0x0017880100d20f2a/update_state",
      "update/0x0017880100d20f2a/update"
    ],
    "doUpdate": false,
    "basetopic": "homeassistant"
  },
  "properties": {
    "latestFirmwareVersion": "1124101125",
    "modelId": "Hue white and color ambiance GU10 (8718696485880)",
    "firmwareVersion": "1124101125",
    "vendor": "Philips",
    "newStyleChannels": "true",
    "deviceId": "zigbee2mqtt_5F0x0017880100d20f2a"
  },
  "UID": "mqtt:homeassistant:4ce1d806:zigbee2mqtt_5F0x0017880100d20f2a",
  "thingTypeUID": "mqtt:homeassistant_zigbee2mqtt_5F0x0017880100d20f2a",
  "location": "PC Zimmer"
}

When I’m trying to set the color temperature in the UI I get the following error in the log:

2024-12-16 18:34:19.936 [WARN ] [ab.core.internal.events.EventHandler] - Dispatching/filtering event for subscriber 'org.openhab.core.events.EventSubscriber' failed: °C is non-linear, cannot convert
java.lang.UnsupportedOperationException: °C is non-linear, cannot convert
	at tech.units.indriya.unit.ProductUnit.getSystemConverter(ProductUnit.java:321) ~[?:?]
	at tech.units.indriya.AbstractUnit.getConverterToAny(AbstractUnit.java:327) ~[?:?]
	at org.openhab.core.library.types.QuantityType.toUnit(QuantityType.java:290) ~[?:?]
	at org.openhab.core.library.types.QuantityType.toInvertibleUnit(QuantityType.java:325) ~[?:?]
	at org.openhab.core.library.items.NumberItem.getInternalState(NumberItem.java:149) ~[?:?]
	at org.openhab.core.library.items.NumberItem.setState(NumberItem.java:173) ~[?:?]
	at org.openhab.core.internal.items.ItemUpdater.receiveUpdate(ItemUpdater.java:79) ~[?:?]
	at org.openhab.core.items.events.AbstractItemEventSubscriber.receive(AbstractItemEventSubscriber.java:45) ~[?:?]
	at org.openhab.core.internal.events.EventHandler.lambda$2(EventHandler.java:169) ~[?:?]
	at java.util.concurrent.CompletableFuture$AsyncRun.run(CompletableFuture.java:1804) [?:?]
	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:539) [?:?]
	at java.util.concurrent.FutureTask.run(FutureTask.java:264) [?:?]
	at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:304) [?:?]
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136) [?:?]
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635) [?:?]
	at java.lang.Thread.run(Thread.java:840) [?:?]

Am I doing something wrong or did Openhab discover the wrong unit type for the color temperature channel?

The unit MK⁻¹ (with its resp. aliases mired, mirek) and K(elvin) are inter-convertable; the one is a milli- reciprocal of the other (and vice versa).

So if you want to force the MK⁻¹ unit in UI you should probably add a state formatting pattern with the explicit unit {e.g. MK⁻¹ / mired / mirek} to the label in your item definition.

Number:Temperature NUM_ZIGBEE_PC_1_Temp "PC Zimmer 1 Temperatur  [%.0f MK⁻¹]" <temperature> ["ColorTemperature"] {channel="mqtt:homeassistant:4ce1d806:zigbee2mqtt_5F0x0017880100d20f2a:light#color-temp", unit="mired"}

I tested this some more an I think I see the problem now.

The new Colortemperaturepicker requires the item to be of type Number:Temperature with unit set to kelvin or mired.

The problem is that the channels the mqtt binding creates are always just of type Number. This creates the “°C is non-linear, cannot convert” error when values from the channel are set to the item.

I also tested the generic mqtt binding, but there are also only channels of type Number as you can see here: openhab-addons/bundles/org.openhab.binding.mqtt.generic/src/main/resources/OH-INF/thing/channels.xml at main · openhab/openhab-addons · GitHub

I guess the problem would be solved if there was a generic mqtt channel for Number:Temperature or for the home assistant mqtt binding if the channels where detected as Number:Temperature channels.

If I have the time I will test this in a local development environment. Or do you have another idea how this problem could be solved?

Yes, it is the issue mentioned below. We were “too fast” in introducing new functionality. Sorry for that.

Pinging @Lolodomo for info…

There is a fix in the pipeline…

Thanks for the hint. I guess I have to wait for a new bugfix release with those changes then. I guess the Android app update with Colortemperaturepicker support is also still pending, so I would have to wait either way.

I also noticed that the Visual Studio Code extension for OpenHab was not updated in over a year, so all new sitemap features are not highlighted correctly. Do you know if there will be an update of the vscode extension too?

I believe it is not updated regularly and now outdated (partially). I have not the knowledge to update it. If I had, this would have been updated.
A volunteer with proper skills is welcome.

I wonder if you can help me, as I am not a great expert in MQTT. I know you have been experimenting (without success) with setting a Unit on your Items … however from the MQTT ReadMe (see below) it seems that it should be possible to set a Unit on the Channels. But the doc does not really explain how you would do that.

I can see from the code that if there is such a unit on the Channel then the QuantityType that the OH Colortemperaturepicker delivers should be converted to a number based on the respective channel unit. (Which in your case should I think be mired / mirek / MK⁻¹ )

Hmm. Your log seems to indicate that the problem lies between the OH UI and OH Core and NOT between OH Core and the Binding. The log also mentions °C is non-linear, cannot convert. Now it seems to me that the Colortemperaturepicker should be producing a value either in Kelvin or Mirek (and NOT in Celsius) so I am wondering what is going wrong here. Let me bring @Lolodomo into this discussion: I think that maybe this issue is something in OH UI or in OH Core => WDYT? (From looking at the binding code it seems to me that the Binding code is actually Ok…)

@ccutrer I wonder if this problem is related to your issue 17651??

Basic UI definitively sends a command in Kelvin:

https://github.com/openhab/openhab-webui/blob/main/bundles/org.openhab.ui.basic/web-src/smarthome.js#L2497

@Lolodomo thanks for the feedback. So OH UI is sending Kelvin to OH Core and then OH Core EventHandler / EventSubscriber is throwing a UoM conversion error (see below). AFAICT the exception gets thrown before the new value is passed to the binding’s handleCommand() method. Or ??

2024-12-16 18:34:19.936 [WARN ] [ab.core.internal.events.EventHandler] - Dispatching/filtering event for subscriber 'org.openhab.core.events.EventSubscriber' failed: °C is non-linear, cannot convert
java.lang.UnsupportedOperationException: °C is non-linear, cannot convert
	at tech.units.indriya.unit.ProductUnit.getSystemConverter(ProductUnit.java:321) ~[?:?]

How have I not noticed this before?! I guess all my rules just deal in mireks. Yes, if I try to send a command in Kelvin to my Hue lights (through zigbee2mqtt - i.e. Home Assistant discovery), the K gets stripped and the device interprets the number as mired. It’s getting stripped in CommunicationManager, because yes, the Home Assistant binding is creating the channel as a plain Number. It’s working properly for a Milight bulb that uses XML channels, and thus is a Number:Temperature. I don’t think I need to fix #17651 completely, but I’ll get going on a fix ASAP.

In theory special case UnitUtils.getDimensionName for mirek by ccutrer · Pull Request #4507 · openhab/openhab-core · GitHub + [mqtt.generic] create the proper item type for channels with units by ccutrer · Pull Request #17929 · openhab/openhab-addons · GitHub will fix it, but I’m unable to test because my openHAB is busted. I’m having troubles compiling on the 4.3.x branch, and I can compile for 5.0 but my openHAB will no longer finish booting after I attempted to update to 5.0.0-SNAPSHOT. :scream:

EDIT: Confirmed, those two changes in combination fix Kelvin commands for zigbee2mqtt (and probably for Homie as well, if anyone has such a device).

Regarding the vscode syntax highlighting: I have no experience developing vscode extensions, but I did just take a look at the vscode extension and adding the new sitemap types seemms pretty simple.

I just uploaded a pull request to add the new sitemap types and also the Number:Dimension syntax highlighting:

I hope someone can verify this. But I have no idea how an update for this extension is published to the vscode marketplace.

1 Like

@Lolodomo I just tested the latest code (Including this fix) in a local development environment.

Now I was able to set the item for the color temperature as Item:Temperature with unit “mired”. But the Colortemperaturepicker still has some problems.

When turning the lamp on the temperature is correctly displayed as mired in the UI. Changing the value also reflects the temperature on the lamps. But after changing the temperature with the Colortemperaturepicker the value in the UI stays the same.

This is what I found in the log:

12:30:27.616 [DEBUG] [ernal.render.ColortemppickerRenderer] - ColortemppickerRenderer current=null unit=MK⁻¹ min=2000 max=6535.947712418300653594771241830065
12:30:27.616 [DEBUG] [ernal.render.ColortemppickerRenderer] - Gradient 0.0%: 2000.0 K => RGB 255 177 65
12:30:27.617 [DEBUG] [ernal.render.ColortemppickerRenderer] - Gradient 2.5%: 2113.3986928104573 K => RGB 255 183 74
12:30:27.617 [DEBUG] [ernal.render.ColortemppickerRenderer] - Gradient 5.0%: 2226.797385620915 K => RGB 255 188 84
12:30:27.617 [DEBUG] [ernal.render.ColortemppickerRenderer] - Gradient 7.5%: 2340.1960784313724 K => RGB 255 193 93
12:30:27.617 [DEBUG] [ernal.render.ColortemppickerRenderer] - Gradient 10.0%: 2453.59477124183 K => RGB 255 197 101
12:30:27.617 [DEBUG] [ernal.render.ColortemppickerRenderer] - Gradient 12.5%: 2566.9934640522874 K => RGB 255 201 108
12:30:27.617 [DEBUG] [ernal.render.ColortemppickerRenderer] - Gradient 15.0%: 2680.392156862745 K => RGB 255 205 116
12:30:27.617 [DEBUG] [ernal.render.ColortemppickerRenderer] - Gradient 17.5%: 2793.7908496732025 K => RGB 255 209 124
12:30:27.617 [DEBUG] [ernal.render.ColortemppickerRenderer] - Gradient 20.0%: 2907.1895424836603 K => RGB 255 212 131
12:30:27.617 [DEBUG] [ernal.render.ColortemppickerRenderer] - Gradient 22.5%: 3020.5882352941176 K => RGB 255 215 138
12:30:27.617 [DEBUG] [ernal.render.ColortemppickerRenderer] - Gradient 25.0%: 3133.986928104575 K => RGB 255 218 145
12:30:27.617 [DEBUG] [ernal.render.ColortemppickerRenderer] - Gradient 27.5%: 3247.3856209150326 K => RGB 255 221 151
12:30:27.617 [DEBUG] [ernal.render.ColortemppickerRenderer] - Gradient 30.0%: 3360.7843137254904 K => RGB 255 224 157
12:30:27.618 [DEBUG] [ernal.render.ColortemppickerRenderer] - Gradient 32.5%: 3474.1830065359472 K => RGB 255 226 164
12:30:27.618 [DEBUG] [ernal.render.ColortemppickerRenderer] - Gradient 35.0%: 3587.581699346405 K => RGB 255 228 169
12:30:27.618 [DEBUG] [ernal.render.ColortemppickerRenderer] - Gradient 37.5%: 3700.9803921568628 K => RGB 255 231 175
12:30:27.618 [DEBUG] [ernal.render.ColortemppickerRenderer] - Gradient 40.0%: 3814.37908496732 K => RGB 255 232 180
12:30:27.618 [DEBUG] [ernal.render.ColortemppickerRenderer] - Gradient 42.5%: 3927.777777777778 K => RGB 255 234 185
12:30:27.618 [DEBUG] [ernal.render.ColortemppickerRenderer] - Gradient 45.0%: 4041.176470588235 K => RGB 255 236 190
12:30:27.618 [DEBUG] [ernal.render.ColortemppickerRenderer] - Gradient 47.5%: 4154.575163398693 K => RGB 255 238 195
12:30:27.618 [DEBUG] [ernal.render.ColortemppickerRenderer] - Gradient 50.0%: 4267.97385620915 K => RGB 255 240 200
12:30:27.618 [DEBUG] [ernal.render.ColortemppickerRenderer] - Gradient 52.5%: 4381.372549019608 K => RGB 255 241 204
12:30:27.618 [DEBUG] [ernal.render.ColortemppickerRenderer] - Gradient 55.0%: 4494.771241830065 K => RGB 255 243 208
12:30:27.618 [DEBUG] [ernal.render.ColortemppickerRenderer] - Gradient 57.5%: 4608.169934640522 K => RGB 255 244 213
12:30:27.619 [DEBUG] [ernal.render.ColortemppickerRenderer] - Gradient 60.0%: 4721.568627450981 K => RGB 255 246 217
12:30:27.619 [DEBUG] [ernal.render.ColortemppickerRenderer] - Gradient 62.5%: 4834.967320261438 K => RGB 255 247 221
12:30:27.619 [DEBUG] [ernal.render.ColortemppickerRenderer] - Gradient 65.0%: 4948.3660130718945 K => RGB 255 248 224
12:30:27.619 [DEBUG] [ernal.render.ColortemppickerRenderer] - Gradient 67.5%: 5061.764705882353 K => RGB 255 249 229
12:30:27.619 [DEBUG] [ernal.render.ColortemppickerRenderer] - Gradient 70.0%: 5175.16339869281 K => RGB 255 250 232
12:30:27.619 [DEBUG] [ernal.render.ColortemppickerRenderer] - Gradient 72.5%: 5288.562091503268 K => RGB 255 251 235
12:30:27.619 [DEBUG] [ernal.render.ColortemppickerRenderer] - Gradient 75.0%: 5401.9607843137255 K => RGB 255 252 239
12:30:27.619 [DEBUG] [ernal.render.ColortemppickerRenderer] - Gradient 77.5%: 5515.359477124182 K => RGB 255 253 242
12:30:27.619 [DEBUG] [ernal.render.ColortemppickerRenderer] - Gradient 80.0%: 5628.75816993464 K => RGB 255 254 245
12:30:27.619 [DEBUG] [ernal.render.ColortemppickerRenderer] - Gradient 82.5%: 5742.156862745098 K => RGB 255 255 248
12:30:27.620 [DEBUG] [ernal.render.ColortemppickerRenderer] - Gradient 85.0%: 5855.555555555556 K => RGB 254 255 250
12:30:27.620 [DEBUG] [ernal.render.ColortemppickerRenderer] - Gradient 87.5%: 5968.954248366013 K => RGB 253 255 252
12:30:27.620 [DEBUG] [ernal.render.ColortemppickerRenderer] - Gradient 90.0%: 6082.35294117647 K => RGB 252 255 254
12:30:27.620 [DEBUG] [ernal.render.ColortemppickerRenderer] - Gradient 92.5%: 6195.751633986929 K => RGB 251 254 255
12:30:27.620 [DEBUG] [ernal.render.ColortemppickerRenderer] - Gradient 95.0%: 6309.150326797385 K => RGB 248 252 255
12:30:27.620 [DEBUG] [ernal.render.ColortemppickerRenderer] - Gradient 97.5%: 6422.549019607843 K => RGB 246 251 255
12:30:27.620 [DEBUG] [ernal.render.ColortemppickerRenderer] - Gradient 100.0%: 6535.9477124183 K => RGB 244 249 255
12:30:38.874 [INFO ] [openhab.event.ItemCommandEvent ] - Item 'PC_Zimmergroup_pc_Color_Temperature' received command 5413 K
12:30:38.875 [INFO ] [penhab.event.ItemStatePredictedEvent] - Item 'PC_Zimmergroup_pc_Color_Temperature' predicted to become 5413 K
12:30:39.121 [WARN ] [ab.core.internal.events.EventHandler] - Dispatching/filtering event for subscriber 'org.openhab.core.events.EventSubscriber' failed: °C is non-linear, cannot convert
java.lang.UnsupportedOperationException: °C is non-linear, cannot convert
at tech.units.indriya.unit.ProductUnit.getSystemConverter(ProductUnit.java:321) ~[?:?]
at tech.units.indriya.AbstractUnit.getConverterToAny(AbstractUnit.java:327) ~[?:?]
at org.openhab.core.library.types.QuantityType.toUnit(QuantityType.java:290) ~[?:?]
at org.openhab.core.library.types.QuantityType.toInvertibleUnit(QuantityType.java:325) ~[?:?]
at org.openhab.core.library.items.NumberItem.getInternalState(NumberItem.java:149) ~[?:?]
at org.openhab.core.library.items.NumberItem.setState(NumberItem.java:173) ~[?:?]
at org.openhab.core.internal.items.ItemUpdater.receiveUpdate(ItemUpdater.java:79) ~[?:?]
at org.openhab.core.items.events.AbstractItemEventSubscriber.receive(AbstractItemEventSubscriber.java:45) ~[?:?]
at org.openhab.core.internal.events.EventHandler.lambda$2(EventHandler.java:169) ~[?:?]
at java.util.concurrent.CompletableFuture$AsyncRun.run(CompletableFuture.java:1804) ~[?:?]
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:572) ~[?:?]
at java.util.concurrent.FutureTask.run(FutureTask.java:317) ~[?:?]
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:304) ~[?:?]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1144) ~[?:?]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:642) ~[?:?]
at java.lang.Thread.run(Thread.java:1583) [?:?]

The unit of the Colortemperaturepicker is set to mired, but the value range is still in kelvin.

Am I doing something wrong here or is this another bug?