iobroker.zigbee 1.8.10 → 1.8.13

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 (104) hide show
  1. package/LICENSE +21 -21
  2. package/README.md +417 -400
  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/img/Bild10.png +0 -0
  27. package/docs/de/img/Bild12.png +0 -0
  28. package/docs/de/img/Bild13.png +0 -0
  29. package/docs/de/img/Bild14.png +0 -0
  30. package/docs/de/img/Bild15.png +0 -0
  31. package/docs/de/img/Bild16.png +0 -0
  32. package/docs/de/img/Bild17.png +0 -0
  33. package/docs/de/img/Bild18.png +0 -0
  34. package/docs/de/img/Bild19.png +0 -0
  35. package/docs/de/img/Bild2.png +0 -0
  36. package/docs/de/img/Bild20.png +0 -0
  37. package/docs/de/img/Bild21.png +0 -0
  38. package/docs/de/img/Bild22.png +0 -0
  39. package/docs/de/img/Bild23.png +0 -0
  40. package/docs/de/img/Bild24.png +0 -0
  41. package/docs/de/img/Bild25.png +0 -0
  42. package/docs/de/img/Bild26.png +0 -0
  43. package/docs/de/img/Bild28.png +0 -0
  44. package/docs/de/img/Bild3.png +0 -0
  45. package/docs/de/img/Bild30.png +0 -0
  46. package/docs/de/img/Bild31.png +0 -0
  47. package/docs/de/img/Bild32.png +0 -0
  48. package/docs/de/img/Bild33.png +0 -0
  49. package/docs/de/img/Bild34.png +0 -0
  50. package/docs/de/img/Bild35.png +0 -0
  51. package/docs/de/img/Bild36.png +0 -0
  52. package/docs/de/img/Bild37.png +0 -0
  53. package/docs/de/img/Bild4.png +0 -0
  54. package/docs/de/img/Bild5.jpg +0 -0
  55. package/docs/de/img/Bild6.png +0 -0
  56. package/docs/de/img/Bild7.png +0 -0
  57. package/docs/de/img/Bild8.png +0 -0
  58. package/docs/de/img/Bild9.png +0 -0
  59. package/docs/de/img/software1.jpg +0 -0
  60. package/docs/de/img/sonoff.png +0 -0
  61. package/docs/de/readme.md +126 -27
  62. package/docs/en/img/Bild13.png +0 -0
  63. package/docs/en/img/Bild18.png +0 -0
  64. package/docs/en/img/Bild23.png +0 -0
  65. package/docs/en/img/Bild25.png +0 -0
  66. package/docs/en/img/Bild26.png +0 -0
  67. package/docs/en/img/Bild4.png +0 -0
  68. package/docs/en/img/Bild9.png +0 -0
  69. package/docs/en/img/software1.jpg +0 -0
  70. package/docs/en/readme.md +128 -30
  71. package/docs/flashing_via_arduino_(en).md +110 -110
  72. package/docs/ru/readme.md +28 -28
  73. package/docs/tutorial/groups-1.png +0 -0
  74. package/docs/tutorial/groups-2.png +0 -0
  75. package/docs/tutorial/tab-dev-1.png +0 -0
  76. package/io-package.json +32 -21
  77. package/lib/backup.js +171 -171
  78. package/lib/binding.js +319 -319
  79. package/lib/colors.js +465 -465
  80. package/lib/commands.js +534 -534
  81. package/lib/developer.js +145 -145
  82. package/lib/devices.js +3135 -3135
  83. package/lib/exclude.js +162 -162
  84. package/lib/exposes.js +913 -830
  85. package/lib/groups.js +345 -345
  86. package/lib/json.js +59 -59
  87. package/lib/networkmap.js +55 -55
  88. package/lib/ota.js +198 -195
  89. package/lib/rgb.js +297 -297
  90. package/lib/seriallist.js +48 -48
  91. package/lib/states.js +6420 -6420
  92. package/lib/statescontroller.js +672 -693
  93. package/lib/tools.js +54 -54
  94. package/lib/utils.js +163 -163
  95. package/lib/zbBaseExtension.js +36 -36
  96. package/lib/zbDelayedAction.js +144 -144
  97. package/lib/zbDeviceAvailability.js +319 -319
  98. package/lib/zbDeviceConfigure.js +147 -147
  99. package/lib/zbDeviceEvent.js +48 -48
  100. package/lib/zigbeecontroller.js +989 -989
  101. package/main.js +133 -123
  102. package/package.json +10 -10
  103. package/support/docgen.js +93 -93
  104. /package/admin/img/{paumann_spot.png → paulmann_spot.png} +0 -0
