iobroker.zigbee 1.6.16 → 1.7.0
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/.eslintignore +1 -1
- package/.eslintrc.json +36 -36
- package/.github/FUNDING.yml +3 -3
- package/.github/stale.yml +13 -13
- package/.github/workflows/test-and-release.yml +151 -151
- package/.travis/wiki.sh +27 -27
- package/LICENSE +21 -21
- package/README.md +378 -367
- package/admin/adapter-settings.js +244 -244
- package/admin/admin.js +2926 -2926
- package/admin/img/philips_ensis.png +0 -0
- package/admin/img/philips_hue_lom001.png +0 -0
- package/admin/index.html +159 -159
- package/admin/index_m.html +1161 -1158
- package/admin/moment.min.js +1 -1
- package/admin/shuffle.min.js +2 -2
- package/admin/tab_m.html +944 -944
- package/admin/vis-network.min.css +1 -1
- package/admin/vis-network.min.js +27 -26
- package/admin/words.js +112 -108
- package/docs/de/readme.md +27 -27
- package/docs/en/readme.md +30 -30
- package/docs/flashing_via_arduino_(en).md +110 -110
- package/docs/ru/readme.md +28 -28
- package/docs/tutorial/groups-1.png +0 -0
- package/docs/tutorial/groups-2.png +0 -0
- package/docs/tutorial/tab-dev-1.png +0 -0
- package/io-package.json +340 -355
- package/lib/backup.js +171 -133
- package/lib/binding.js +325 -325
- package/lib/colors.js +460 -460
- package/lib/commands.js +501 -501
- package/lib/developer.js +148 -148
- package/lib/devices.js +3145 -3144
- package/lib/exclude.js +168 -168
- package/lib/exposes.js +805 -795
- package/lib/groups.js +342 -342
- package/lib/json.js +60 -60
- package/lib/networkmap.js +56 -56
- package/lib/ota.js +179 -179
- package/lib/rgb.js +255 -255
- package/lib/seriallist.js +37 -37
- package/lib/states.js +6416 -6407
- package/lib/statescontroller.js +658 -627
- package/lib/tools.js +54 -54
- package/lib/utils.js +151 -151
- package/lib/zbBaseExtension.js +36 -32
- package/lib/zbDelayedAction.js +152 -152
- package/lib/zbDeviceAvailability.js +315 -318
- package/lib/zbDeviceConfigure.js +152 -152
- package/lib/zbDeviceEvent.js +49 -49
- package/lib/zigbeecontroller.js +946 -946
- package/main.js +22 -4
- package/package.json +3 -3
- package/support/docgen.js +93 -93
package/lib/exclude.js
CHANGED
|
@@ -1,168 +1,168 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
class Exclude {
|
|
4
|
-
constructor(adapter) {
|
|
5
|
-
this.adapter = adapter;
|
|
6
|
-
this.adapter.on('message', this.onMessage.bind(this));
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
start(zbController, stController) {
|
|
10
|
-
this.zbController = zbController;
|
|
11
|
-
this.stController = stController;
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
stop() {
|
|
15
|
-
delete this.zbController;
|
|
16
|
-
delete this.stController;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
info(msg) {
|
|
20
|
-
this.adapter.log.info(msg);
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
error(msg) {
|
|
24
|
-
this.adapter.log.error(msg);
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
debug(msg) {
|
|
28
|
-
this.adapter.log.debug(msg);
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
warn(msg) {
|
|
32
|
-
this.adapter.log.warn(msg);
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
/**
|
|
38
|
-
* @param {ioBroker.Message} obj
|
|
39
|
-
*/
|
|
40
|
-
onMessage(obj) {
|
|
41
|
-
if (typeof obj === 'object' && obj.command) {
|
|
42
|
-
switch (obj.command) {
|
|
43
|
-
case 'addExclude':
|
|
44
|
-
if (obj && obj.message && typeof obj.message === 'object') {
|
|
45
|
-
this.addExclude(obj.from, obj.command, obj.message, (err)=>{
|
|
46
|
-
this.adapter.sendTo(obj.from, obj.command, err, obj.callback);
|
|
47
|
-
});
|
|
48
|
-
}
|
|
49
|
-
break;
|
|
50
|
-
|
|
51
|
-
case 'getExclude':
|
|
52
|
-
if (obj && obj.message && typeof obj.message === 'object') {
|
|
53
|
-
this.getExclude((exclude)=>{
|
|
54
|
-
this.adapter.sendTo(obj.from, obj.command, exclude, obj.callback);
|
|
55
|
-
});
|
|
56
|
-
}
|
|
57
|
-
break;
|
|
58
|
-
case 'delExclude':
|
|
59
|
-
if (obj && obj.message) {
|
|
60
|
-
this.delExclude(obj.from, obj.command, obj.message, (err)=>{
|
|
61
|
-
this.adapter.sendTo(obj.from, obj.command, err, obj.callback);
|
|
62
|
-
});
|
|
63
|
-
}
|
|
64
|
-
break;
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
getExcludeId(exclude_target) {
|
|
70
|
-
return `${this.extractDeviceId(exclude_target)}`;
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
extractDeviceId(stateId) {
|
|
74
|
-
if (stateId)
|
|
75
|
-
return stateId.replace(`${this.adapter.namespace}.`, '');
|
|
76
|
-
return '';
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
extractExcludeId(stateId) {
|
|
80
|
-
return stateId.replace(`${this.adapter.namespace}.exclude.`, '');
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
getExcludeName(devName, stateId) {
|
|
84
|
-
return devName.replace(` ${stateId}`, '');
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
async addExclude(from, command, params, callback) {
|
|
88
|
-
try {
|
|
89
|
-
this.debug('addExclude message: ' + JSON.stringify(params));
|
|
90
|
-
const exclude_mod = params.exclude_model.common.type;
|
|
91
|
-
const stateId = `exclude.${exclude_mod}`;
|
|
92
|
-
|
|
93
|
-
this.adapter.setObjectNotExists(stateId,
|
|
94
|
-
{
|
|
95
|
-
type: 'state',
|
|
96
|
-
common: {name: exclude_mod},
|
|
97
|
-
}, () => {
|
|
98
|
-
this.adapter.setState(stateId, exclude_mod, true, () => {
|
|
99
|
-
callback();
|
|
100
|
-
});
|
|
101
|
-
}
|
|
102
|
-
);
|
|
103
|
-
} catch (error) {
|
|
104
|
-
this.error(`Failed to addExclude ${error.stack}`);
|
|
105
|
-
throw new Error(`Failed to addExclude ${error.stack}`);
|
|
106
|
-
}
|
|
107
|
-
}
|
|
108
|
-
async delExclude(from, command, exclude_id, callback) {
|
|
109
|
-
try {
|
|
110
|
-
this.debug('delExclude message: ' + JSON.stringify(exclude_id));
|
|
111
|
-
const stateId = `exclude.${exclude_id}`;
|
|
112
|
-
this.adapter.getStateAsync(stateId)
|
|
113
|
-
.then(async (stateV) => {
|
|
114
|
-
this.debug('found state: ' + JSON.stringify(stateV));
|
|
115
|
-
this.adapter.deleteState(null, 'exclude', exclude_id, async () => {
|
|
116
|
-
callback();
|
|
117
|
-
});
|
|
118
|
-
});
|
|
119
|
-
} catch (error) {
|
|
120
|
-
this.error(`Failed to delExclude ${error.stack}`);
|
|
121
|
-
throw new Error(`Failed to delExclude ${error.stack}`);
|
|
122
|
-
}
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
getExclude(callback) {
|
|
126
|
-
try {
|
|
127
|
-
const exclude = [];
|
|
128
|
-
this.adapter.getStatesOf('exclude', (err, states) => {
|
|
129
|
-
if (!err && states) {
|
|
130
|
-
const exc = [];
|
|
131
|
-
states.forEach(state => {
|
|
132
|
-
if (state._id.startsWith(`${this.adapter.namespace}.exclude`)) {
|
|
133
|
-
exc.push(new Promise(resolve => {
|
|
134
|
-
return this.adapter.getStateAsync(state._id)
|
|
135
|
-
.then(stateVa => {
|
|
136
|
-
if (stateVa !== null) {
|
|
137
|
-
const val = {
|
|
138
|
-
id: this.extractExcludeId(state._id),
|
|
139
|
-
name : stateVa.val
|
|
140
|
-
};
|
|
141
|
-
if (this.extractExcludeId(state._id) !== 'all') {
|
|
142
|
-
exclude.push(val);
|
|
143
|
-
}
|
|
144
|
-
}
|
|
145
|
-
resolve();
|
|
146
|
-
});
|
|
147
|
-
}));
|
|
148
|
-
}
|
|
149
|
-
});
|
|
150
|
-
return Promise.all(exc).then(() => {
|
|
151
|
-
const arrExclude = JSON.stringify(exclude);
|
|
152
|
-
this.debug('getExclude result: ' + arrExclude);
|
|
153
|
-
this.adapter.setState('exclude.all', arrExclude, true, () => {
|
|
154
|
-
callback(exclude);
|
|
155
|
-
});
|
|
156
|
-
});
|
|
157
|
-
} else {
|
|
158
|
-
this.debug('getExclude result: ' + JSON.stringify(exclude));
|
|
159
|
-
callback(exclude);
|
|
160
|
-
}
|
|
161
|
-
});
|
|
162
|
-
} catch (error) {
|
|
163
|
-
this.error(`Failed to getExclude ${error.stack}`);
|
|
164
|
-
}
|
|
165
|
-
}
|
|
166
|
-
}
|
|
167
|
-
|
|
168
|
-
module.exports = Exclude;
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
class Exclude {
|
|
4
|
+
constructor(adapter) {
|
|
5
|
+
this.adapter = adapter;
|
|
6
|
+
this.adapter.on('message', this.onMessage.bind(this));
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
start(zbController, stController) {
|
|
10
|
+
this.zbController = zbController;
|
|
11
|
+
this.stController = stController;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
stop() {
|
|
15
|
+
delete this.zbController;
|
|
16
|
+
delete this.stController;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
info(msg) {
|
|
20
|
+
this.adapter.log.info(msg);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
error(msg) {
|
|
24
|
+
this.adapter.log.error(msg);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
debug(msg) {
|
|
28
|
+
this.adapter.log.debug(msg);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
warn(msg) {
|
|
32
|
+
this.adapter.log.warn(msg);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* @param {ioBroker.Message} obj
|
|
39
|
+
*/
|
|
40
|
+
onMessage(obj) {
|
|
41
|
+
if (typeof obj === 'object' && obj.command) {
|
|
42
|
+
switch (obj.command) {
|
|
43
|
+
case 'addExclude':
|
|
44
|
+
if (obj && obj.message && typeof obj.message === 'object') {
|
|
45
|
+
this.addExclude(obj.from, obj.command, obj.message, (err)=>{
|
|
46
|
+
this.adapter.sendTo(obj.from, obj.command, err, obj.callback);
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
break;
|
|
50
|
+
|
|
51
|
+
case 'getExclude':
|
|
52
|
+
if (obj && obj.message && typeof obj.message === 'object') {
|
|
53
|
+
this.getExclude((exclude)=>{
|
|
54
|
+
this.adapter.sendTo(obj.from, obj.command, exclude, obj.callback);
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
break;
|
|
58
|
+
case 'delExclude':
|
|
59
|
+
if (obj && obj.message) {
|
|
60
|
+
this.delExclude(obj.from, obj.command, obj.message, (err)=>{
|
|
61
|
+
this.adapter.sendTo(obj.from, obj.command, err, obj.callback);
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
break;
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
getExcludeId(exclude_target) {
|
|
70
|
+
return `${this.extractDeviceId(exclude_target)}`;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
extractDeviceId(stateId) {
|
|
74
|
+
if (stateId)
|
|
75
|
+
return stateId.replace(`${this.adapter.namespace}.`, '');
|
|
76
|
+
return '';
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
extractExcludeId(stateId) {
|
|
80
|
+
return stateId.replace(`${this.adapter.namespace}.exclude.`, '');
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
getExcludeName(devName, stateId) {
|
|
84
|
+
return devName.replace(` ${stateId}`, '');
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
async addExclude(from, command, params, callback) {
|
|
88
|
+
try {
|
|
89
|
+
this.debug('addExclude message: ' + JSON.stringify(params));
|
|
90
|
+
const exclude_mod = params.exclude_model.common.type;
|
|
91
|
+
const stateId = `exclude.${exclude_mod}`;
|
|
92
|
+
|
|
93
|
+
this.adapter.setObjectNotExists(stateId,
|
|
94
|
+
{
|
|
95
|
+
type: 'state',
|
|
96
|
+
common: {name: exclude_mod},
|
|
97
|
+
}, () => {
|
|
98
|
+
this.adapter.setState(stateId, exclude_mod, true, () => {
|
|
99
|
+
callback();
|
|
100
|
+
});
|
|
101
|
+
}
|
|
102
|
+
);
|
|
103
|
+
} catch (error) {
|
|
104
|
+
this.error(`Failed to addExclude ${error.stack}`);
|
|
105
|
+
throw new Error(`Failed to addExclude ${error.stack}`);
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
async delExclude(from, command, exclude_id, callback) {
|
|
109
|
+
try {
|
|
110
|
+
this.debug('delExclude message: ' + JSON.stringify(exclude_id));
|
|
111
|
+
const stateId = `exclude.${exclude_id}`;
|
|
112
|
+
this.adapter.getStateAsync(stateId)
|
|
113
|
+
.then(async (stateV) => {
|
|
114
|
+
this.debug('found state: ' + JSON.stringify(stateV));
|
|
115
|
+
this.adapter.deleteState(null, 'exclude', exclude_id, async () => {
|
|
116
|
+
callback();
|
|
117
|
+
});
|
|
118
|
+
});
|
|
119
|
+
} catch (error) {
|
|
120
|
+
this.error(`Failed to delExclude ${error.stack}`);
|
|
121
|
+
throw new Error(`Failed to delExclude ${error.stack}`);
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
getExclude(callback) {
|
|
126
|
+
try {
|
|
127
|
+
const exclude = [];
|
|
128
|
+
this.adapter.getStatesOf('exclude', (err, states) => {
|
|
129
|
+
if (!err && states) {
|
|
130
|
+
const exc = [];
|
|
131
|
+
states.forEach(state => {
|
|
132
|
+
if (state._id.startsWith(`${this.adapter.namespace}.exclude`)) {
|
|
133
|
+
exc.push(new Promise(resolve => {
|
|
134
|
+
return this.adapter.getStateAsync(state._id)
|
|
135
|
+
.then(stateVa => {
|
|
136
|
+
if (stateVa !== null) {
|
|
137
|
+
const val = {
|
|
138
|
+
id: this.extractExcludeId(state._id),
|
|
139
|
+
name : stateVa.val
|
|
140
|
+
};
|
|
141
|
+
if (this.extractExcludeId(state._id) !== 'all') {
|
|
142
|
+
exclude.push(val);
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
resolve();
|
|
146
|
+
});
|
|
147
|
+
}));
|
|
148
|
+
}
|
|
149
|
+
});
|
|
150
|
+
return Promise.all(exc).then(() => {
|
|
151
|
+
const arrExclude = JSON.stringify(exclude);
|
|
152
|
+
this.debug('getExclude result: ' + arrExclude);
|
|
153
|
+
this.adapter.setState('exclude.all', arrExclude, true, () => {
|
|
154
|
+
callback(exclude);
|
|
155
|
+
});
|
|
156
|
+
});
|
|
157
|
+
} else {
|
|
158
|
+
this.debug('getExclude result: ' + JSON.stringify(exclude));
|
|
159
|
+
callback(exclude);
|
|
160
|
+
}
|
|
161
|
+
});
|
|
162
|
+
} catch (error) {
|
|
163
|
+
this.error(`Failed to getExclude ${error.stack}`);
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
module.exports = Exclude;
|