iobroker.zigbee 1.6.16 → 1.6.17

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 (53) 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 +425 -424
  9. package/admin/adapter-settings.js +244 -244
  10. package/admin/admin.js +2926 -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 -1158
  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.js +26 -26
  18. package/admin/words.js +109 -108
  19. package/docs/de/readme.md +27 -27
  20. package/docs/en/readme.md +30 -30
  21. package/docs/flashing_via_arduino_(en).md +110 -110
  22. package/docs/ru/readme.md +28 -28
  23. package/docs/tutorial/groups-1.png +0 -0
  24. package/docs/tutorial/groups-2.png +0 -0
  25. package/docs/tutorial/tab-dev-1.png +0 -0
  26. package/io-package.json +367 -355
  27. package/lib/backup.js +132 -132
  28. package/lib/binding.js +325 -325
  29. package/lib/colors.js +460 -460
  30. package/lib/commands.js +501 -501
  31. package/lib/developer.js +148 -148
  32. package/lib/devices.js +3145 -3144
  33. package/lib/exclude.js +168 -168
  34. package/lib/exposes.js +803 -795
  35. package/lib/groups.js +342 -342
  36. package/lib/json.js +60 -60
  37. package/lib/networkmap.js +56 -56
  38. package/lib/ota.js +179 -179
  39. package/lib/rgb.js +255 -255
  40. package/lib/seriallist.js +37 -37
  41. package/lib/states.js +6416 -6407
  42. package/lib/statescontroller.js +627 -627
  43. package/lib/tools.js +54 -54
  44. package/lib/utils.js +151 -151
  45. package/lib/zbBaseExtension.js +36 -32
  46. package/lib/zbDelayedAction.js +152 -152
  47. package/lib/zbDeviceAvailability.js +321 -318
  48. package/lib/zbDeviceConfigure.js +152 -152
  49. package/lib/zbDeviceEvent.js +49 -49
  50. package/lib/zigbeecontroller.js +946 -946
  51. package/main.js +42 -3
  52. package/package.json +77 -77
  53. package/support/docgen.js +93 -93
@@ -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;