package/lib/developer.js CHANGED
@@ -1,145 +1,145 @@
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, err =>
42
- this.adapter.sendTo(obj.from, obj.command, err, obj.callback));
43
- break;
44
- case 'sendToZigbee':
45
- this.sendToZigbee(obj);
46
- break;
47
- case 'getLibData':
48
- // e.g. zcl lists
49
- this.getLibData(obj);
50
- break;
51
- }
52
- }
53
- }
54
-
55
- getLibData(obj) {
56
- const key = obj.message.key;
57
- const zcl = ZigbeeHerdsman.Zcl;
58
- const result = {};
59
- if (key === 'cidList') {
60
- result.list = zcl.Cluster;
61
- } else if (key === 'attrIdList') {
62
- const cid = obj.message.cid;
63
- result.list = zcl.Utils.getCluster(cid).attributes;
64
- } else if (key === 'cmdListFoundation') {
65
- result.list = zcl.Foundation;
66
- } else if (key === 'cmdListFunctional') {
67
- result.list = null;
68
- const cluster = zcl.Utils.getCluster(obj.message.cid);
69
- if (typeof cluster != 'undefined') {
70
- const extraCmd = cluster.commands;
71
- result.list = extraCmd;
72
- }
73
- } else if (key === 'respCodes') {
74
- result.list = zcl.Status;
75
- } else if (key === 'typeList') {
76
- result.list = zcl.DataType;
77
- } else {
78
- return;
79
- }
80
- result.key = key;
81
- this.adapter.sendTo(obj.from, obj.command, result, obj.callback);
82
- }
83
-
84
- async sendToZigbee(obj) {
85
- const zcl = ZigbeeHerdsman.Zcl;
86
- const devId = '0x' + obj.message.id.replace(this.adapter.namespace + '.', '');
87
- const ep = obj.message.ep ? obj.message.ep : null;
88
- const cid = obj.message.cid;
89
- const cmdType = obj.message.cmdType;
90
- let cmd;
91
- const zclData = obj.message.zclData;
92
- if (cmdType === 'functional') {
93
- cmd = zcl.Utils.getCluster(cid).getCommand(obj.message.cmd);
94
- } else if (cmdType === 'functionalResp') {
95
- cmd = zcl.Utils.getCluster(cid).getCommandResponse(obj.message.cmd);
96
- } else if (cmdType === 'foundation') {
97
- cmd = zcl.Utils.getGlobalCommand((obj.message.cmd));
98
- } else {
99
- this.adapter.sendTo(obj.from, obj.command, {localErr: 'Invalid cmdType'}, obj.callback);
100
- return;
101
- }
102
- const cfg = obj.message.hasOwnProperty('cfg') ? obj.message.cfg : null;
103
-
104
- const publishTarget = this.zbController.getDevice(devId) ? devId : this.zbController.getGroup(parseInt(devId));
105
- if (!publishTarget) {
106
- this.adapter.sendTo(obj.from, obj.command, {localErr: `Device or group ${devId} not found!`}, obj.callback);
107
- return;
108
- }
109
- if (!cid || !cmd) {
110
- this.adapter.sendTo(obj.from, obj.command, {localErr: 'Incomplete data (cid or cmd)'}, obj.callback);
111
- return;
112
- }
113
- this.debug(`Ready to send (ep: ${ep}, cid: ${cid}, cmd ${cmd.name}, zcl: ${JSON.stringify(zclData)})`);
114
- try {
115
- await this.zbController.publish(publishTarget, cid, cmd.name, zclData, cfg, ep, cmdType, (err, msg) => {
116
- // map err and msg in one object for sendTo
117
- const result = {};
118
- result.msg = msg;
119
- if (err) {
120
- // err is an instance of Error class, it cannot be forwarded to sendTo, just get error code
121
- result.error = err.code;
122
- }
123
- result.statusCode = 0;
124
- this.adapter.sendTo(obj.from, obj.command, result, obj.callback);
125
- }, obj.message.zclSeqNum);
126
- } catch (exception) {
127
- // report exceptions
128
- // happens for example if user tries to send write command but did not provide value/type
129
- // or unsupported attribute was addressed.
130
- const ZclStatusError = require('zigbee-herdsman/dist/zcl/zclStatusError').default;
131
- if (exception instanceof ZclStatusError) {
132
- const result = {};
133
- result.msg = `Zigbee error ${exception.code} received!`;
134
- result.statusCode = exception.code;
135
- this.adapter.sendTo(obj.from, obj.command, result, obj.callback);
136
- } else {
137
- this.error(`SendToZigbee failed! (${exception})`);
138
- // exception (Error class) cannot be sent to adapter, send string message instead!
139
- this.adapter.sendTo(obj.from, obj.command, {msg: exception.message}, obj.callback);
140
- }
141
- }
142
- }
143
- }
144
-
145
- 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, err =>
42
+ this.adapter.sendTo(obj.from, obj.command, err, obj.callback));
43
+ break;
44
+ case 'sendToZigbee':
45
+ this.sendToZigbee(obj);
46
+ break;
47
+ case 'getLibData':
48
+ // e.g. zcl lists
49
+ this.getLibData(obj);
50
+ break;
51
+ }
52
+ }
53
+ }
54
+
55
+ getLibData(obj) {
56
+ const key = obj.message.key;
57
+ const zcl = ZigbeeHerdsman.Zcl;
58
+ const result = {};
59
+ if (key === 'cidList') {
60
+ result.list = zcl.Cluster;
61
+ } else if (key === 'attrIdList') {
62
+ const cid = obj.message.cid;
63
+ result.list = zcl.Utils.getCluster(cid).attributes;
64
+ } else if (key === 'cmdListFoundation') {
65
+ result.list = zcl.Foundation;
66
+ } else if (key === 'cmdListFunctional') {
67
+ result.list = null;
68
+ const cluster = zcl.Utils.getCluster(obj.message.cid);
69
+ if (typeof cluster != 'undefined') {
70
+ const extraCmd = cluster.commands;
71
+ result.list = extraCmd;
72
+ }
73
+ } else if (key === 'respCodes') {
74
+ result.list = zcl.Status;
75
+ } else if (key === 'typeList') {
76
+ result.list = zcl.DataType;
77
+ } else {
78
+ return;
79
+ }
80
+ result.key = key;
81
+ this.adapter.sendTo(obj.from, obj.command, result, obj.callback);
82
+ }
83
+
84
+ async sendToZigbee(obj) {
85
+ const zcl = ZigbeeHerdsman.Zcl;
86
+ const devId = '0x' + obj.message.id.replace(this.adapter.namespace + '.', '');
87
+ const ep = obj.message.ep ? obj.message.ep : null;
88
+ const cid = obj.message.cid;
89
+ const cmdType = obj.message.cmdType;
90
+ let cmd;
91
+ const zclData = obj.message.zclData;
92
+ if (cmdType === 'functional') {
93
+ cmd = zcl.Utils.getCluster(cid).getCommand(obj.message.cmd);
94
+ } else if (cmdType === 'functionalResp') {
95
+ cmd = zcl.Utils.getCluster(cid).getCommandResponse(obj.message.cmd);
96
+ } else if (cmdType === 'foundation') {
97
+ cmd = zcl.Utils.getGlobalCommand((obj.message.cmd));
98
+ } else {
99
+ this.adapter.sendTo(obj.from, obj.command, {localErr: 'Invalid cmdType'}, obj.callback);
100
+ return;
101
+ }
102
+ const cfg = obj.message.hasOwnProperty('cfg') ? obj.message.cfg : null;
103
+
104
+ const publishTarget = this.zbController.getDevice(devId) ? devId : this.zbController.getGroup(parseInt(devId));
105
+ if (!publishTarget) {
106
+ this.adapter.sendTo(obj.from, obj.command, {localErr: `Device or group ${devId} not found!`}, obj.callback);
107
+ return;
108
+ }
109
+ if (!cid || !cmd) {
110
+ this.adapter.sendTo(obj.from, obj.command, {localErr: 'Incomplete data (cid or cmd)'}, obj.callback);
111
+ return;
112
+ }
113
+ this.debug(`Ready to send (ep: ${ep}, cid: ${cid}, cmd ${cmd.name}, zcl: ${JSON.stringify(zclData)})`);
114
+ try {
115
+ await this.zbController.publish(publishTarget, cid, cmd.name, zclData, cfg, ep, cmdType, (err, msg) => {
116
+ // map err and msg in one object for sendTo
117
+ const result = {};
118
+ result.msg = msg;
119
+ if (err) {
120
+ // err is an instance of Error class, it cannot be forwarded to sendTo, just get error code
121
+ result.error = err.code;
122
+ }
123
+ result.statusCode = 0;
124
+ this.adapter.sendTo(obj.from, obj.command, result, obj.callback);
125
+ }, obj.message.zclSeqNum);
126
+ } catch (exception) {
127
+ // report exceptions
128
+ // happens for example if user tries to send write command but did not provide value/type
129
+ // or unsupported attribute was addressed.
130
+ const ZclStatusError = require('zigbee-herdsman/dist/zcl/zclStatusError').default;
131
+ if (exception instanceof ZclStatusError) {
132
+ const result = {};
133
+ result.msg = `Zigbee error ${exception.code} received!`;
134
+ result.statusCode = exception.code;
135
+ this.adapter.sendTo(obj.from, obj.command, result, obj.callback);
136
+ } else {
137
+ this.error(`SendToZigbee failed! (${exception})`);
138
+ // exception (Error class) cannot be sent to adapter, send string message instead!
139
+ this.adapter.sendTo(obj.from, obj.command, {msg: exception.message}, obj.callback);
140
+ }
141
+ }
142
+ }
143
+ }
144
+
145
+ module.exports = Developer;