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);