iobroker.zigbee 1.8.18 → 1.8.19

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 (60) hide show
  1. package/LICENSE +21 -21
  2. package/README.md +418 -415
  3. package/admin/adapter-settings.js +244 -244
  4. package/admin/admin.js +2981 -2981
  5. package/admin/i18n/de/translations.json +108 -108
  6. package/admin/i18n/en/translations.json +108 -108
  7. package/admin/i18n/es/translations.json +102 -102
  8. package/admin/i18n/fr/translations.json +108 -108
  9. package/admin/i18n/it/translations.json +102 -102
  10. package/admin/i18n/nl/translations.json +108 -108
  11. package/admin/i18n/pl/translations.json +108 -108
  12. package/admin/i18n/pt/translations.json +102 -102
  13. package/admin/i18n/ru/translations.json +108 -108
  14. package/admin/i18n/uk/translations.json +108 -108
  15. package/admin/i18n/zh-cn/translations.json +102 -102
  16. package/admin/img/philips_hue_lom001.png +0 -0
  17. package/admin/index.html +159 -159
  18. package/admin/index_m.html +1356 -1356
  19. package/admin/moment.min.js +1 -1
  20. package/admin/shuffle.min.js +2 -2
  21. package/admin/tab_m.html +1009 -1009
  22. package/admin/vis-network.min.css +1 -1
  23. package/admin/vis-network.min.js +27 -27
  24. package/admin/words.js +110 -110
  25. package/docs/de/basedocu.md +19 -19
  26. package/docs/de/readme.md +126 -126
  27. package/docs/en/readme.md +128 -128
  28. package/docs/flashing_via_arduino_(en).md +110 -110
  29. package/docs/ru/readme.md +28 -28
  30. package/docs/tutorial/groups-1.png +0 -0
  31. package/docs/tutorial/groups-2.png +0 -0
  32. package/docs/tutorial/tab-dev-1.png +0 -0
  33. package/io-package.json +14 -5
  34. package/lib/backup.js +171 -171
  35. package/lib/binding.js +319 -319
  36. package/lib/colors.js +465 -465
  37. package/lib/commands.js +534 -534
  38. package/lib/developer.js +145 -145
  39. package/lib/devices.js +3135 -3135
  40. package/lib/exclude.js +162 -162
  41. package/lib/exposes.js +913 -913
  42. package/lib/groups.js +345 -345
  43. package/lib/json.js +59 -59
  44. package/lib/networkmap.js +55 -55
  45. package/lib/ota.js +198 -198
  46. package/lib/rgb.js +297 -297
  47. package/lib/seriallist.js +48 -48
  48. package/lib/states.js +6420 -6420
  49. package/lib/statescontroller.js +672 -672
  50. package/lib/tools.js +54 -54
  51. package/lib/utils.js +163 -163
  52. package/lib/zbBaseExtension.js +36 -36
  53. package/lib/zbDelayedAction.js +144 -144
  54. package/lib/zbDeviceAvailability.js +319 -319
  55. package/lib/zbDeviceConfigure.js +147 -147
  56. package/lib/zbDeviceEvent.js +48 -48
  57. package/lib/zigbeecontroller.js +989 -989
  58. package/main.js +60 -35
  59. package/package.json +6 -4
  60. package/support/docgen.js +93 -93
