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.
- package/README.md +6 -0
- package/admin/adapter-settings.js +244 -0
- package/admin/admin.js +520 -494
- package/admin/index_m.html +1171 -1001
- package/admin/tab_m.html +44 -2
- package/docs/de/img/CC2531.png +0 -0
- package/docs/de/img/CC2538_CC2592_PA.PNG +0 -0
- package/docs/de/img/CC2591.png +0 -0
- package/docs/de/img/boards.jpg +0 -0
- package/docs/de/img/cc26x2r.PNG +0 -0
- package/docs/de/img/results.jpg +0 -0
- package/docs/de/img/sku_429478_2.png +0 -0
- package/docs/de/img/sku_429601_2.png +0 -0
- package/docs/de/readme.md +27 -0
- package/docs/en/img/CC2531.png +0 -0
- package/docs/en/img/CC2591.png +0 -0
- package/docs/en/img/deconz.png +0 -0
- package/docs/en/img/sku_429478_2.png +0 -0
- package/docs/en/img/sku_429601_2.png +0 -0
- package/docs/en/readme.md +30 -0
- package/docs/flashing_via_arduino_(en).md +110 -0
- package/docs/ru/img/CC2531.png +0 -0
- package/docs/ru/img/CC2591.png +0 -0
- package/docs/ru/img/sku_429478_2.png +0 -0
- package/docs/ru/img/sku_429601_2.png +0 -0
- package/docs/ru/readme.md +28 -0
- package/docs/tutorial/CC2530_20190425.zip +0 -0
- package/docs/tutorial/CC2530_CC2591_20190515.zip +0 -0
- package/docs/tutorial/CC2530_CC2592_20190515.zip +0 -0
- package/docs/tutorial/CC2531_20190425.zip +0 -0
- package/docs/tutorial/adm5_1.PNG +0 -0
- package/docs/tutorial/adm5_2.PNG +0 -0
- package/docs/tutorial/cat.PNG +0 -0
- package/docs/tutorial/groups-1.png +0 -0
- package/docs/tutorial/groups-2.png +0 -0
- package/docs/tutorial/inst.PNG +0 -0
- package/docs/tutorial/reflash-finish.PNG +0 -0
- package/docs/tutorial/reflash-step0.png +0 -0
- package/docs/tutorial/reflash-step1.PNG +0 -0
- package/docs/tutorial/reflash-step2.PNG +0 -0
- package/docs/tutorial/settings.png +0 -0
- package/docs/tutorial/tab-dev-1.png +0 -0
- package/docs/tutorial/zigbee.png +0 -0
- package/docs/tutorial/zigbee15.png +0 -0
- package/io-package.json +34 -33
- package/lib/backup.js +2 -2
- package/lib/binding.js +32 -37
- package/lib/colors.js +163 -158
- package/lib/commands.js +100 -91
- package/lib/developer.js +9 -12
- package/lib/devices.js +168 -178
- package/lib/exclude.js +30 -36
- package/lib/exposes.js +168 -143
- package/lib/groups.js +81 -83
- package/lib/json.js +5 -6
- package/lib/networkmap.js +2 -3
- package/lib/ota.js +34 -18
- package/lib/rgb.js +114 -72
- package/lib/seriallist.js +25 -20
- package/lib/statescontroller.js +206 -183
- package/lib/utils.js +29 -23
- package/lib/zbBaseExtension.js +4 -4
- package/lib/zbDelayedAction.js +5 -13
- package/lib/zbDeviceAvailability.js +69 -65
- package/lib/zbDeviceConfigure.js +9 -21
- package/lib/zbDeviceEvent.js +3 -4
- package/lib/zigbeecontroller.js +133 -128
- package/main.js +169 -154
- package/package.json +28 -14
- package/.eslintignore +0 -2
- package/.eslintrc.json +0 -37
- package/.github/FUNDING.yml +0 -3
- package/.github/auto-merge.yml +0 -17
- package/.github/dependabot.yml +0 -24
- package/.github/stale.yml +0 -13
- package/.github/workflows/codeql.yml +0 -41
- package/.github/workflows/dependabot-automerge.yml +0 -22
- package/.github/workflows/test-and-release.yml +0 -149
- package/.releaseconfig.json +0 -3
- package/.travis/wiki.sh +0 -28
- package/.travis.yml +0 -41
- package/gulpfile.js +0 -464
- package/test/integration.js +0 -5
- package/test/mocha.custom.opts +0 -2
- package/test/mocha.setup.js +0 -14
- package/test/package.js +0 -5
- 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,
|
|
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,
|
|
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(
|
|
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,
|
|
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
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
176
|
+
ok && callback && callback(undefined, id);
|
|
181
177
|
}
|
|
182
178
|
} catch (error) {
|
|
183
179
|
this.error(`Failed to doBindUnbind ${error.stack}`);
|
|
184
|
-
|
|
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(
|
|
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(
|
|
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
|
|
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
|
|
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(
|
|
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(
|
|
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
|
|
259
|
-
this.debug(
|
|
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
|
|
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(
|
|
306
|
+
this.debug(`getBinding result: ${JSON.stringify(binding)}`);
|
|
312
307
|
callback(binding);
|
|
313
308
|
});
|
|
314
309
|
} else {
|
|
315
|
-
this.debug(
|
|
310
|
+
this.debug(`getBinding result: ${JSON.stringify(binding)}`);
|
|
316
311
|
callback(binding);
|
|
317
312
|
}
|
|
318
313
|
});
|