iobroker.zigbee 1.8.3 → 1.8.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (87) hide show
  1. package/README.md +6 -0
  2. package/admin/adapter-settings.js +244 -0
  3. package/admin/admin.js +520 -494
  4. package/admin/index_m.html +1171 -1001
  5. package/admin/tab_m.html +44 -2
  6. package/docs/de/img/CC2531.png +0 -0
  7. package/docs/de/img/CC2538_CC2592_PA.PNG +0 -0
  8. package/docs/de/img/CC2591.png +0 -0
  9. package/docs/de/img/boards.jpg +0 -0
  10. package/docs/de/img/cc26x2r.PNG +0 -0
  11. package/docs/de/img/results.jpg +0 -0
  12. package/docs/de/img/sku_429478_2.png +0 -0
  13. package/docs/de/img/sku_429601_2.png +0 -0
  14. package/docs/de/readme.md +27 -0
  15. package/docs/en/img/CC2531.png +0 -0
  16. package/docs/en/img/CC2591.png +0 -0
  17. package/docs/en/img/deconz.png +0 -0
  18. package/docs/en/img/sku_429478_2.png +0 -0
  19. package/docs/en/img/sku_429601_2.png +0 -0
  20. package/docs/en/readme.md +30 -0
  21. package/docs/flashing_via_arduino_(en).md +110 -0
  22. package/docs/ru/img/CC2531.png +0 -0
  23. package/docs/ru/img/CC2591.png +0 -0
  24. package/docs/ru/img/sku_429478_2.png +0 -0
  25. package/docs/ru/img/sku_429601_2.png +0 -0
  26. package/docs/ru/readme.md +28 -0
  27. package/docs/tutorial/CC2530_20190425.zip +0 -0
  28. package/docs/tutorial/CC2530_CC2591_20190515.zip +0 -0
  29. package/docs/tutorial/CC2530_CC2592_20190515.zip +0 -0
  30. package/docs/tutorial/CC2531_20190425.zip +0 -0
  31. package/docs/tutorial/adm5_1.PNG +0 -0
  32. package/docs/tutorial/adm5_2.PNG +0 -0
  33. package/docs/tutorial/cat.PNG +0 -0
  34. package/docs/tutorial/groups-1.png +0 -0
  35. package/docs/tutorial/groups-2.png +0 -0
  36. package/docs/tutorial/inst.PNG +0 -0
  37. package/docs/tutorial/reflash-finish.PNG +0 -0
  38. package/docs/tutorial/reflash-step0.png +0 -0
  39. package/docs/tutorial/reflash-step1.PNG +0 -0
  40. package/docs/tutorial/reflash-step2.PNG +0 -0
  41. package/docs/tutorial/settings.png +0 -0
  42. package/docs/tutorial/tab-dev-1.png +0 -0
  43. package/docs/tutorial/zigbee.png +0 -0
  44. package/docs/tutorial/zigbee15.png +0 -0
  45. package/io-package.json +34 -33
  46. package/lib/backup.js +2 -2
  47. package/lib/binding.js +32 -37
  48. package/lib/colors.js +163 -158
  49. package/lib/commands.js +100 -91
  50. package/lib/developer.js +9 -12
  51. package/lib/devices.js +168 -178
  52. package/lib/exclude.js +30 -36
  53. package/lib/exposes.js +168 -143
  54. package/lib/groups.js +81 -83
  55. package/lib/json.js +5 -6
  56. package/lib/networkmap.js +2 -3
  57. package/lib/ota.js +34 -18
  58. package/lib/rgb.js +114 -72
  59. package/lib/seriallist.js +25 -20
  60. package/lib/statescontroller.js +206 -183
  61. package/lib/utils.js +29 -23
  62. package/lib/zbBaseExtension.js +4 -4
  63. package/lib/zbDelayedAction.js +5 -13
  64. package/lib/zbDeviceAvailability.js +69 -65
  65. package/lib/zbDeviceConfigure.js +9 -21
  66. package/lib/zbDeviceEvent.js +3 -4
  67. package/lib/zigbeecontroller.js +133 -128
  68. package/main.js +169 -154
  69. package/package.json +28 -14
  70. package/.eslintignore +0 -2
  71. package/.eslintrc.json +0 -37
  72. package/.github/FUNDING.yml +0 -3
  73. package/.github/auto-merge.yml +0 -17
  74. package/.github/dependabot.yml +0 -24
  75. package/.github/stale.yml +0 -13
  76. package/.github/workflows/codeql.yml +0 -41
  77. package/.github/workflows/dependabot-automerge.yml +0 -22
  78. package/.github/workflows/test-and-release.yml +0 -149
  79. package/.releaseconfig.json +0 -3
  80. package/.travis/wiki.sh +0 -28
  81. package/.travis.yml +0 -41
  82. package/gulpfile.js +0 -464
  83. package/test/integration.js +0 -5
  84. package/test/mocha.custom.opts +0 -2
  85. package/test/mocha.setup.js +0 -14
  86. package/test/package.js +0 -5
  87. package/test/unit.js +0 -5
