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
@@ -1,152 +1,152 @@
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
+ 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;