diff --git a/lib/extension/devicePublish.js b/lib/extension/devicePublish.js index 5adb6d0f..eca7ca9d 100644 --- a/lib/extension/devicePublish.js +++ b/lib/extension/devicePublish.js @@ -87,6 +87,7 @@ class DevicePublish { let endpoint = null; let converters = null; let device = null; + let options = {}; if (entity.type === 'device') { device = this.zigbee.getDevice(entity.ID); @@ -114,6 +115,7 @@ class DevicePublish { } converters = model.toZigbee; + options = model.options || {}; } else if (entity.type === 'group') { converters = groupConverters; } @@ -168,7 +170,7 @@ class DevicePublish { } // Converter didn't return a result, skip - const convertedResults = converter.convert(key, json[key], json, topic.type, topic.postfix); + const convertedResults = converter.convert(key, json[key], json, topic.type, topic.postfix, options); if (!convertedResults || !convertedResults.length) { return; } @@ -202,7 +204,7 @@ class DevicePublish { const deviceSettings = settings.getDevice(entity.ID); if (topic.type === 'set' && entity.type === 'device' && converted.hasOwnProperty('readAfterWriteTime') && deviceSettings && deviceSettings.retrieve_state) { - const getConvertedResults = converter.convert(key, json[key], json, 'get'); + const getConvertedResults = converter.convert(key, json[key], json, 'get', options); getConvertedResults.forEach((getConverted) => { setTimeout(() => { this.zigbee.publish( diff --git a/lib/extension/homeassistant.js b/lib/extension/homeassistant.js index d8e6f461..4a9f36c9 100644 --- a/lib/extension/homeassistant.js +++ b/lib/extension/homeassistant.js @@ -743,6 +743,7 @@ const mapping = { '421792': [configurations.light_brightness_colortemp_colorxy], 'HGZB-06A': [configurations.light_brightness_colortemp_colorxy], 'LED1733G7': [configurations.light_brightness_colortemp], + '9290011370B': [configurations.light_brightness], }; Object.keys(mapping).forEach((key) => { diff --git a/npm-shrinkwrap.json b/npm-shrinkwrap.json index 9d36264a..70ff27bb 100644 --- a/npm-shrinkwrap.json +++ b/npm-shrinkwrap.json @@ -6010,9 +6010,9 @@ } }, "zigbee-herdsman": { - "version": "0.1.10", - "resolved": "https://registry.npmjs.org/zigbee-herdsman/-/zigbee-herdsman-0.1.10.tgz", - "integrity": "sha512-6gErpXX1RzK2tACY1bkfHDS2HUwJkNj32x4ORv0Cz1U7RYoFZo/clFE/tdPUfKUOMkhJsq5a+cNp089vY3+U5g==", + "version": "0.1.11", + "resolved": "https://registry.npmjs.org/zigbee-herdsman/-/zigbee-herdsman-0.1.11.tgz", + "integrity": "sha512-ynj8lt7qgasi5KowF+lpDAI6urzfjsbHRJJ4iYAIIENn61lkqHTfisOGTKrV8EITHNADY8ipUlLzcREu7W6c8w==", "requires": { "busyman": "^0.3.0", "concentrate": "^0.2.3", @@ -12529,9 +12529,9 @@ } }, "zigbee-shepherd-converters": { - "version": "9.0.22", - "resolved": "https://registry.npmjs.org/zigbee-shepherd-converters/-/zigbee-shepherd-converters-9.0.22.tgz", - "integrity": "sha512-YR+bzO+Ja8npuwD+ZmKyIZzgs4niM+pLqLpkLbNhBdVosibrUx866YU45lyQLfLgfcAV5Rprh5fsb2IXb6spOA==", + "version": "10.0.0", + "resolved": "https://registry.npmjs.org/zigbee-shepherd-converters/-/zigbee-shepherd-converters-10.0.0.tgz", + "integrity": "sha512-cCnGG6TjC2RPoC15yZIme2KkAAe2ca+p1sqDcm7r/qUigobNnlc72ehgC/kYn6qXm2J8v5IermmAqMpr44FfRg==", "requires": { "chai": "*", "debounce": "*", diff --git a/package.json b/package.json index ad456d70..469e5cd5 100644 --- a/package.json +++ b/package.json @@ -43,8 +43,8 @@ "rimraf": "*", "semver": "*", "winston": "2.4.2", - "zigbee-herdsman": "0.1.10", - "zigbee-shepherd-converters": "9.0.22", + "zigbee-herdsman": "0.1.11", + "zigbee-shepherd-converters": "10.0.0", "deep-diff": "*" }, "devDependencies": { diff --git a/test/devicePublish.test.js b/test/devicePublish.test.js index cde73dd8..00f417b7 100644 --- a/test/devicePublish.test.js +++ b/test/devicePublish.test.js @@ -26,6 +26,13 @@ const cfg = { manufSpec: 0, disDefaultRsp: 0, }, + defaultApsNoAck: { + manufSpec: 0, + disDefaultRsp: 0, + options: { + options: 16, + }, + }, }; describe('DevicePublish', () => { @@ -1194,4 +1201,35 @@ describe('DevicePublish', () => { '0x00000001', {color: {x: 0.41, y: 0.25}}); }); + + it('Should publish message with apsNoAck when set', async () => { + zigbee.publish.mockClear(); + publishEntityState.mockClear(); + zigbee.getDevice = () => ({modelId: 'HDC52EastwindFan'}); + devicePublish.onMQTTMessage('zigbee2mqtt/0x00000003/set', JSON.stringify({brightness: '92'})); + expect(zigbee.publish).toHaveBeenCalledTimes(1); + expect(zigbee.publish).toHaveBeenNthCalledWith(1, + '0x00000003', + 'device', + 'genLevelCtrl', + 'moveToLevelWithOnOff', + 'functional', + {level: 92, transtime: 0}, + cfg.defaultApsNoAck, + null, + expect.any(Function)); + + devicePublish.onMQTTMessage('zigbee2mqtt/0x00000003/set', JSON.stringify({state: 'OFF'})); + expect(zigbee.publish).toHaveBeenCalledTimes(2); + expect(zigbee.publish).toHaveBeenNthCalledWith(2, + '0x00000003', + 'device', + 'genOnOff', + 'off', + 'functional', + {}, + cfg.defaultApsNoAck, + null, + expect.any(Function)); + }); });