iobroker.zigbee 1.5.6 → 1.6.8

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