From 60627ab6e3c9d282c8e70e890e98deec7b64d53c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jaron=20Vi=C3=ABtor?= Date: Wed, 4 Dec 2019 21:23:46 +0100 Subject: [PATCH] Added support for accepting hex color on deviceName/set/color MQTT topic (#2441) * Added support for accepting hex color on deviceName/set/color MQTT topic * Update entityPublish.js --- test/entityPublish.test.js | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/test/entityPublish.test.js b/test/entityPublish.test.js index 8cb98d5a8..82c92d8e3 100644 --- a/test/entityPublish.test.js +++ b/test/entityPublish.test.js @@ -471,6 +471,18 @@ describe('Entity publish', () => { expect(endpoint.command).toHaveBeenCalledWith("genOnOff", "on", {}, {}); }); + it('Should parse set with color attribute topic', async () => { + const device = zigbeeHerdsman.devices.bulb_color; + const endpoint = device.getEndpoint(1); + await MQTT.events.message('zigbee2mqtt/bulb_color/set/color', '#64C80A'); + await flushPromises(); + expect(endpoint.command).toHaveBeenCalledTimes(1); + expect(endpoint.command).toHaveBeenCalledWith("lightingColorCtrl", "moveToColor", {colorx: 17806, colory: 43155, transtime: 0}, {}); + expect(MQTT.publish).toHaveBeenCalledTimes(1); + expect(MQTT.publish.mock.calls[0][0]).toStrictEqual('zigbee2mqtt/bulb_color'); + expect(JSON.parse(MQTT.publish.mock.calls[0][1])).toStrictEqual({color_temp: 156, color: {x: 0.2717, y: 0.6585}}); + }); + it('Should parse set with ieeeAddr topic', async () => { const device = zigbeeHerdsman.devices.bulb_color; const endpoint = device.getEndpoint(1);