diff --git a/npm-shrinkwrap.json b/npm-shrinkwrap.json index bfcb67c0..16f7ea5f 100644 --- a/npm-shrinkwrap.json +++ b/npm-shrinkwrap.json @@ -13445,9 +13445,9 @@ } }, "zigbee-herdsman-converters": { - "version": "12.0.3", - "resolved": "https://registry.npmjs.org/zigbee-herdsman-converters/-/zigbee-herdsman-converters-12.0.3.tgz", - "integrity": "sha512-h/yELe1o4Vzu4RrimLFx32M1qVdusBp+c1pgfB8xJ7pjTzH+yuyJj87Msc6dgoe8AJSGI9vSGdrund/cgspW8w==", + "version": "12.0.4", + "resolved": "https://registry.npmjs.org/zigbee-herdsman-converters/-/zigbee-herdsman-converters-12.0.4.tgz", + "integrity": "sha512-fNQlsbqSQSymSlWuxn9snmmxpp1A/7dIalJ6EDBs7XuM0QcdDxwJx7T0XJJNwgtb4PtOBy2pTzP487ZiGiws8A==", "dependencies": { "@babel/code-frame": { "version": "7.5.5", diff --git a/package.json b/package.json index 5f5dbcc8..193a1fba 100644 --- a/package.json +++ b/package.json @@ -46,7 +46,7 @@ "semver": "*", "winston": "*", "zigbee-herdsman": "0.12.37", - "zigbee-herdsman-converters": "12.0.3" + "zigbee-herdsman-converters": "12.0.4" }, "devDependencies": { "eslint": "*", diff --git a/test/entityPublish.test.js b/test/entityPublish.test.js index b6c0ef4f..eec386e5 100644 --- a/test/entityPublish.test.js +++ b/test/entityPublish.test.js @@ -931,4 +931,17 @@ describe('Entity publish', () => { expect(JSON.parse(MQTT.publish.mock.calls[0][1])).toStrictEqual({state_l3: 'ON'}); expect(MQTT.publish.mock.calls[0][2]).toStrictEqual({"qos": 0, "retain": false}); }); + + it('Should publish separate genOnOff to GL-S-007ZS when setting state and brightness as bulb doesnt turn on with moveToLevelWithOnOff', async () => { + // https://github.com/Koenkk/zigbee2mqtt/issues/2757 + const device = zigbeeHerdsman.devices['GL-S-007ZS']; + const endpoint = device.getEndpoint(1); + await MQTT.events.message('zigbee2mqtt/GL-S-007ZS/set', JSON.stringify({state: 'ON', brightness: 20})); + await flushPromises(); + expect(endpoint.command).toHaveBeenCalledTimes(2); + expect(endpoint.command.mock.calls[0]).toEqual([ 'genOnOff', 'on', {}, {} ]); + expect(endpoint.command.mock.calls[1]).toEqual([ 'genLevelCtrl', 'moveToLevelWithOnOff', { level: 20, transtime: 0 }, {} ]); + expect(MQTT.publish).toHaveBeenCalledTimes(1); + expect(MQTT.publish.mock.calls[0]).toEqual([ 'zigbee2mqtt/GL-S-007ZS', '{"state":"ON","brightness":20}', { qos: 0, retain: false }, expect.any(Function)]) + }); }); diff --git a/test/stub/data.js b/test/stub/data.js index ca18ed0b..9285624f 100644 --- a/test/stub/data.js +++ b/test/stub/data.js @@ -144,6 +144,9 @@ function writeDefaultConfiguration() { }, '0x90fd9ffffe4b64ac': { friendly_name: 'MKS-CM-W5', + }, + '0x0017880104e45526': { + friendly_name: 'GL-S-007ZS', } }, groups: { diff --git a/test/stub/zigbeeHerdsman.js b/test/stub/zigbeeHerdsman.js index 81c027e9..1b918976 100644 --- a/test/stub/zigbeeHerdsman.js +++ b/test/stub/zigbeeHerdsman.js @@ -139,7 +139,7 @@ const devices = { 'SP600_OLD': new Device('Router', '0x90fd9ffffe4b64aa', 33901, 4476, [new Endpoint(1, [0,4,3,5,10,258,13,19,6,1,1030,8,768,1027,1029,1026], [0,3,4,6,8,5], '0x90fd9ffffe4b64aa', [], {seMetering: {"multiplier":1,"divisor":10000}})], true, "Mains (single phase)", "SP600", false, 'Salus', '20160120'), 'SP600_NEW': new Device('Router', '0x90fd9ffffe4b64ab', 33901, 4476, [new Endpoint(1, [0,4,3,5,10,258,13,19,6,1,1030,8,768,1027,1029,1026], [0,3,4,6,8,5], '0x90fd9ffffe4b64aa', [], {seMetering: {"multiplier":1,"divisor":10000}})], true, "Mains (single phase)", "SP600", false, 'Salus', '20170220'), 'MKS-CM-W5': new Device('Router', '0x90fd9ffffe4b64ac', 33901, 4476, [new Endpoint(1, [0,4,3,5,10,258,13,19,6,1,1030,8,768,1027,1029,1026], [0,3,4,6,8,5], '0x90fd9ffffe4b64aa', [], {})], true, "Mains (single phase)", "qnazj70", false), - + 'GL-S-007ZS': new Device('Router', '0x0017880104e45526', 6540,4151, [new Endpoint(1, [0], [], '0x0017880104e45526')], true, "Mains (single phase)", 'GL-S-007ZS'), } const groups = {