package/lib/exclude.js CHANGED
@@ -1,162 +1,162 @@
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
- * @param {ioBroker.Message} obj
38
- */
39
- onMessage(obj) {
40
- if (typeof obj === 'object' && obj.command) {
41
- switch (obj.command) {
42
- case 'addExclude':
43
- if (obj && obj.message && typeof obj.message === 'object') {
44
- this.addExclude(obj.from, obj.command, obj.message, err =>
45
- this.adapter.sendTo(obj.from, obj.command, err, obj.callback));
46
- }
47
- break;
48
-
49
- case 'getExclude':
50
- if (obj && obj.message && typeof obj.message === 'object') {
51
- this.getExclude(exclude =>
52
- this.adapter.sendTo(obj.from, obj.command, exclude, obj.callback));
53
- }
54
- break;
55
- case 'delExclude':
56
- if (obj && obj.message) {
57
- this.delExclude(obj.from, obj.command, obj.message, err =>
58
- this.adapter.sendTo(obj.from, obj.command, err, obj.callback));
59
- }
60
- break;
61
- }
62
- }
63
- }
64
-
65
- getExcludeId(exclude_target) {
66
- return `${this.extractDeviceId(exclude_target)}`;
67
- }
68
-
69
- extractDeviceId(stateId) {
70
- if (stateId) {
71
- return stateId.replace(`${this.adapter.namespace}.`, '');
72
- }
73
- return '';
74
- }
75
-
76
- extractExcludeId(stateId) {
77
- return stateId.replace(`${this.adapter.namespace}.exclude.`, '');
78
- }
79
-
80
- getExcludeName(devName, stateId) {
81
- return devName.replace(` ${stateId}`, '');
82
- }
83
-
84
- async addExclude(from, command, params, callback) {
85
- try {
86
- this.debug('addExclude message: ' + JSON.stringify(params));
87
- const exclude_mod = params.exclude_model.common.type;
88
- const stateId = `exclude.${exclude_mod}`;
89
-
90
- this.adapter.setObjectNotExists(stateId,
91
- {
92
- type: 'state',
93
- common: {name: exclude_mod},
94
- },
95
- () => this.adapter.setState(stateId, exclude_mod, true, () =>
96
- callback()),
97
- );
98
- } catch (error) {
99
- this.error(`Failed to addExclude ${error.stack}`);
100
- throw new Error(`Failed to addExclude ${error.stack}`);
101
- }
102
- }
103
-
104
- async delExclude(from, command, exclude_id, callback) {
105
- try {
106
- this.debug(`delExclude message: ${JSON.stringify(exclude_id)}`);
107
- const stateId = `exclude.${exclude_id}`;
108
- this.adapter.getStateAsync(stateId)
109
- .then(async (stateV) => {
110
- this.debug(`found state: ${JSON.stringify(stateV)}`);
111
- this.adapter.deleteState(null, 'exclude', exclude_id, async () =>
112
- callback());
113
- });
114
- } catch (error) {
115
- this.error(`Failed to delExclude ${error.stack}`);
116
- throw new Error(`Failed to delExclude ${error.stack}`);
117
- }
118
- }
119
-
120
- getExclude(callback) {
121
- try {
122
- const exclude = [];
123
- this.adapter.getStatesOf('exclude', (err, states) => {
124
- if (!err && states) {
125
- const exc = [];
126
- states.forEach(state => {
127
- if (state._id.startsWith(`${this.adapter.namespace}.exclude`)) {
128
- exc.push(new Promise(resolve =>
129
- this.adapter.getStateAsync(state._id)
130
- .then(stateVa => {
131
- if (stateVa !== null) {
132
- const val = {
133
- id: this.extractExcludeId(state._id),
134
- name: stateVa.val
135
- };
136
- if (this.extractExcludeId(state._id) !== 'all') {
137
- exclude.push(val);
138
- }
139
- }
140
- resolve();
141
- })));
142
- }
143
- });
144
- return Promise.all(exc)
145
- .then(() => {
146
- const arrExclude = JSON.stringify(exclude);
147
- this.debug(`getExclude result: ${arrExclude}`);
148
- this.adapter.setState('exclude.all', arrExclude, true, () =>
149
- callback(exclude));
150
- });
151
- } else {
152
- this.debug(`getExclude result: ${JSON.stringify(exclude)}`);
153
- callback(exclude);
154
- }
155
- });
156
- } catch (error) {
157
- this.error(`Failed to getExclude ${error.stack}`);
158
- }
159
- }
160
- }
161
-
162
- 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
+ * @param {ioBroker.Message} obj
38
+ */
39
+ onMessage(obj) {
40
+ if (typeof obj === 'object' && obj.command) {
41
+ switch (obj.command) {
42
+ case 'addExclude':
43
+ if (obj && obj.message && typeof obj.message === 'object') {
44
+ this.addExclude(obj.from, obj.command, obj.message, err =>
45
+ this.adapter.sendTo(obj.from, obj.command, err, obj.callback));
46
+ }
47
+ break;
48
+
49
+ case 'getExclude':
50
+ if (obj && obj.message && typeof obj.message === 'object') {
51
+ this.getExclude(exclude =>
52
+ this.adapter.sendTo(obj.from, obj.command, exclude, obj.callback));
53
+ }
54
+ break;
55
+ case 'delExclude':
56
+ if (obj && obj.message) {
57
+ this.delExclude(obj.from, obj.command, obj.message, err =>
58
+ this.adapter.sendTo(obj.from, obj.command, err, obj.callback));
59
+ }
60
+ break;
61
+ }
62
+ }
63
+ }
64
+
65
+ getExcludeId(exclude_target) {
66
+ return `${this.extractDeviceId(exclude_target)}`;
67
+ }
68
+
69
+ extractDeviceId(stateId) {
70
+ if (stateId) {
71
+ return stateId.replace(`${this.adapter.namespace}.`, '');
72
+ }
73
+ return '';
74
+ }
75
+
76
+ extractExcludeId(stateId) {
77
+ return stateId.replace(`${this.adapter.namespace}.exclude.`, '');
78
+ }
79
+
80
+ getExcludeName(devName, stateId) {
81
+ return devName.replace(` ${stateId}`, '');
82
+ }
83
+
84
+ async addExclude(from, command, params, callback) {
85
+ try {
86
+ this.debug('addExclude message: ' + JSON.stringify(params));
87
+ const exclude_mod = params.exclude_model.common.type;
88
+ const stateId = `exclude.${exclude_mod}`;
89
+
90
+ this.adapter.setObjectNotExists(stateId,
91
+ {
92
+ type: 'state',
93
+ common: {name: exclude_mod},
94
+ },
95
+ () => this.adapter.setState(stateId, exclude_mod, true, () =>
96
+ callback()),
97
+ );
98
+ } catch (error) {
99
+ this.error(`Failed to addExclude ${error.stack}`);
100
+ throw new Error(`Failed to addExclude ${error.stack}`);
101
+ }
102
+ }
103
+
104
+ async delExclude(from, command, exclude_id, callback) {
105
+ try {
106
+ this.debug(`delExclude message: ${JSON.stringify(exclude_id)}`);
107
+ const stateId = `exclude.${exclude_id}`;
108
+ this.adapter.getStateAsync(stateId)
109
+ .then(async (stateV) => {
110
+ this.debug(`found state: ${JSON.stringify(stateV)}`);
111
+ this.adapter.deleteState(null, 'exclude', exclude_id, async () =>
112
+ callback());
113
+ });
114
+ } catch (error) {
115
+ this.error(`Failed to delExclude ${error.stack}`);
116
+ throw new Error(`Failed to delExclude ${error.stack}`);
117
+ }
118
+ }
119
+
120
+ getExclude(callback) {
121
+ try {
122
+ const exclude = [];
123
+ this.adapter.getStatesOf('exclude', (err, states) => {
124
+ if (!err && states) {
125
+ const exc = [];
126
+ states.forEach(state => {
127
+ if (state._id.startsWith(`${this.adapter.namespace}.exclude`)) {
128
+ exc.push(new Promise(resolve =>
129
+ this.adapter.getStateAsync(state._id)
130
+ .then(stateVa => {
131
+ if (stateVa !== null) {
132
+ const val = {
133
+ id: this.extractExcludeId(state._id),
134
+ name: stateVa.val
135
+ };
136
+ if (this.extractExcludeId(state._id) !== 'all') {
137
+ exclude.push(val);
138
+ }
139
+ }
140
+ resolve();
141
+ })));
142
+ }
143
+ });
144
+ return Promise.all(exc)
145
+ .then(() => {
146
+ const arrExclude = JSON.stringify(exclude);
147
+ this.debug(`getExclude result: ${arrExclude}`);
148
+ this.adapter.setState('exclude.all', arrExclude, true, () =>
149
+ callback(exclude));
150
+ });
151
+ } else {
152
+ this.debug(`getExclude result: ${JSON.stringify(exclude)}`);
153
+ callback(exclude);
154
+ }
155
+ });
156
+ } catch (error) {
157
+ this.error(`Failed to getExclude ${error.stack}`);
158
+ }
159
+ }
160
+ }
161
+
162
+ module.exports = Exclude;