iobroker.zigbee 3.0.5 → 3.1.4
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 +34 -0
- package/admin/admin.js +475 -230
- package/admin/i18n/de/translations.json +16 -16
- package/admin/index_m.html +84 -91
- package/admin/tab_m.html +38 -16
- package/docs/de/readme.md +1 -1
- package/docs/en/readme.md +4 -2
- package/io-package.json +35 -28
- package/lib/DeviceDebug.js +25 -2
- package/lib/binding.js +8 -8
- package/lib/commands.js +386 -326
- package/lib/developer.js +2 -2
- package/lib/devices.js +13 -9
- package/lib/exclude.js +1 -1
- package/lib/exposes.js +56 -24
- package/lib/groups.js +408 -73
- package/lib/localConfig.js +23 -12
- package/lib/networkmap.js +10 -2
- package/lib/states.js +32 -2
- package/lib/statescontroller.js +361 -209
- package/lib/utils.js +7 -5
- package/lib/zbDelayedAction.js +4 -4
- package/lib/zbDeviceAvailability.js +102 -46
- package/lib/zbDeviceConfigure.js +7 -0
- package/lib/zbDeviceEvent.js +40 -7
- package/lib/zigbeecontroller.js +552 -75
- package/main.js +168 -505
- package/package.json +8 -11
- package/lib/tools.js +0 -55
package/lib/localConfig.js
CHANGED
|
@@ -1,10 +1,8 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
/*eslint no-unused-vars: ['off']*/
|
|
4
3
|
const fs = require('fs');
|
|
5
4
|
const path = require('path');
|
|
6
5
|
const utils = require('@iobroker/adapter-core'); // Get common adapter utils
|
|
7
|
-
// const { src } = require('gulp');
|
|
8
6
|
|
|
9
7
|
const EventEmitter = require('events').EventEmitter;
|
|
10
8
|
|
|
@@ -20,7 +18,6 @@ class localConfig extends EventEmitter {
|
|
|
20
18
|
this.adapter.on('ready', () => this.onReady());
|
|
21
19
|
}
|
|
22
20
|
|
|
23
|
-
|
|
24
21
|
async onReady()
|
|
25
22
|
{
|
|
26
23
|
}
|
|
@@ -60,7 +57,7 @@ class localConfig extends EventEmitter {
|
|
|
60
57
|
}
|
|
61
58
|
if (typeof name != 'string' || name.trim().length < 1)
|
|
62
59
|
{
|
|
63
|
-
if (this.localData.hasOwnProperty(id))
|
|
60
|
+
if (this.localData.by_id.hasOwnProperty(id))
|
|
64
61
|
delete this.localData.by_id[id].name;
|
|
65
62
|
}
|
|
66
63
|
else {
|
|
@@ -103,6 +100,7 @@ class localConfig extends EventEmitter {
|
|
|
103
100
|
else this.localData.by_id[target] = base;
|
|
104
101
|
}
|
|
105
102
|
this.info(`Local Data for ${target} is ${JSON.stringify(base)} after update`);
|
|
103
|
+
this.retainData();
|
|
106
104
|
return true;
|
|
107
105
|
}
|
|
108
106
|
|
|
@@ -115,9 +113,12 @@ class localConfig extends EventEmitter {
|
|
|
115
113
|
this.error(`update called with illegal id data:${JSON.stringify(target)}:${JSON.stringify(key)}`)
|
|
116
114
|
return false;
|
|
117
115
|
}
|
|
118
|
-
const base = global ? this.localData.by_model[target] || {} : this.localData.by_id[target] || {};
|
|
119
116
|
const rv = {};
|
|
120
|
-
if (
|
|
117
|
+
if ((this.localData.byModel[target] || {}).hasOwnProperty(key))
|
|
118
|
+
rv[key] = this.localData.byModel[target] || {}[key];
|
|
119
|
+
if (global) return rv;
|
|
120
|
+
if ((this.localData.by_id[_target] || {}).hasOwnProperty(key))
|
|
121
|
+
rv[key] = this.localData.by_id[_target] || {}[key];
|
|
121
122
|
return rv;
|
|
122
123
|
}
|
|
123
124
|
|
|
@@ -284,7 +285,7 @@ class localConfig extends EventEmitter {
|
|
|
284
285
|
}
|
|
285
286
|
|
|
286
287
|
async retainData() {
|
|
287
|
-
|
|
288
|
+
this.debug('retaining local config: ' + JSON.stringify(this.localData));
|
|
288
289
|
try {
|
|
289
290
|
fs.writeFileSync(this.filename, JSON.stringify(this.localData, null, 2))
|
|
290
291
|
this.info('Saved local configuration data');
|
|
@@ -303,7 +304,6 @@ class localConfig extends EventEmitter {
|
|
|
303
304
|
const fn = path.join(item.parentPath, item.name);
|
|
304
305
|
rv.push({file: fn, name: item.name, data: fs.readFileSync(path.join(item.parentPath, item.name), 'base64'), isBase64:true});
|
|
305
306
|
});
|
|
306
|
-
//this.warn('enumerateImages for ' + _path + ' is ' + JSON.stringify(rv));
|
|
307
307
|
}
|
|
308
308
|
catch (error) {
|
|
309
309
|
this.error(`error in enumerateImages : ${error.message ? error.message : 'undefined error'}`)
|
|
@@ -311,11 +311,22 @@ class localConfig extends EventEmitter {
|
|
|
311
311
|
return rv;
|
|
312
312
|
}
|
|
313
313
|
|
|
314
|
-
getOptions(
|
|
314
|
+
getOptions(_dev_id, model_id) {
|
|
315
|
+
function extractOptions(target, options) {
|
|
316
|
+
if (typeof target != 'object') target = {};
|
|
317
|
+
if (typeof options != 'object') return target;
|
|
318
|
+
Object.keys(options).forEach((option) => target[option] = options[option]);
|
|
319
|
+
return target;
|
|
320
|
+
}
|
|
321
|
+
const dev_id = _dev_id.startsWith('0x') ? _dev_id.substring(2) : _dev_id
|
|
322
|
+
|
|
315
323
|
const ld = this.localData.by_id[dev_id];
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
324
|
+
const gd = this.localData.by_model[model_id];
|
|
325
|
+
const rv = {};
|
|
326
|
+
if (gd) extractOptions(rv, gd.options);
|
|
327
|
+
if (ld) extractOptions(rv, ld.options);
|
|
328
|
+
this.debug(`getOptions for ${dev_id} : ${JSON.stringify(rv)}`);
|
|
329
|
+
return rv;
|
|
319
330
|
}
|
|
320
331
|
|
|
321
332
|
}
|
package/lib/networkmap.js
CHANGED
|
@@ -4,6 +4,7 @@ class NetworkMap {
|
|
|
4
4
|
constructor(adapter) {
|
|
5
5
|
this.adapter = adapter;
|
|
6
6
|
this.adapter.on('message', this.onMessage.bind(this));
|
|
7
|
+
this.mapdata = undefined;
|
|
7
8
|
}
|
|
8
9
|
|
|
9
10
|
start(zbController, stController) {
|
|
@@ -37,16 +38,23 @@ class NetworkMap {
|
|
|
37
38
|
switch (obj.command) {
|
|
38
39
|
case 'getMap':
|
|
39
40
|
if (obj && obj.message && typeof obj.message === 'object') {
|
|
40
|
-
this.getMap(obj.from, obj.command, obj.callback);
|
|
41
|
+
this.getMap(obj.from, obj.command, obj.message, obj.callback);
|
|
41
42
|
}
|
|
42
43
|
break;
|
|
43
44
|
}
|
|
44
45
|
}
|
|
45
46
|
}
|
|
46
47
|
|
|
47
|
-
getMap(from, command, callback) {
|
|
48
|
+
getMap(from, command, message, callback) {
|
|
49
|
+
if (message.forcebuild) this.mapdata = undefined;
|
|
50
|
+
if (this.mapdata) {
|
|
51
|
+
this.mapdata.errors = {};
|
|
52
|
+
this.adapter.sendTo(from, command, this.mapdata, callback)
|
|
53
|
+
return;
|
|
54
|
+
}
|
|
48
55
|
if (this.zbController) {
|
|
49
56
|
this.zbController.getMap(networkmap => {
|
|
57
|
+
this.mapdata = networkmap;
|
|
50
58
|
this.adapter.log.debug(`getMap result: ${JSON.stringify(networkmap)}`);
|
|
51
59
|
this.adapter.sendTo(from, command, networkmap, callback);
|
|
52
60
|
});
|
package/lib/states.js
CHANGED
|
@@ -81,7 +81,8 @@ const states = {
|
|
|
81
81
|
read: true,
|
|
82
82
|
type: 'number',
|
|
83
83
|
min: 0,
|
|
84
|
-
max: 255
|
|
84
|
+
max: 255,
|
|
85
|
+
isCommonState:true,
|
|
85
86
|
},
|
|
86
87
|
available: {
|
|
87
88
|
id: 'available',
|
|
@@ -91,7 +92,8 @@ const states = {
|
|
|
91
92
|
role: 'state',
|
|
92
93
|
write: false,
|
|
93
94
|
read: true,
|
|
94
|
-
type: 'boolean'
|
|
95
|
+
type: 'boolean',
|
|
96
|
+
isCommonState:true,
|
|
95
97
|
},
|
|
96
98
|
device_query: { // button to trigger device read
|
|
97
99
|
id: 'device_query',
|
|
@@ -103,6 +105,7 @@ const states = {
|
|
|
103
105
|
read: false,
|
|
104
106
|
type: 'boolean',
|
|
105
107
|
isOption: true,
|
|
108
|
+
isCommonState:true,
|
|
106
109
|
},
|
|
107
110
|
from_zigbee: {
|
|
108
111
|
id: 'msg_from_zigbee',
|
|
@@ -112,6 +115,7 @@ const states = {
|
|
|
112
115
|
write: false,
|
|
113
116
|
read: true,
|
|
114
117
|
type: 'string',
|
|
118
|
+
isCommonState:true,
|
|
115
119
|
},
|
|
116
120
|
send_payload: {
|
|
117
121
|
id: 'send_payload',
|
|
@@ -121,6 +125,7 @@ const states = {
|
|
|
121
125
|
write: true,
|
|
122
126
|
read: true,
|
|
123
127
|
type: 'string',
|
|
128
|
+
isCommonState:true,
|
|
124
129
|
},
|
|
125
130
|
checking: { // press button for checking
|
|
126
131
|
id: 'checking',
|
|
@@ -6603,6 +6608,31 @@ const states = {
|
|
|
6603
6608
|
read: true,
|
|
6604
6609
|
type: 'number',
|
|
6605
6610
|
},
|
|
6611
|
+
|
|
6612
|
+
groupstateupdate: {
|
|
6613
|
+
id: 'stateupdate',
|
|
6614
|
+
name: 'Set group by member states',
|
|
6615
|
+
icon: undefined,
|
|
6616
|
+
role: 'state',
|
|
6617
|
+
write: true,
|
|
6618
|
+
read: true,
|
|
6619
|
+
type: 'string',
|
|
6620
|
+
states: {off:'off',max:'max',min:'min',avg:'avg',mat:'mat'},
|
|
6621
|
+
def:'off',
|
|
6622
|
+
isCommonState: true,
|
|
6623
|
+
isOption: true,
|
|
6624
|
+
},
|
|
6625
|
+
groupmemberupdate: {
|
|
6626
|
+
id: 'memberupdate',
|
|
6627
|
+
name: 'Read member states',
|
|
6628
|
+
icon: undefined,
|
|
6629
|
+
role: 'state',
|
|
6630
|
+
write: true,
|
|
6631
|
+
read: true,
|
|
6632
|
+
type: 'boolean',
|
|
6633
|
+
isCommonState: true,
|
|
6634
|
+
isOption: true,
|
|
6635
|
+
}
|
|
6606
6636
|
};
|
|
6607
6637
|
|
|
6608
6638
|
module.exports = {
|