From 3cdf7604a05350b7f9d796cb8b227e372e930fdb Mon Sep 17 00:00:00 2001 From: Koen Kanters Date: Wed, 5 Aug 2020 21:50:27 +0200 Subject: [PATCH] Fix no color_temp for group on changing color_xy and vice versa. #4034 --- lib/extension/publish.js | 3 +-- test/publish.test.js | 4 ++-- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/lib/extension/publish.js b/lib/extension/publish.js index 866f611d..efedd278 100644 --- a/lib/extension/publish.js +++ b/lib/extension/publish.js @@ -10,8 +10,7 @@ const topicRegex = new RegExp(`^(.+?)(?:/(${utils.getEndpointNames().join('|')}) const groupConverters = [ zigbeeHerdsmanConverters.toZigbeeConverters.light_onoff_brightness, - zigbeeHerdsmanConverters.toZigbeeConverters.light_colortemp, - zigbeeHerdsmanConverters.toZigbeeConverters.light_color, + zigbeeHerdsmanConverters.toZigbeeConverters.light_color_colortemp, zigbeeHerdsmanConverters.toZigbeeConverters.light_alert, zigbeeHerdsmanConverters.toZigbeeConverters.ignore_transition, zigbeeHerdsmanConverters.toZigbeeConverters.cover_position_tilt, diff --git a/test/publish.test.js b/test/publish.test.js index c192de33..d0e248b2 100644 --- a/test/publish.test.js +++ b/test/publish.test.js @@ -351,7 +351,7 @@ describe('Publish', () => { expect(group.command).toHaveBeenCalledWith("lightingColorCtrl", "moveToColor", {colorx: 24248, colory: 18350, transtime: 0}, {}); expect(MQTT.publish).toHaveBeenCalledTimes(1); expect(MQTT.publish.mock.calls[0][0]).toStrictEqual('zigbee2mqtt/group_1'); - expect(JSON.parse(MQTT.publish.mock.calls[0][1])).toStrictEqual({color: {x: 0.37, y: 0.28}}); + expect(JSON.parse(MQTT.publish.mock.calls[0][1])).toStrictEqual({color: {x: 0.37, y: 0.28}, color_temp: 249}); }); it('Should publish messages to groups color temperature', async () => { @@ -362,7 +362,7 @@ describe('Publish', () => { expect(group.command).toHaveBeenCalledWith("lightingColorCtrl", "moveToColorTemp", {colortemp: 100, transtime: 0}, {}); expect(MQTT.publish).toHaveBeenCalledTimes(1); expect(MQTT.publish.mock.calls[0][0]).toStrictEqual('zigbee2mqtt/group_1'); - expect(JSON.parse(MQTT.publish.mock.calls[0][1])).toStrictEqual({color_temp: 100}); + expect(JSON.parse(MQTT.publish.mock.calls[0][1])).toStrictEqual({color: {x: 0.280632719756407, y: 0.288286029784579}, color_temp: 100}); }); it('Should create and publish to group which is in configuration.yaml but not in zigbee-herdsman', async () => {