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?