iobroker.zigbee 1.6.8 → 1.6.16

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 (64) 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 +424 -385
  9. package/admin/adapter-settings.js +244 -244
  10. package/admin/admin.js +2926 -2704
  11. package/admin/img/14153905L.png +0 -0
  12. package/admin/img/81855.png +0 -0
  13. package/admin/img/HG06338.png +0 -0
  14. package/admin/img/TI0001-cover.png +0 -0
  15. package/admin/img/philips_hue_lom001.png +0 -0
  16. package/admin/index.html +159 -159
  17. package/admin/index_m.html +1158 -1055
  18. package/admin/moment.min.js +1 -1
  19. package/admin/shuffle.min.js +2 -2
  20. package/admin/tab_m.html +944 -1025
  21. package/admin/vis-network.min.js +26 -26
  22. package/admin/words.js +108 -107
  23. package/docs/de/readme.md +27 -27
  24. package/docs/en/readme.md +30 -30
  25. package/docs/flashing_via_arduino_(en).md +110 -110
  26. package/docs/ru/readme.md +28 -28
  27. package/docs/tutorial/groups-1.png +0 -0
  28. package/docs/tutorial/groups-2.png +0 -0
  29. package/docs/tutorial/tab-dev-1.png +0 -0
  30. package/docs/tutorial/zigbee.png +0 -0
  31. package/io-package.json +355 -317
  32. package/lib/backup.js +132 -132
  33. package/lib/binding.js +325 -325
  34. package/lib/colors.js +460 -460
  35. package/lib/commands.js +501 -435
  36. package/lib/developer.js +148 -148
  37. package/lib/devices.js +3144 -3119
  38. package/lib/exclude.js +168 -168
  39. package/lib/exposes.js +13 -9
  40. package/lib/groups.js +342 -316
  41. package/lib/json.js +60 -60
  42. package/lib/networkmap.js +56 -56
  43. package/lib/ota.js +179 -153
  44. package/lib/rgb.js +255 -225
  45. package/lib/seriallist.js +37 -37
  46. package/lib/states.js +6407 -6381
  47. package/lib/statescontroller.js +627 -502
  48. package/lib/tools.js +54 -54
  49. package/lib/utils.js +151 -151
  50. package/lib/zbBaseExtension.js +32 -31
  51. package/lib/zbDelayedAction.js +152 -151
  52. package/lib/zbDeviceAvailability.js +318 -306
  53. package/lib/zbDeviceConfigure.js +152 -148
  54. package/lib/zbDeviceEvent.js +49 -43
  55. package/lib/zigbeecontroller.js +946 -856
  56. package/main.js +8 -4
  57. package/package.json +77 -74
  58. package/support/docgen.js +93 -93
  59. package/.devcontainer/devcontainer.json +0 -36
  60. package/.devcontainer/docker-compose.yml +0 -51
  61. package/.devcontainer/iobroker/Dockerfile +0 -2
  62. package/.devcontainer/nginx/nginx.conf +0 -33
  63. package/.devcontainer/parcel/Dockerfile +0 -9
  64. package/.devcontainer/parcel/run.sh +0 -7
@@ -1,151 +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
- }
12
-
13
- setOptions(options) {
14
- if (typeof(options) != 'object') return false;
15
- return true;
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
- if (device.interviewing === true) {
33
- return false;
34
- }
35
-
36
- return true;
37
- }
38
-
39
- async onZigbeeStarted() {
40
- try {
41
- this.coordinatorEndpoint = await this.zigbee.getDevicesByType('Coordinator')[0].endpoints[0];
42
-
43
- // for (const device of await this.zigbee.getClients()) {
44
- // const mappedDevice = zigbeeHerdsmanConverters.findByDevice(device);
45
- // this.debug(`shouldAction? ${device.ieeeAddr} ${device.modelID}`);
46
- // if (this.shouldAction(device, mappedDevice)) {
47
- // this.debug(`Yes!`);
48
- // await this.doActions(device, mappedDevice);
49
- // }
50
- // }
51
- } catch (error) {
52
- this.sendError(error);
53
- this.error(
54
- `Failed to DelayedAction.onZigbeeStarted (${error.stack})`,
55
- );
56
- }
57
- }
58
-
59
- onZigbeeEvent(data) {
60
- try {
61
- const device = data.device;
62
- // if (this.shouldAction(device, mappedDevice)) {
63
- this.doActions(device);
64
- // }
65
- } catch (error) {
66
- this.sendError(error);
67
- this.error(
68
- `Failed to DelayedAction.onZigbeeEvent (${error.stack})`,
69
- );
70
- }
71
- }
72
-
73
- delayAction(device, action) {
74
- try {
75
- if (!this.actions.hasOwnProperty(device.ieeeAddr)) {
76
- this.actions[device.ieeeAddr] = [];
77
- }
78
- this.actions[device.ieeeAddr].push({
79
- attempts: 0,
80
- action: action,
81
- });
82
- this.debug(`Succesfully delay action for ${device.ieeeAddr} ${device.modelID}`);
83
- this.doActions(device);
84
- } catch (error) {
85
- this.sendError(error);
86
- this.error(
87
- `Failed to DelayedAction.delayAction ${device.ieeeAddr} ${device.modelID} (${error.stack})`,
88
- );
89
- }
90
- }
91
-
92
- async doActions(device) {
93
- try {
94
- if (!this.actions.hasOwnProperty(device.ieeeAddr)) {
95
- return;
96
- }
97
- const foundDev = await this.zigbee.getDevice(device.ieeeAddr);
98
- if (!foundDev) {
99
- this.debug(
100
- `No found device ${device.ieeeAddr} ${device.modelID}, ` +
101
- `for doAction`
102
- );
103
- delete this.actions[device.ieeeAddr];
104
- return;
105
- }
106
-
107
- const deviceActions = this.actions[device.ieeeAddr];
108
- const toDelete = [];
109
- for (const actionDef of deviceActions) {
110
- if (actionDef.inAction) {
111
- continue;
112
- }
113
- if (actionDef.attempts >= 3) {
114
- toDelete.push(actionDef);
115
- continue;
116
- }
117
- actionDef.inAction = true;
118
- this.info(`Do action on ${device.ieeeAddr} ${device.modelID}`);
119
- try {
120
- // do action
121
- await actionDef.action(device);
122
- this.info(`Do action succesfully ${device.ieeeAddr} ${device.modelID}`);
123
- toDelete.push(actionDef);
124
- } catch (error) {
125
- this.sendError(error);
126
- this.error(
127
- `Failed to do action ${device.ieeeAddr} ${device.modelID}, ` +
128
- `attempt ${actionDef.attempts + 1} (${error.stack})`,
129
- );
130
- actionDef.attempts++;
131
- } finally {
132
- actionDef.inAction = false;
133
- }
134
- }
135
- for (const actionDef of toDelete) {
136
- const ind = this.actions[device.ieeeAddr].indexOf(actionDef);
137
- this.actions[device.ieeeAddr].splice(ind, 1);
138
- }
139
- if (this.actions[device.ieeeAddr].length === 0) {
140
- delete this.actions[device.ieeeAddr];
141
- }
142
- } catch (error) {
143
- this.sendError(error);
144
- this.error(
145
- `Failed to DelayedAction.doAction ${device.ieeeAddr} ${device.modelID} (${error.stack})`,
146
- );
147
- }
148
- }
149
- }
150
-
151
- 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;