iobroker.zigbee 1.7.6 → 1.8.1

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 (97) hide show
  1. package/LICENSE +21 -21
  2. package/README.md +368 -381
  3. package/admin/admin.js +2951 -2927
  4. package/admin/i18n/de/translations.json +108 -0
  5. package/admin/i18n/en/translations.json +108 -0
  6. package/admin/i18n/es/translations.json +102 -0
  7. package/admin/i18n/fr/translations.json +108 -0
  8. package/admin/i18n/it/translations.json +102 -0
  9. package/admin/i18n/nl/translations.json +108 -0
  10. package/admin/i18n/pl/translations.json +108 -0
  11. package/admin/i18n/pt/translations.json +102 -0
  12. package/admin/i18n/ru/translations.json +108 -0
  13. package/admin/i18n/uk/translations.json +108 -0
  14. package/admin/i18n/zh-cn/translations.json +102 -0
  15. package/admin/img/philips_hue_lom001.png +0 -0
  16. package/admin/index.html +159 -159
  17. package/admin/index_m.html +1161 -1161
  18. package/admin/moment.min.js +1 -1
  19. package/admin/shuffle.min.js +2 -2
  20. package/admin/tab_m.html +985 -944
  21. package/admin/vis-network.min.css +1 -1
  22. package/admin/vis-network.min.js +27 -27
  23. package/admin/words.js +110 -110
  24. package/docs/de/img/CC2531.png +0 -0
  25. package/docs/de/img/CC2538_CC2592_PA.PNG +0 -0
  26. package/docs/de/img/CC2591.png +0 -0
  27. package/docs/de/img/boards.jpg +0 -0
  28. package/docs/de/img/cc26x2r.PNG +0 -0
  29. package/docs/de/img/results.jpg +0 -0
  30. package/docs/de/img/sku_429478_2.png +0 -0
  31. package/docs/de/img/sku_429601_2.png +0 -0
  32. package/docs/de/readme.md +27 -0
  33. package/docs/en/img/CC2531.png +0 -0
  34. package/docs/en/img/CC2591.png +0 -0
  35. package/docs/en/img/deconz.png +0 -0
  36. package/docs/en/img/sku_429478_2.png +0 -0
  37. package/docs/en/img/sku_429601_2.png +0 -0
  38. package/docs/en/readme.md +30 -0
  39. package/docs/flashing_via_arduino_(en).md +110 -0
  40. package/docs/ru/img/CC2531.png +0 -0
  41. package/docs/ru/img/CC2591.png +0 -0
  42. package/docs/ru/img/sku_429478_2.png +0 -0
  43. package/docs/ru/img/sku_429601_2.png +0 -0
  44. package/docs/ru/readme.md +28 -0
  45. package/docs/tutorial/CC2530_20190425.zip +0 -0
  46. package/docs/tutorial/CC2530_CC2591_20190515.zip +0 -0
  47. package/docs/tutorial/CC2530_CC2592_20190515.zip +0 -0
  48. package/docs/tutorial/CC2531_20190425.zip +0 -0
  49. package/docs/tutorial/adm5_1.PNG +0 -0
  50. package/docs/tutorial/adm5_2.PNG +0 -0
  51. package/docs/tutorial/cat.PNG +0 -0
  52. package/docs/tutorial/groups-1.png +0 -0
  53. package/docs/tutorial/groups-2.png +0 -0
  54. package/docs/tutorial/inst.PNG +0 -0
  55. package/docs/tutorial/reflash-finish.PNG +0 -0
  56. package/docs/tutorial/reflash-step0.png +0 -0
  57. package/docs/tutorial/reflash-step1.PNG +0 -0
  58. package/docs/tutorial/reflash-step2.PNG +0 -0
  59. package/docs/tutorial/settings.png +0 -0
  60. package/docs/tutorial/tab-dev-1.png +0 -0
  61. package/docs/tutorial/zigbee.png +0 -0
  62. package/docs/tutorial/zigbee15.png +0 -0
  63. package/io-package.json +335 -370
  64. package/lib/backup.js +171 -171
  65. package/lib/binding.js +320 -325
  66. package/lib/colors.js +465 -460
  67. package/lib/commands.js +510 -501
  68. package/lib/developer.js +145 -148
  69. package/lib/devices.js +3135 -3145
  70. package/lib/exclude.js +162 -168
  71. package/lib/exposes.js +828 -804
  72. package/lib/groups.js +340 -342
  73. package/lib/json.js +59 -60
  74. package/lib/networkmap.js +55 -56
  75. package/lib/ota.js +195 -179
  76. package/lib/rgb.js +297 -255
  77. package/lib/seriallist.js +48 -37
  78. package/lib/states.js +6405 -6416
  79. package/lib/statescontroller.js +693 -670
  80. package/lib/tools.js +54 -54
  81. package/lib/utils.js +152 -151
  82. package/lib/zbBaseExtension.js +36 -36
  83. package/lib/zbDelayedAction.js +144 -152
  84. package/lib/zbDeviceAvailability.js +319 -315
  85. package/lib/zbDeviceConfigure.js +147 -159
  86. package/lib/zbDeviceEvent.js +48 -49
  87. package/lib/zigbeecontroller.js +957 -951
  88. package/main.js +163 -147
  89. package/package.json +33 -19
  90. package/support/docgen.js +93 -93
  91. package/.eslintignore +0 -2
  92. package/.eslintrc.json +0 -37
  93. package/.github/FUNDING.yml +0 -3
  94. package/.github/stale.yml +0 -13
  95. package/.github/workflows/test-and-release.yml +0 -151
  96. package/.travis/wiki.sh +0 -28
  97. package/admin/adapter-settings.js +0 -244