package/lib/binding.js CHANGED
@@ -34,7 +34,7 @@ class Binding {
34
34
  debug(msg) {
35
35
  this.adapter.log.debug(msg);
36
36
  }
37
-
37
+
38
38
  warn(msg) {
39
39
  this.adapter.log.warn(msg);
40
40
  }
@@ -47,30 +47,26 @@ class Binding {
47
47
  switch (obj.command) {
48
48
  case 'addBinding':
49
49
  if (obj && obj.message && typeof obj.message === 'object') {
50
- this.addBinding(obj.from, obj.command, obj.message, (err)=>{
51
- this.adapter.sendTo(obj.from, obj.command, err, obj.callback);
52
- });
50
+ this.addBinding(obj.from, obj.command, obj.message, err =>
51
+ this.adapter.sendTo(obj.from, obj.command, err, obj.callback));
53
52
  }
54
53
  break;
55
54
  case 'editBinding':
56
55
  if (obj && obj.message && typeof obj.message === 'object') {
57
- this.editBinding(obj.from, obj.command, obj.message, (err)=>{
58
- this.adapter.sendTo(obj.from, obj.command, err, obj.callback);
59
- });
56
+ this.editBinding(obj.from, obj.command, obj.message, err =>
57
+ this.adapter.sendTo(obj.from, obj.command, err, obj.callback));
60
58
  }
61
59
  break;
62
60
  case 'getBinding':
63
61
  if (obj && obj.message && typeof obj.message === 'object') {
64
- this.getBinding((binding)=>{
65
- this.adapter.sendTo(obj.from, obj.command, binding, obj.callback);
66
- });
62
+ this.getBinding(binding =>
63
+ this.adapter.sendTo(obj.from, obj.command, binding, obj.callback));
67
64
  }
68
65
  break;
69
66
  case 'delBinding':
70
67
  if (obj && obj.message) {
71
- this.delBinding(obj.from, obj.command, obj.message, (err)=>{
72
- this.adapter.sendTo(obj.from, obj.command, err, obj.callback);
73
- });
68
+ this.delBinding(obj.from, obj.command, obj.message, err =>
69
+ this.adapter.sendTo(obj.from, obj.command, err, obj.callback));
74
70
  }
75
71
  break;
76
72
  }
@@ -86,21 +82,23 @@ class Binding {
86
82
  }
87
83
 
88
84
  extractDeviceId(stateId) {
89
- if (stateId)
85
+ if (stateId) {
90
86
  return stateId.replace(`${this.adapter.namespace}.`, '');
87
+ }
91
88
  return '';
92
89
  }
93
90
 
94
91
  getBindEp(ep) {
95
- if (ep)
92
+ if (ep) {
96
93
  return parseInt(ep.split('_')[0]);
94
+ }
97
95
 
98
96
  this.warn(`getBindEp called with illegal ep: ${safeJsonStringify(ep)}`);
99
97
  return 0;
100
98
  }
101
99
 
102
100
  getBindCl(ep) {
103
- return (ep.indexOf('_') > 0) ? ep.split('_')[1] : null;
101
+ return ep.indexOf('_') > 0 ? ep.split('_')[1] : null;
104
102
  }
105
103
 
106
104
  async doBindUnbind(type, bind_source, bind_source_ep, bind_target, bind_target_ep, callback) {
@@ -123,8 +121,7 @@ class Binding {
123
121
 
124
122
  if (!source || !target) {
125
123
  this.error('Devices not found');
126
- if (callback) callback('Devices not found');
127
- return;
124
+ return callback && callback('Devices not found');
128
125
  }
129
126
  const sourceName = source.name;
130
127
  const targetName = target.name;
@@ -144,8 +141,7 @@ class Binding {
144
141
  }
145
142
  if (!found) {
146
143
  this.debug(`No bind clusters`);
147
- if (callback) callback(`No bind clusters`);
148
- return;
144
+ return callback && callback(`No bind clusters`);
149
145
  } else {
150
146
  let ok = true;
151
147
  for (const clID of clusters) {
@@ -171,23 +167,23 @@ class Binding {
171
167
  `Failed to ${type} cluster '${cluster}' from '${sourceName}' to ` +
172
168
  `'${targetName}' (${error})`,
173
169
  );
174
- if (callback) callback(`Failed to ${type} cluster '${cluster}' from '${sourceName}' to '${targetName}' (${error})`);
170
+ callback && callback(`Failed to ${type} cluster '${cluster}' from '${sourceName}' to '${targetName}' (${error})`);
175
171
  ok = false;
176
172
  break;
177
173
  }
178
174
  }
179
175
  }
180
- if (ok && callback) callback(undefined, id);
176
+ ok && callback && callback(undefined, id);
181
177
  }
182
178
  } catch (error) {
183
179
  this.error(`Failed to doBindUnbind ${error.stack}`);
184
- if (callback) callback(`Failed to doBindUnbind ${error.stack}`);
180
+ callback && callback(`Failed to doBindUnbind ${error.stack}`);
185
181
  }
186
182
  }
