iobroker.zigbee 1.7.5 → 1.7.6

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 (85) hide show
  1. package/.eslintignore +1 -1
  2. package/.eslintrc.json +36 -36
  3. package/.github/FUNDING.yml +3 -3
  4. package/.github/stale.yml +13 -13
  5. package/.github/workflows/test-and-release.yml +151 -151
  6. package/.travis/wiki.sh +27 -27
  7. package/LICENSE +21 -21
  8. package/README.md +382 -376
  9. package/admin/adapter-settings.js +244 -244
  10. package/admin/admin.js +2927 -2926
  11. package/admin/img/philips_hue_lom001.png +0 -0
  12. package/admin/index.html +159 -159
  13. package/admin/index_m.html +1161 -1161
  14. package/admin/moment.min.js +1 -1
  15. package/admin/shuffle.min.js +2 -2
  16. package/admin/tab_m.html +944 -944
  17. package/admin/vis-network.min.css +1 -1
  18. package/admin/vis-network.min.js +27 -27
  19. package/admin/words.js +111 -112
  20. package/io-package.json +370 -366
  21. package/lib/backup.js +171 -171
  22. package/lib/binding.js +325 -325
  23. package/lib/colors.js +460 -460
  24. package/lib/commands.js +501 -501
  25. package/lib/developer.js +148 -148
  26. package/lib/devices.js +3145 -3145
  27. package/lib/exclude.js +168 -168
  28. package/lib/exposes.js +804 -804
  29. package/lib/groups.js +342 -342
  30. package/lib/json.js +60 -60
  31. package/lib/networkmap.js +56 -56
  32. package/lib/ota.js +179 -179
  33. package/lib/rgb.js +255 -255
  34. package/lib/seriallist.js +37 -37
  35. package/lib/states.js +6416 -6416
  36. package/lib/statescontroller.js +670 -670
  37. package/lib/tools.js +54 -54
  38. package/lib/utils.js +151 -151
  39. package/lib/zbBaseExtension.js +36 -36
  40. package/lib/zbDelayedAction.js +152 -152
  41. package/lib/zbDeviceAvailability.js +315 -315
  42. package/lib/zbDeviceConfigure.js +159 -152
  43. package/lib/zbDeviceEvent.js +49 -49
  44. package/lib/zigbeecontroller.js +951 -946
  45. package/package.json +3 -3
  46. package/support/docgen.js +93 -93
  47. package/docs/de/img/CC2531.png +0 -0
  48. package/docs/de/img/CC2538_CC2592_PA.PNG +0 -0
  49. package/docs/de/img/CC2591.png +0 -0
  50. package/docs/de/img/boards.jpg +0 -0
  51. package/docs/de/img/cc26x2r.PNG +0 -0
  52. package/docs/de/img/results.jpg +0 -0
  53. package/docs/de/img/sku_429478_2.png +0 -0
  54. package/docs/de/img/sku_429601_2.png +0 -0
  55. package/docs/de/readme.md +0 -27
  56. package/docs/en/img/CC2531.png +0 -0
  57. package/docs/en/img/CC2591.png +0 -0
  58. package/docs/en/img/deconz.png +0 -0
  59. package/docs/en/img/sku_429478_2.png +0 -0
  60. package/docs/en/img/sku_429601_2.png +0 -0
  61. package/docs/en/readme.md +0 -30
  62. package/docs/flashing_via_arduino_(en).md +0 -110
  63. package/docs/ru/img/CC2531.png +0 -0
  64. package/docs/ru/img/CC2591.png +0 -0
  65. package/docs/ru/img/sku_429478_2.png +0 -0
  66. package/docs/ru/img/sku_429601_2.png +0 -0
  67. package/docs/ru/readme.md +0 -28
  68. package/docs/tutorial/CC2530_20190425.zip +0 -0
  69. package/docs/tutorial/CC2530_CC2591_20190515.zip +0 -0
  70. package/docs/tutorial/CC2530_CC2592_20190515.zip +0 -0
  71. package/docs/tutorial/CC2531_20190425.zip +0 -0
  72. package/docs/tutorial/adm5_1.PNG +0 -0
  73. package/docs/tutorial/adm5_2.PNG +0 -0
  74. package/docs/tutorial/cat.PNG +0 -0
  75. package/docs/tutorial/groups-1.png +0 -0
  76. package/docs/tutorial/groups-2.png +0 -0
  77. package/docs/tutorial/inst.PNG +0 -0
  78. package/docs/tutorial/reflash-finish.PNG +0 -0
  79. package/docs/tutorial/reflash-step0.png +0 -0
  80. package/docs/tutorial/reflash-step1.PNG +0 -0
  81. package/docs/tutorial/reflash-step2.PNG +0 -0
  82. package/docs/tutorial/settings.png +0 -0
  83. package/docs/tutorial/tab-dev-1.png +0 -0
  84. package/docs/tutorial/zigbee.png +0 -0
  85. package/docs/tutorial/zigbee15.png +0 -0
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;