diff --git a/lib/extension/homeassistant.js b/lib/extension/homeassistant.js index b9b42862..20bcf838 100644 --- a/lib/extension/homeassistant.js +++ b/lib/extension/homeassistant.js @@ -83,12 +83,13 @@ class HomeAssistant extends Extension { if (expose.type === 'light') { const supportsXY = !!expose.features.find((e) => e.name === 'color_xy'); const supportsHS = !!expose.features.find((e) => e.name === 'color_hs'); + const colorTemp = expose.features.find((e) => e.name === 'color_temp'); discoveryEntry = { type: 'light', object_id: expose.endpoint ? `light_${expose.endpoint}` : 'light', discovery_payload: { brightness: !!expose.features.find((e) => e.name === 'brightness'), - color_temp: !!expose.features.find((e) => e.name === 'color_temp'), + color_temp: !!colorTemp, xy: supportsXY, hs: !supportsXY && supportsHS, schema: 'json', @@ -99,6 +100,11 @@ class HomeAssistant extends Extension { }, }; + if (colorTemp) { + discoveryEntry.discovery_payload.max_mireds = colorTemp.value_max; + discoveryEntry.discovery_payload.min_mireds = colorTemp.value_min; + } + const effect = def.exposes.find((e) => e.type === 'enum' && e.name === 'effect'); if (effect) { discoveryEntry.discovery_payload.effect = true; diff --git a/test/homeassistant.test.js b/test/homeassistant.test.js index 89824503..f521444e 100644 --- a/test/homeassistant.test.js +++ b/test/homeassistant.test.js @@ -249,6 +249,8 @@ describe('HomeAssistant extension', () => { "brightness":true, "brightness_scale":254, "color_temp":true, + "min_mireds": 250, + "max_mireds": 454, "command_topic":"zigbee2mqtt/bulb/set", "device":{ "identifiers":[