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/developer.js CHANGED
@@ -1,148 +1,148 @@
1
- 'use strict';
2
-
3
- const ZigbeeHerdsman = require('zigbee-herdsman');
4
-
5
-
6
- class Developer {
7
- constructor(adapter) {
8
- this.adapter = adapter;
9
- this.adapter.on('message', this.onMessage.bind(this));
10
- }
11
-
12
- start(zbController, stController) {
13
- this.zbController = zbController;
14
- this.stController = stController;
15
- }
16
-
17
- stop() {
18
- delete this.zbController;
19
- delete this.stController;
20
- }
21
-
22
- info(msg) {
23
- this.adapter.log.info(msg);
24
- }
25
-
26
- error(msg) {
27
- this.adapter.log.error(msg);
28
- }
29
-
30
- debug(msg) {
31
- this.adapter.log.debug(msg);
32
- }
33
-
34
- /**
35
- * @param {ioBroker.Message} obj
36
- */
37
- onMessage(obj) {
38
- if (typeof obj === 'object' && obj.command) {
39
- switch (obj.command) {
40
- case 'reset':
41
- this.zbController.reset(obj.message.mode, function (err) {
42
- this.adapter.sendTo(obj.from, obj.command, err, obj.callback);
43
- }.bind(this));
44
- break;
45
- case 'sendToZigbee':
46
- this.sendToZigbee(obj);
47
- break;
48
- case 'getLibData':
49
- // e.g. zcl lists
50
- this.getLibData(obj);
51
- break;
52
- }
53
- }
54
- }
55
-
56
- getLibData(obj) {
57
- const key = obj.message.key;
58
- const zcl = ZigbeeHerdsman.Zcl;
59
- const result = {};
60
- if (key === 'cidList') {
61
- result.list = zcl.Cluster;
62
- } else if (key === 'attrIdList') {
63
- const cid = obj.message.cid;
64
- result.list = zcl.Utils.getCluster(cid).attributes;
65
- } else if (key === 'cmdListFoundation') {
66
- result.list = zcl.Foundation;
67
- } else if (key === 'cmdListFunctional') {
68
- result.list = null;
69
- const cluster = zcl.Utils.getCluster(obj.message.cid);
70
- if (typeof cluster != 'undefined') {
71
- const extraCmd = cluster.commands;
72
- result.list = extraCmd;
73
- }
74
- } else if (key === 'respCodes') {
75
- result.list = zcl.Status;
76
- } else if (key === 'typeList') {
77
- result.list = zcl.DataType;
78
- } else {
79
- return;
80
- }
81
- result.key = key;
82
- this.adapter.sendTo(obj.from, obj.command, result, obj.callback);
83
- }
84
-
85
- async sendToZigbee(obj) {
86
- const zcl = ZigbeeHerdsman.Zcl;
87
- const devId = '0x' + obj.message.id.replace(this.adapter.namespace + '.', '');
88
- const ep = obj.message.ep ? obj.message.ep : null;
89
- const cid = obj.message.cid;
90
- const cmdType = obj.message.cmdType;
91
- let cmd;
92
- const zclData = obj.message.zclData;
93
- if (cmdType === 'functional') {
94
- cmd = zcl.Utils.getCluster(cid).getCommand(obj.message.cmd);
95
- }
96
- else if (cmdType === 'functionalResp') {
97
- cmd = zcl.Utils.getCluster(cid).getCommandResponse(obj.message.cmd);
98
- }
99
- else if (cmdType === 'foundation') {
100
- cmd = zcl.Utils.getGlobalCommand((obj.message.cmd));
101
- } else {
102
- this.adapter.sendTo(obj.from, obj.command, {localErr: 'Invalid cmdType'}, obj.callback);
103
- return;
104
- }
105
- const cfg = obj.message.hasOwnProperty('cfg') ? obj.message.cfg : null;
106
-
107
- const publishTarget = this.zbController.getDevice(devId) ? devId : this.zbController.getGroup(parseInt(devId));
108
- if (!publishTarget) {
109
- this.adapter.sendTo(obj.from, obj.command, {localErr: 'Device or group ' + devId + ' not found!'}, obj.callback);
110
- return;
111
- }
112
- if (!cid || !cmd) {
113
- this.adapter.sendTo(obj.from, obj.command, {localErr: 'Incomplete data (cid or cmd)'}, obj.callback);
114
- return;
115
- }
116
- this.debug(`Ready to send (ep: ${ep}, cid: ${cid}, cmd ${cmd.name}, zcl: ${JSON.stringify(zclData)})`);
117
- try {
118
- await this.zbController.publish(publishTarget, cid, cmd.name, zclData, cfg, ep, cmdType, (err, msg) => {
119
- // map err and msg in one object for sendTo
120
- const result = {};
121
- result.msg = msg;
122
- if (err) {
123
- // err is an instance of Error class, it cannot be forwarded to sendTo, just get error code
124
- result.error = err.code;
125
- }
126
- result.statusCode = 0;
127
- this.adapter.sendTo(obj.from, obj.command, result, obj.callback);
128
- },obj.message.zclSeqNum);
129
- } catch (exception) {
130
- // report exceptions
131
- // happens for example if user tries to send write command but did not provide value/type
132
- // or unsupported attribute was addressed.
133
- const ZclStatusError = require('zigbee-herdsman/dist/zcl/zclStatusError').default;
134
- if (exception instanceof ZclStatusError) {
135
- const result = {};
136
- result.msg = `Zigbee error ${exception.code} received!`;
137
- result.statusCode = exception.code;
138
- this.adapter.sendTo(obj.from, obj.command, result, obj.callback);
139
- } else {
140
- this.error('SendToZigbee failed! (' + exception + ')');
141
- // exception (Error class) cannot be send to adapter, send string message instead!
142
- this.adapter.sendTo(obj.from, obj.command, {msg: exception.message}, obj.callback);
143
- }
144
- }
145
- }
146
- }
147
-
148
- module.exports = Developer;
1
+ 'use strict';
2
+
3
+ const ZigbeeHerdsman = require('zigbee-herdsman');
4
+
5
+
6
+ class Developer {
7
+ constructor(adapter) {
8
+ this.adapter = adapter;
9
+ this.adapter.on('message', this.onMessage.bind(this));
10
+ }
11
+
12
+ start(zbController, stController) {
13
+ this.zbController = zbController;
14
+ this.stController = stController;
15
+ }
16
+
17
+ stop() {
18
+ delete this.zbController;
19
+ delete this.stController;
20
+ }
21
+
22
+ info(msg) {
23
+ this.adapter.log.info(msg);
24
+ }
25
+
26
+ error(msg) {
27
+ this.adapter.log.error(msg);
28
+ }
29
+
30
+ debug(msg) {
31
+ this.adapter.log.debug(msg);
32
+ }
33
+
34
+ /**
35
+ * @param {ioBroker.Message} obj
36
+ */
37
+ onMessage(obj) {
38
+ if (typeof obj === 'object' && obj.command) {
39
+ switch (obj.command) {
40
+ case 'reset':
41
+ this.zbController.reset(obj.message.mode, function (err) {
42
+ this.adapter.sendTo(obj.from, obj.command, err, obj.callback);
43
+ }.bind(this));
44
+ break;
45
+ case 'sendToZigbee':
46
+ this.sendToZigbee(obj);
47
+ break;
48
+ case 'getLibData':
49
+ // e.g. zcl lists
50
+ this.getLibData(obj);
51
+ break;
52
+ }
53
+ }
54
+ }
55
+
56
+ getLibData(obj) {
57
+ const key = obj.message.key;
58
+ const zcl = ZigbeeHerdsman.Zcl;
59
+ const result = {};
60
+ if (key === 'cidList') {
61
+ result.list = zcl.Cluster;
62
+ } else if (key === 'attrIdList') {
63
+ const cid = obj.message.cid;
64
+ result.list = zcl.Utils.getCluster(cid).attributes;
65
+ } else if (key === 'cmdListFoundation') {
66
+ result.list = zcl.Foundation;
67
+ } else if (key === 'cmdListFunctional') {
68
+ result.list = null;
69
+ const cluster = zcl.Utils.getCluster(obj.message.cid);
70
+ if (typeof cluster != 'undefined') {
71
+ const extraCmd = cluster.commands;
72
+ result.list = extraCmd;
73
+ }
74
+ } else if (key === 'respCodes') {
75
+ result.list = zcl.Status;
76
+ } else if (key === 'typeList') {
77
+ result.list = zcl.DataType;
78
+ } else {
79
+ return;
80
+ }
81
+ result.key = key;
82
+ this.adapter.sendTo(obj.from, obj.command, result, obj.callback);
83
+ }
84
+
85
+ async sendToZigbee(obj) {
86
+ const zcl = ZigbeeHerdsman.Zcl;
87
+ const devId = '0x' + obj.message.id.replace(this.adapter.namespace + '.', '');
88
+ const ep = obj.message.ep ? obj.message.ep : null;
89
+ const cid = obj.message.cid;
90
+ const cmdType = obj.message.cmdType;
91
+ let cmd;
92
+ const zclData = obj.message.zclData;
93
+ if (cmdType === 'functional') {
94
+ cmd = zcl.Utils.getCluster(cid).getCommand(obj.message.cmd);
95
+ }
96
+ else if (cmdType === 'functionalResp') {
97
+ cmd = zcl.Utils.getCluster(cid).getCommandResponse(obj.message.cmd);
98
+ }
99
+ else if (cmdType === 'foundation') {
100
+ cmd = zcl.Utils.getGlobalCommand((obj.message.cmd));
101
+ } else {
102
+ this.adapter.sendTo(obj.from, obj.command, {localErr: 'Invalid cmdType'}, obj.callback);
103
+ return;
104
+ }
105
+ const cfg = obj.message.hasOwnProperty('cfg') ? obj.message.cfg : null;
106
+
107
+ const publishTarget = this.zbController.getDevice(devId) ? devId : this.zbController.getGroup(parseInt(devId));
108
+ if (!publishTarget) {
109
+ this.adapter.sendTo(obj.from, obj.command, {localErr: 'Device or group ' + devId + ' not found!'}, obj.callback);
110
+ return;
111
+ }
112
+ if (!cid || !cmd) {
113
+ this.adapter.sendTo(obj.from, obj.command, {localErr: 'Incomplete data (cid or cmd)'}, obj.callback);
114
+ return;
115
+ }
116
+ this.debug(`Ready to send (ep: ${ep}, cid: ${cid}, cmd ${cmd.name}, zcl: ${JSON.stringify(zclData)})`);
117
+ try {
118
+ await this.zbController.publish(publishTarget, cid, cmd.name, zclData, cfg, ep, cmdType, (err, msg) => {
119
+ // map err and msg in one object for sendTo
120
+ const result = {};
121
+ result.msg = msg;
122
+ if (err) {
123
+ // err is an instance of Error class, it cannot be forwarded to sendTo, just get error code
124
+ result.error = err.code;
125
+ }
126
+ result.statusCode = 0;
127
+ this.adapter.sendTo(obj.from, obj.command, result, obj.callback);
128
+ },obj.message.zclSeqNum);
129
+ } catch (exception) {
130
+ // report exceptions
131
+ // happens for example if user tries to send write command but did not provide value/type
132
+ // or unsupported attribute was addressed.
133
+ const ZclStatusError = require('zigbee-herdsman/dist/zcl/zclStatusError').default;
134
+ if (exception instanceof ZclStatusError) {
135
+ const result = {};
136
+ result.msg = `Zigbee error ${exception.code} received!`;
137
+ result.statusCode = exception.code;
138
+ this.adapter.sendTo(obj.from, obj.command, result, obj.callback);
139
+ } else {
140
+ this.error('SendToZigbee failed! (' + exception + ')');
141
+ // exception (Error class) cannot be send to adapter, send string message instead!
142
+ this.adapter.sendTo(obj.from, obj.command, {msg: exception.message}, obj.callback);
143
+ }
144
+ }
145
+ }
146
+ }
147
+
148
+ module.exports = Developer;