187
183
 
188
184
  async addBinding(from, command, params, callback) {
189
185
  try {
190
- this.debug('addBinding message: ' + JSON.stringify(params));
186
+ this.debug(`addBinding message: ${JSON.stringify(params)}`);
191
187
  const bind_source = params.bind_source,
192
188
  bind_source_ep = params.bind_source_ep,
193
189
  bind_target = params.bind_target,
@@ -207,9 +203,8 @@ class Binding {
207
203
  type: 'state',
208
204
  common: {name: id},
209
205
  }, () => {
210
- this.adapter.setState(stateId, JSON.stringify(params), true, () => {
211
- callback();
212
- });
206
+ this.adapter.setState(stateId, JSON.stringify(params), true, () =>
207
+ callback());
213
208
  });
214
209
  }
215
210
  });
@@ -221,7 +216,7 @@ class Binding {
221
216
 
222
217
  async editBinding(from, command, params, callback) {
223
218
  try {
224
- this.debug('editBinding message: ' + JSON.stringify(params));
219
+ this.debug(`editBinding message: ${JSON.stringify(params)}`);
225
220
  const old_id = params.id,
226
221
  bind_source = params.bind_source,
227
222
  bind_source_ep = params.bind_source_ep,
@@ -229,7 +224,7 @@ class Binding {
229
224
  bind_target_ep = params.bind_target_ep,
230
225
  id = this.getBindingId(bind_source, bind_source_ep, bind_target, bind_target_ep);
231
226
  if (old_id !== id) {
232
- await this.delBinding(from, command, old_id, async (err)=>{
227
+ await this.delBinding(from, command, old_id, async err => {
233
228
  if (err) {
234
229
  callback(err);
235
230
  } else {
@@ -239,10 +234,10 @@ class Binding {
239
234
  } else {
240
235
  const type = params.unbind_from_coordinator ? 'unbind' : 'bind';
241
236
  try {
242
- await this.doBindUnbind(type , bind_source, bind_source_ep, 'coordinator', '1');
237
+ await this.doBindUnbind(type, bind_source, bind_source_ep, 'coordinator', '1');
243
238
  this.debug('Successfully ' + (type === 'bind' ? 'bound' : 'unbound') + ' Coordinator from ' + bind_source);
244
239
  } catch (e) {
245
- this.error('Could not ' + type + ' Coordinator from ' + bind_source + ': ' + JSON.stringify(e));
240
+ this.error(`Could not ${type} Coordinator from ${bind_source}: ${JSON.stringify(e)}`);
246
241
  }
247
242
  }
248
243
  } catch (error) {
@@ -252,17 +247,17 @@ class Binding {
252
247
 
253
248
  async delBinding(from, command, bind_id, callback) {
254
249
  try {
255
- this.debug('delBinding message: ' + JSON.stringify(bind_id));
250
+ this.debug(`delBinding message: ${JSON.stringify(bind_id)}`);
256
251
  const stateId = `info.${bind_id}`;
257
252
  this.adapter.getStateAsync(stateId)
258
- .then(async (stateV) => {
259
- this.debug('found state: ' + JSON.stringify(stateV));
253
+ .then(async stateV => {
254
+ this.debug(`found state: ${JSON.stringify(stateV)}`);
260
255
  const params = JSON.parse(stateV.val);
261
256
  const bind_source = params.bind_source,
262
257
  bind_source_ep = params.bind_source_ep,
263
258
  bind_target = params.bind_target,
264
259
  bind_target_ep = params.bind_target_ep;
265
- await this.doBindUnbind('unbind', bind_source, bind_source_ep, bind_target, bind_target_ep, async (err) => {
260
+ await this.doBindUnbind('unbind', bind_source, bind_source_ep, bind_target, bind_target_ep, async err => {
266
261
  if (err) {
267
262
  callback({error: err});
268
263
  } else {
@@ -308,11 +303,11 @@ class Binding {
308
303
  }
309
304
  });
310
305
  return Promise.all(chain).then(() => {
311
- this.debug('getBinding result: ' + JSON.stringify(binding));
306
+ this.debug(`getBinding result: ${JSON.stringify(binding)}`);
312
307
  callback(binding);
313
308
  });
314
309
  } else {
315
- this.debug('getBinding result: ' + JSON.stringify(binding));
310
+ this.debug(`getBinding result: ${JSON.stringify(binding)}`);
316
311
  callback(binding);
317
312
  }
318
313
  });