Update zigbee-shepherd-converters to 10.0.0 and zigbee-herdsman to 0.1.11.

This commit is contained in:
Koen Kanters 2019-06-19 21:44:44 +02:00
parent 801e97143c
commit ef01346776
5 changed files with 51 additions and 10 deletions

View File

@ -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(

View File

@ -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) => {

12
npm-shrinkwrap.json generated
View File

@ -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": "*",

View File

@ -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": {

View File

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