iobroker.zigbee 1.8.18 → 1.8.19
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.
- package/LICENSE +21 -21
- package/README.md +418 -415
- package/admin/adapter-settings.js +244 -244
- package/admin/admin.js +2981 -2981
- package/admin/i18n/de/translations.json +108 -108
- package/admin/i18n/en/translations.json +108 -108
- package/admin/i18n/es/translations.json +102 -102
- package/admin/i18n/fr/translations.json +108 -108
- package/admin/i18n/it/translations.json +102 -102
- package/admin/i18n/nl/translations.json +108 -108
- package/admin/i18n/pl/translations.json +108 -108
- package/admin/i18n/pt/translations.json +102 -102
- package/admin/i18n/ru/translations.json +108 -108
- package/admin/i18n/uk/translations.json +108 -108
- package/admin/i18n/zh-cn/translations.json +102 -102
- package/admin/img/philips_hue_lom001.png +0 -0
- package/admin/index.html +159 -159
- package/admin/index_m.html +1356 -1356
- package/admin/moment.min.js +1 -1
- package/admin/shuffle.min.js +2 -2
- package/admin/tab_m.html +1009 -1009
- package/admin/vis-network.min.css +1 -1
- package/admin/vis-network.min.js +27 -27
- package/admin/words.js +110 -110
- package/docs/de/basedocu.md +19 -19
- package/docs/de/readme.md +126 -126
- package/docs/en/readme.md +128 -128
- package/docs/flashing_via_arduino_(en).md +110 -110
- package/docs/ru/readme.md +28 -28
- package/docs/tutorial/groups-1.png +0 -0
- package/docs/tutorial/groups-2.png +0 -0
- package/docs/tutorial/tab-dev-1.png +0 -0
- package/io-package.json +14 -5
- package/lib/backup.js +171 -171
- package/lib/binding.js +319 -319
- package/lib/colors.js +465 -465
- package/lib/commands.js +534 -534
- package/lib/developer.js +145 -145
- package/lib/devices.js +3135 -3135
- package/lib/exclude.js +162 -162
- package/lib/exposes.js +913 -913
- package/lib/groups.js +345 -345
- package/lib/json.js +59 -59
- package/lib/networkmap.js +55 -55
- package/lib/ota.js +198 -198
- package/lib/rgb.js +297 -297
- package/lib/seriallist.js +48 -48
- package/lib/states.js +6420 -6420
- package/lib/statescontroller.js +672 -672
- package/lib/tools.js +54 -54
- package/lib/utils.js +163 -163
- package/lib/zbBaseExtension.js +36 -36
- package/lib/zbDelayedAction.js +144 -144
- package/lib/zbDeviceAvailability.js +319 -319
- package/lib/zbDeviceConfigure.js +147 -147
- package/lib/zbDeviceEvent.js +48 -48
- package/lib/zigbeecontroller.js +989 -989
- package/main.js +60 -35
- package/package.json +6 -4
- package/support/docgen.js +93 -93
package/lib/zbDelayedAction.js
CHANGED
|
@@ -1,144 +1,144 @@
|
|
|
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
|
-
return typeof options === 'object';
|
|
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
|
-
return device.interviewing !== true;
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
async onZigbeeStarted() {
|
|
36
|
-
try {
|
|
37
|
-
this.coordinatorEndpoint = await this.zigbee.getDevicesByType('Coordinator')[0].endpoints[0];
|
|
38
|
-
|
|
39
|
-
// for (const device of await this.zigbee.getClients()) {
|
|
40
|
-
// const mappedDevice = zigbeeHerdsmanConverters.findByDevice(device);
|
|
41
|
-
// this.debug(`shouldAction? ${device.ieeeAddr} ${device.modelID}`);
|
|
42
|
-
// if (this.shouldAction(device, mappedDevice)) {
|
|
43
|
-
// this.debug(`Yes!`);
|
|
44
|
-
// await this.doActions(device, mappedDevice);
|
|
45
|
-
// }
|
|
46
|
-
// }
|
|
47
|
-
} catch (error) {
|
|
48
|
-
this.sendError(error);
|
|
49
|
-
this.error(
|
|
50
|
-
`Failed to DelayedAction.onZigbeeStarted (${error.stack})`,
|
|
51
|
-
);
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
onZigbeeEvent(data) {
|
|
56
|
-
try {
|
|
57
|
-
const device = data.device;
|
|
58
|
-
// if (this.shouldAction(device, mappedDevice)) {
|
|
59
|
-
this.doActions(device);
|
|
60
|
-
// }
|
|
61
|
-
} catch (error) {
|
|
62
|
-
this.sendError(error);
|
|
63
|
-
this.error(
|
|
64
|
-
`Failed to DelayedAction.onZigbeeEvent (${error.stack})`,
|
|
65
|
-
);
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
delayAction(device, action) {
|
|
70
|
-
try {
|
|
71
|
-
if (!this.actions.hasOwnProperty(device.ieeeAddr)) {
|
|
72
|
-
this.actions[device.ieeeAddr] = [];
|
|
73
|
-
}
|
|
74
|
-
this.actions[device.ieeeAddr].push({
|
|
75
|
-
attempts: 0,
|
|
76
|
-
action: action,
|
|
77
|
-
});
|
|
78
|
-
this.debug(`Succesfully delay action for ${device.ieeeAddr} ${device.modelID}`);
|
|
79
|
-
this.doActions(device);
|
|
80
|
-
} catch (error) {
|
|
81
|
-
this.sendError(error);
|
|
82
|
-
this.error(
|
|
83
|
-
`Failed to DelayedAction.delayAction ${device.ieeeAddr} ${device.modelID} (${error.stack})`,
|
|
84
|
-
);
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
async doActions(device) {
|
|
89
|
-
try {
|
|
90
|
-
if (!this.actions.hasOwnProperty(device.ieeeAddr)) {
|
|
91
|
-
return;
|
|
92
|
-
}
|
|
93
|
-
const foundDev = await this.zigbee.getDevice(device.ieeeAddr);
|
|
94
|
-
if (!foundDev) {
|
|
95
|
-
this.debug(`No found device ${device.ieeeAddr} ${device.modelID}, for doAction`);
|
|
96
|
-
delete this.actions[device.ieeeAddr];
|
|
97
|
-
return;
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
const deviceActions = this.actions[device.ieeeAddr];
|
|
101
|
-
const toDelete = [];
|
|
102
|
-
for (const actionDef of deviceActions) {
|
|
103
|
-
if (actionDef.inAction) {
|
|
104
|
-
continue;
|
|
105
|
-
}
|
|
106
|
-
if (actionDef.attempts >= 3) {
|
|
107
|
-
toDelete.push(actionDef);
|
|
108
|
-
continue;
|
|
109
|
-
}
|
|
110
|
-
actionDef.inAction = true;
|
|
111
|
-
this.info(`Do action on ${device.ieeeAddr} ${device.modelID}`);
|
|
112
|
-
try {
|
|
113
|
-
// do action
|
|
114
|
-
await actionDef.action(device);
|
|
115
|
-
this.info(`Do action successfully ${device.ieeeAddr} ${device.modelID}`);
|
|
116
|
-
toDelete.push(actionDef);
|
|
117
|
-
} catch (error) {
|
|
118
|
-
this.sendError(error);
|
|
119
|
-
this.error(
|
|
120
|
-
`Failed to do action ${device.ieeeAddr} ${device.modelID}, ` +
|
|
121
|
-
`attempt ${actionDef.attempts + 1} (${error.stack})`,
|
|
122
|
-
);
|
|
123
|
-
actionDef.attempts++;
|
|
124
|
-
} finally {
|
|
125
|
-
actionDef.inAction = false;
|
|
126
|
-
}
|
|
127
|
-
}
|
|
128
|
-
for (const actionDef of toDelete) {
|
|
129
|
-
const ind = this.actions[device.ieeeAddr].indexOf(actionDef);
|
|
130
|
-
this.actions[device.ieeeAddr].splice(ind, 1);
|
|
131
|
-
}
|
|
132
|
-
if (this.actions[device.ieeeAddr].length === 0) {
|
|
133
|
-
delete this.actions[device.ieeeAddr];
|
|
134
|
-
}
|
|
135
|
-
} catch (error) {
|
|
136
|
-
this.sendError(error);
|
|
137
|
-
this.error(
|
|
138
|
-
`Failed to DelayedAction.doAction ${device.ieeeAddr} ${device.modelID} (${error.stack})`,
|
|
139
|
-
);
|
|
140
|
-
}
|
|
141
|
-
}
|
|
142
|
-
}
|
|
143
|
-
|
|
144
|
-
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
|
+
return typeof options === 'object';
|
|
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
|
+
return device.interviewing !== true;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
async onZigbeeStarted() {
|
|
36
|
+
try {
|
|
37
|
+
this.coordinatorEndpoint = await this.zigbee.getDevicesByType('Coordinator')[0].endpoints[0];
|
|
38
|
+
|
|
39
|
+
// for (const device of await this.zigbee.getClients()) {
|
|
40
|
+
// const mappedDevice = zigbeeHerdsmanConverters.findByDevice(device);
|
|
41
|
+
// this.debug(`shouldAction? ${device.ieeeAddr} ${device.modelID}`);
|
|
42
|
+
// if (this.shouldAction(device, mappedDevice)) {
|
|
43
|
+
// this.debug(`Yes!`);
|
|
44
|
+
// await this.doActions(device, mappedDevice);
|
|
45
|
+
// }
|
|
46
|
+
// }
|
|
47
|
+
} catch (error) {
|
|
48
|
+
this.sendError(error);
|
|
49
|
+
this.error(
|
|
50
|
+
`Failed to DelayedAction.onZigbeeStarted (${error.stack})`,
|
|
51
|
+
);
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
onZigbeeEvent(data) {
|
|
56
|
+
try {
|
|
57
|
+
const device = data.device;
|
|
58
|
+
// if (this.shouldAction(device, mappedDevice)) {
|
|
59
|
+
this.doActions(device);
|
|
60
|
+
// }
|
|
61
|
+
} catch (error) {
|
|
62
|
+
this.sendError(error);
|
|
63
|
+
this.error(
|
|
64
|
+
`Failed to DelayedAction.onZigbeeEvent (${error.stack})`,
|
|
65
|
+
);
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
delayAction(device, action) {
|
|
70
|
+
try {
|
|
71
|
+
if (!this.actions.hasOwnProperty(device.ieeeAddr)) {
|
|
72
|
+
this.actions[device.ieeeAddr] = [];
|
|
73
|
+
}
|
|
74
|
+
this.actions[device.ieeeAddr].push({
|
|
75
|
+
attempts: 0,
|
|
76
|
+
action: action,
|
|
77
|
+
});
|
|
78
|
+
this.debug(`Succesfully delay action for ${device.ieeeAddr} ${device.modelID}`);
|
|
79
|
+
this.doActions(device);
|
|
80
|
+
} catch (error) {
|
|
81
|
+
this.sendError(error);
|
|
82
|
+
this.error(
|
|
83
|
+
`Failed to DelayedAction.delayAction ${device.ieeeAddr} ${device.modelID} (${error.stack})`,
|
|
84
|
+
);
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
async doActions(device) {
|
|
89
|
+
try {
|
|
90
|
+
if (!this.actions.hasOwnProperty(device.ieeeAddr)) {
|
|
91
|
+
return;
|
|
92
|
+
}
|
|
93
|
+
const foundDev = await this.zigbee.getDevice(device.ieeeAddr);
|
|
94
|
+
if (!foundDev) {
|
|
95
|
+
this.debug(`No found device ${device.ieeeAddr} ${device.modelID}, for doAction`);
|
|
96
|
+
delete this.actions[device.ieeeAddr];
|
|
97
|
+
return;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
const deviceActions = this.actions[device.ieeeAddr];
|
|
101
|
+
const toDelete = [];
|
|
102
|
+
for (const actionDef of deviceActions) {
|
|
103
|
+
if (actionDef.inAction) {
|
|
104
|
+
continue;
|
|
105
|
+
}
|
|
106
|
+
if (actionDef.attempts >= 3) {
|
|
107
|
+
toDelete.push(actionDef);
|
|
108
|
+
continue;
|
|
109
|
+
}
|
|
110
|
+
actionDef.inAction = true;
|
|
111
|
+
this.info(`Do action on ${device.ieeeAddr} ${device.modelID}`);
|
|
112
|
+
try {
|
|
113
|
+
// do action
|
|
114
|
+
await actionDef.action(device);
|
|
115
|
+
this.info(`Do action successfully ${device.ieeeAddr} ${device.modelID}`);
|
|
116
|
+
toDelete.push(actionDef);
|
|
117
|
+
} catch (error) {
|
|
118
|
+
this.sendError(error);
|
|
119
|
+
this.error(
|
|
120
|
+
`Failed to do action ${device.ieeeAddr} ${device.modelID}, ` +
|
|
121
|
+
`attempt ${actionDef.attempts + 1} (${error.stack})`,
|
|
122
|
+
);
|
|
123
|
+
actionDef.attempts++;
|
|
124
|
+
} finally {
|
|
125
|
+
actionDef.inAction = false;
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
for (const actionDef of toDelete) {
|
|
129
|
+
const ind = this.actions[device.ieeeAddr].indexOf(actionDef);
|
|
130
|
+
this.actions[device.ieeeAddr].splice(ind, 1);
|
|
131
|
+
}
|
|
132
|
+
if (this.actions[device.ieeeAddr].length === 0) {
|
|
133
|
+
delete this.actions[device.ieeeAddr];
|
|
134
|
+
}
|
|
135
|
+
} catch (error) {
|
|
136
|
+
this.sendError(error);
|
|
137
|
+
this.error(
|
|
138
|
+
`Failed to DelayedAction.doAction ${device.ieeeAddr} ${device.modelID} (${error.stack})`,
|
|
139
|
+
);
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
module.exports = DelayedAction;
|