iobroker.zigbee 1.6.16 → 1.7.0

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 (55) 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 +378 -367
  9. package/admin/adapter-settings.js +244 -244
  10. package/admin/admin.js +2926 -2926
  11. package/admin/img/philips_ensis.png +0 -0
  12. package/admin/img/philips_hue_lom001.png +0 -0
  13. package/admin/index.html +159 -159
  14. package/admin/index_m.html +1161 -1158
  15. package/admin/moment.min.js +1 -1
  16. package/admin/shuffle.min.js +2 -2
  17. package/admin/tab_m.html +944 -944
  18. package/admin/vis-network.min.css +1 -1
  19. package/admin/vis-network.min.js +27 -26
  20. package/admin/words.js +112 -108
  21. package/docs/de/readme.md +27 -27
  22. package/docs/en/readme.md +30 -30
  23. package/docs/flashing_via_arduino_(en).md +110 -110
  24. package/docs/ru/readme.md +28 -28
  25. package/docs/tutorial/groups-1.png +0 -0
  26. package/docs/tutorial/groups-2.png +0 -0
  27. package/docs/tutorial/tab-dev-1.png +0 -0
  28. package/io-package.json +340 -355
  29. package/lib/backup.js +171 -133
  30. package/lib/binding.js +325 -325
  31. package/lib/colors.js +460 -460
  32. package/lib/commands.js +501 -501
  33. package/lib/developer.js +148 -148
  34. package/lib/devices.js +3145 -3144
  35. package/lib/exclude.js +168 -168
  36. package/lib/exposes.js +805 -795
  37. package/lib/groups.js +342 -342
  38. package/lib/json.js +60 -60
  39. package/lib/networkmap.js +56 -56
  40. package/lib/ota.js +179 -179
  41. package/lib/rgb.js +255 -255
  42. package/lib/seriallist.js +37 -37
  43. package/lib/states.js +6416 -6407
  44. package/lib/statescontroller.js +658 -627
  45. package/lib/tools.js +54 -54
  46. package/lib/utils.js +151 -151
  47. package/lib/zbBaseExtension.js +36 -32
  48. package/lib/zbDelayedAction.js +152 -152
  49. package/lib/zbDeviceAvailability.js +315 -318
  50. package/lib/zbDeviceConfigure.js +152 -152
  51. package/lib/zbDeviceEvent.js +49 -49
  52. package/lib/zigbeecontroller.js +946 -946
  53. package/main.js +22 -4
  54. package/package.json +3 -3
  55. 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;