@@ -1,152 +1,144 @@
1
- 'use strict';
2
-
3
- const BaseExtension = require('./zbBaseExtension');
4
-
5
- class DelayedAction extends BaseExtension {
6
- constructor(zigbee, options) {
7
- super(zigbee, options);
8
-
9
- this.actions = {};
10
- this.zigbee.delayAction = this.delayAction.bind(this);
11
- this.name = "DelayedAction";
12
- }
13
-
14
- setOptions(options) {
15
- if (typeof(options) != 'object') return false;
16
- return true;
17
- }
18
-
19
-
20
- shouldAction(device) {
21
- if (!device) {
22
- return false;
23
- }
24
-
25
- // if (device.meta.hasOwnProperty('configured') && device.meta.configured === mappedDevice.meta.configureKey) {
26
- // return false;
27
- // }
28
-
29
- // if (!mappedDevice || !mappedDevice.configure) {
30
- // return false;
31
- // }
32
-
33
- if (device.interviewing === true) {
34
- return false;
35
- }
36
-
37
- return true;
38
- }
39
-
40
- async onZigbeeStarted() {
41
- try {
42
- this.coordinatorEndpoint = await this.zigbee.getDevicesByType('Coordinator')[0].endpoints[0];
43
-
44
- // for (const device of await this.zigbee.getClients()) {
45
- // const mappedDevice = zigbeeHerdsmanConverters.findByDevice(device);
46
- // this.debug(`shouldAction? ${device.ieeeAddr} ${device.modelID}`);
47
- // if (this.shouldAction(device, mappedDevice)) {
48
- // this.debug(`Yes!`);
49
- // await this.doActions(device, mappedDevice);
50
- // }
51
- // }
52
- } catch (error) {
53
- this.sendError(error);
54
- this.error(
55
- `Failed to DelayedAction.onZigbeeStarted (${error.stack})`,
56
- );
57
- }
58
- }
59
-
60
- onZigbeeEvent(data) {
61
- try {
62
- const device = data.device;
63
- // if (this.shouldAction(device, mappedDevice)) {
64
- this.doActions(device);
65
- // }
66
- } catch (error) {
67
- this.sendError(error);
68
- this.error(
69
- `Failed to DelayedAction.onZigbeeEvent (${error.stack})`,
70
- );
71
- }
72
- }
73
-
74
- delayAction(device, action) {
75
- try {
76
- if (!this.actions.hasOwnProperty(device.ieeeAddr)) {
77
- this.actions[device.ieeeAddr] = [];
78
- }
79
- this.actions[device.ieeeAddr].push({
80
- attempts: 0,
81
- action: action,
82
- });
83
- this.debug(`Succesfully delay action for ${device.ieeeAddr} ${device.modelID}`);
84
- this.doActions(device);
85
- } catch (error) {
86
- this.sendError(error);
87
- this.error(
88
- `Failed to DelayedAction.delayAction ${device.ieeeAddr} ${device.modelID} (${error.stack})`,
89
- );
90
- }
91
- }
92
-
93
- async doActions(device) {
94
- try {
95
- if (!this.actions.hasOwnProperty(device.ieeeAddr)) {
96
- return;
97
- }
98
- const foundDev = await this.zigbee.getDevice(device.ieeeAddr);
99
- if (!foundDev) {
100
- this.debug(
101
- `No found device ${device.ieeeAddr} ${device.modelID}, ` +
102
- `for doAction`
103
- );
104
- delete this.actions[device.ieeeAddr];
105
- return;
106
- }
107
-
108
- const deviceActions = this.actions[device.ieeeAddr];
109
- const toDelete = [];
110
- for (const actionDef of deviceActions) {
111
- if (actionDef.inAction) {
112
- continue;
113
- }
114
- if (actionDef.attempts >= 3) {
115
- toDelete.push(actionDef);
116
- continue;
117
- }
118
- actionDef.inAction = true;
119
- this.info(`Do action on ${device.ieeeAddr} ${device.modelID}`);
120
- try {
121
- // do action
122
- await actionDef.action(device);
123
- this.info(`Do action succesfully ${device.ieeeAddr} ${device.modelID}`);
124
- toDelete.push(actionDef);
125
- } catch (error) {
126
- this.sendError(error);
127
- this.error(
128
- `Failed to do action ${device.ieeeAddr} ${device.modelID}, ` +
129
- `attempt ${actionDef.attempts + 1} (${error.stack})`,
130
- );
131
- actionDef.attempts++;
132
- } finally {
133
- actionDef.inAction = false;
134
- }
135
- }
136
- for (const actionDef of toDelete) {
137
- const ind = this.actions[device.ieeeAddr].indexOf(actionDef);
138
- this.actions[device.ieeeAddr].splice(ind, 1);
139
- }
140
- if (this.actions[device.ieeeAddr].length === 0) {
141
- delete this.actions[device.ieeeAddr];
142
- }
143
- } catch (error) {
144
- this.sendError(error);
145
- this.error(
146
- `Failed to DelayedAction.doAction ${device.ieeeAddr} ${device.modelID} (${error.stack})`,
147
- );
148
- }
149
- }
150
- }
151
-
152
- module.exports = DelayedAction;
1
+ 'use strict';
2
+
3
+ const BaseExtension = require('./zbBaseExtension');
4
+
5
+ class DelayedAction extends BaseExtension {
6
+ constructor(zigbee, options) {
7
+ super(zigbee, options);
8
+
9
+ this.actions = {};
10
+ this.zigbee.delayAction = this.delayAction.bind(this);
11
+ this.name = 'DelayedAction';
12
+ }
13
+
14
+ setOptions(options) {
15
+ return typeof options === 'object';
16
+ }
17
+
18
+
19
+ shouldAction(device) {
20
+ if (!device) {
21
+ return false;
22
+ }
23
+
24
+ // if (device.meta.hasOwnProperty('configured') && device.meta.configured === mappedDevice.meta.configureKey) {
25
+ // return false;
26
+ // }
27
+
28
+ // if (!mappedDevice || !mappedDevice.configure) {
29
+ // return false;
30
+ // }
31
+
32
+ return device.interviewing !== true;
33
+ }
34
+
35
+ async onZigbeeStarted() {
36
+ try {
37
+ this.coordinatorEndpoint = await this.zigbee.getDevicesByType('Coordinator')[0].endpoints[0];
38
+
39
+ // for (const device of await this.zigbee.getClients()) {
40
+ // const mappedDevice = zigbeeHerdsmanConverters.findByDevice(device);
41
+ // this.debug(`shouldAction? ${device.ieeeAddr} ${device.modelID}`);
42
+ // if (this.shouldAction(device, mappedDevice)) {
43
+ // this.debug(`Yes!`);
44
+ // await this.doActions(device, mappedDevice);
45
+ // }
46
+ // }
47
+ } catch (error) {
48
+ this.sendError(error);
49
+ this.error(
50
+ `Failed to DelayedAction.onZigbeeStarted (${error.stack})`,
51
+ );
52
+ }
53
+ }
54
+
55
+ onZigbeeEvent(data) {
56
+ try {
57
+ const device = data.device;
58
+ // if (this.shouldAction(device, mappedDevice)) {
59
+ this.doActions(device);
60
+ // }
61
+ } catch (error) {
62
+ this.sendError(error);
63
+ this.error(
64
+ `Failed to DelayedAction.onZigbeeEvent (${error.stack})`,
65
+ );
66
+ }
67
+ }
68
+
69
+ delayAction(device, action) {
70
+ try {
71
+ if (!this.actions.hasOwnProperty(device.ieeeAddr)) {
72
+ this.actions[device.ieeeAddr] = [];
73
+ }
74
+ this.actions[device.ieeeAddr].push({
75
+ attempts: 0,
76
+ action: action,
77
+ });
78
+ this.debug(`Succesfully delay action for ${device.ieeeAddr} ${device.modelID}`);
79
+ this.doActions(device);
80
+ } catch (error) {
81
+ this.sendError(error);
82
+ this.error(
83
+ `Failed to DelayedAction.delayAction ${device.ieeeAddr} ${device.modelID} (${error.stack})`,
84
+ );
85
+ }
86
+ }
87
+
88
+ async doActions(device) {
89
+ try {
90
+ if (!this.actions.hasOwnProperty(device.ieeeAddr)) {
91
+ return;
92
+ }
93
+ const foundDev = await this.zigbee.getDevice(device.ieeeAddr);
94
+ if (!foundDev) {
95
+ this.debug(`No found device ${device.ieeeAddr} ${device.modelID}, for doAction`);
96
+ delete this.actions[device.ieeeAddr];
97
+ return;
98
+ }
99
+
100
+ const deviceActions = this.actions[device.ieeeAddr];
101
+ const toDelete = [];
102
+ for (const actionDef of deviceActions) {
103
+ if (actionDef.inAction) {
104
+ continue;
105
+ }
106
+ if (actionDef.attempts >= 3) {
107
+ toDelete.push(actionDef);
108
+ continue;
109
+ }
110
+ actionDef.inAction = true;
111
+ this.info(`Do action on ${device.ieeeAddr} ${device.modelID}`);
112
+ try {
113
+ // do action
114
+ await actionDef.action(device);
115
+ this.info(`Do action successfully ${device.ieeeAddr} ${device.modelID}`);
116
+ toDelete.push(actionDef);
117
+ } catch (error) {
118
+ this.sendError(error);
119
+ this.error(
120
+ `Failed to do action ${device.ieeeAddr} ${device.modelID}, ` +
121
+ `attempt ${actionDef.attempts + 1} (${error.stack})`,
122
+ );
123
+ actionDef.attempts++;
124
+ } finally {
125
+ actionDef.inAction = false;
126
+ }
127
+ }
128
+ for (const actionDef of toDelete) {
129
+ const ind = this.actions[device.ieeeAddr].indexOf(actionDef);
130
+ this.actions[device.ieeeAddr].splice(ind, 1);
131
+ }
132
+ if (this.actions[device.ieeeAddr].length === 0) {
133
+ delete this.actions[device.ieeeAddr];
134
+ }
135
+ } catch (error) {
136
+ this.sendError(error);
137
+ this.error(
138
+ `Failed to DelayedAction.doAction ${device.ieeeAddr} ${device.modelID} (${error.stack})`,
139
+ );
140
+ }
141
+ }
142
+ }
143
+
144
+ module.exports = DelayedAction;