iobroker.zigbee 1.8.21 → 1.8.23
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 -416
- 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 +29 -19
- 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 +165 -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 +91 -77
- package/package.json +7 -7
- package/support/docgen.js +93 -93
package/lib/zbDeviceConfigure.js
CHANGED
|
@@ -1,147 +1,147 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
const zigbeeHerdsmanConverters = require('zigbee-herdsman-converters');
|
|
4
|
-
const BaseExtension = require('./zbBaseExtension');
|
|
5
|
-
|
|
6
|
-
const forcedConfigureOnEachStart = [
|
|
7
|
-
zigbeeHerdsmanConverters.devices.find((d) => d.model === 'V3-BTZB'),
|
|
8
|
-
zigbeeHerdsmanConverters.devices.find((d) => d.model === '014G2461'),
|
|
9
|
-
zigbeeHerdsmanConverters.devices.find((d) => d.model === 'SPZB0001'),
|
|
10
|
-
zigbeeHerdsmanConverters.devices.find((d) => d.model === 'ZK03840')
|
|
11
|
-
];
|
|
12
|
-
|
|
13
|
-
class DeviceConfigure extends BaseExtension {
|
|
14
|
-
constructor(zigbee, options) {
|
|
15
|
-
super(zigbee, options);
|
|
16
|
-
|
|
17
|
-
this.configuring = new Set();
|
|
18
|
-
this.attempts = {};
|
|
19
|
-
this.name = 'DeviceConfigure';
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
setOptions(options) {
|
|
23
|
-
return typeof options === 'object';
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
shouldConfigure(device, mappedDevice) {
|
|
27
|
-
if (!device || !mappedDevice) {
|
|
28
|
-
return false;
|
|
29
|
-
}
|
|
30
|
-
if (!mappedDevice || !mappedDevice.configure) {
|
|
31
|
-
return false;
|
|
32
|
-
}
|
|
33
|
-
if (device.meta.hasOwnProperty('configured') &&
|
|
34
|
-
zigbeeHerdsmanConverters.getConfigureKey(mappedDevice)) {
|
|
35
|
-
return false;
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
return device.interviewing !== true;
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
async onZigbeeStarted() {
|
|
42
|
-
try {
|
|
43
|
-
this.coordinatorEndpoint = await this.zigbee.getDevicesByType('Coordinator')[0].endpoints[0];
|
|
44
|
-
|
|
45
|
-
for (const device of await this.zigbee.getClients()) {
|
|
46
|
-
const mappedDevice = zigbeeHerdsmanConverters.findByDevice(device);
|
|
47
|
-
|
|
48
|
-
if (forcedConfigureOnEachStart.find((d) => d && d.hasOwnProperty('zigbeeModel') && d.zigbeeModel.includes(device.modelID))) {
|
|
49
|
-
this.debug(`DeviceConfigure ${device.ieeeAddr} ${device.modelID} forced by adapter config`);
|
|
50
|
-
device.meta.configured = -1; // Force a reconfiguration for this device
|
|
51
|
-
}
|
|
52
|
-
if (this.shouldConfigure(device, mappedDevice)) {
|
|
53
|
-
this.debug(`DeviceConfigure ${device.ieeeAddr} ${device.modelID} needed`);
|
|
54
|
-
await this.configure(device, mappedDevice);
|
|
55
|
-
} else {
|
|
56
|
-
this.debug(`DeviceConfigure ${device.ieeeAddr} ${device.modelID} not needed`);
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
} catch (error) {
|
|
60
|
-
this.sendError(error);
|
|
61
|
-
this.error(`Failed to DeviceConfigure.onZigbeeStarted (${error.stack})`);
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
onZigbeeEvent(data, mappedDevice) {
|
|
66
|
-
try {
|
|
67
|
-
const device = data.device;
|
|
68
|
-
if (this.shouldConfigure(device, mappedDevice)) {
|
|
69
|
-
this.configure(device, mappedDevice);
|
|
70
|
-
}
|
|
71
|
-
} catch (error) {
|
|
72
|
-
this.sendError(error);
|
|
73
|
-
this.error(`Failed to DeviceConfigure.onZigbeeEvent (${error.stack})`);
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
onDeviceRemove(device) {
|
|
78
|
-
try {
|
|
79
|
-
if (this.configuring.has(device.ieeeAddr)) {
|
|
80
|
-
this.configuring.delete(device.ieeeAddr);
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
if (this.attempts.hasOwnProperty(device.ieeeAddr)) {
|
|
84
|
-
delete this.attempts[device.ieeeAddr];
|
|
85
|
-
}
|
|
86
|
-
} catch (error) {
|
|
87
|
-
this.sendError(error);
|
|
88
|
-
this.error(`Failed to DeviceConfigure.onDeviceRemove (${error.stack})`);
|
|
89
|
-
}
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
onDeviceLeave(data, entity) {
|
|
93
|
-
if (entity) {
|
|
94
|
-
this.onDeviceRemove(entity.device);
|
|
95
|
-
} else {
|
|
96
|
-
this.onDeviceRemove(data);
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
async configure(device, mappedDevice) {
|
|
101
|
-
try {
|
|
102
|
-
if (this.configuring.has(device.ieeeAddr) || this.attempts[device.ieeeAddr] >= 5) {
|
|
103
|
-
return false;
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
this.configuring.add(device.ieeeAddr);
|
|
107
|
-
|
|
108
|
-
if (!this.attempts.hasOwnProperty(device.ieeeAddr)) {
|
|
109
|
-
this.attempts[device.ieeeAddr] = 0;
|
|
110
|
-
}
|
|
111
|
-
try {
|
|
112
|
-
await this.doConfigure(device, mappedDevice);
|
|
113
|
-
} catch (error) {
|
|
114
|
-
this.sendError(error);
|
|
115
|
-
this.warn(
|
|
116
|
-
`DeviceConfigure failed ${device.ieeeAddr} ${device.modelID}, ` +
|
|
117
|
-
`attempt ${this.attempts[device.ieeeAddr] + 1} (${error.stack})`,
|
|
118
|
-
);
|
|
119
|
-
this.attempts[device.ieeeAddr]++;
|
|
120
|
-
}
|
|
121
|
-
this.configuring.delete(device.ieeeAddr);
|
|
122
|
-
} catch (error) {
|
|
123
|
-
this.sendError(error);
|
|
124
|
-
this.error(
|
|
125
|
-
`Failed to DeviceConfigure.configure ${device.ieeeAddr} ${device.modelID} (${error.stack})`,
|
|
126
|
-
);
|
|
127
|
-
}
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
async doConfigure(device, mappedDevice) {
|
|
131
|
-
this.info(`Configuring ${device.ieeeAddr} ${device.modelID}`);
|
|
132
|
-
const coordinatorEndpoint = await this.zigbee.getDevicesByType('Coordinator')[0].endpoints[0];
|
|
133
|
-
try {
|
|
134
|
-
await mappedDevice.configure(device, coordinatorEndpoint, this);
|
|
135
|
-
device.meta.configured = zigbeeHerdsmanConverters.getConfigureKey(mappedDevice);
|
|
136
|
-
device.save();
|
|
137
|
-
this.info(`DeviceConfigure successful ${device.ieeeAddr} ${device.modelID}`);
|
|
138
|
-
} catch (error) {
|
|
139
|
-
this.sendError(error);
|
|
140
|
-
this.error(
|
|
141
|
-
`Failed to DeviceConfigure.configure ${device.ieeeAddr} ${device.modelID} (${error.stack})`,
|
|
142
|
-
);
|
|
143
|
-
}
|
|
144
|
-
}
|
|
145
|
-
}
|
|
146
|
-
|
|
147
|
-
module.exports = DeviceConfigure;
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const zigbeeHerdsmanConverters = require('zigbee-herdsman-converters');
|
|
4
|
+
const BaseExtension = require('./zbBaseExtension');
|
|
5
|
+
|
|
6
|
+
const forcedConfigureOnEachStart = [
|
|
7
|
+
zigbeeHerdsmanConverters.devices.find((d) => d.model === 'V3-BTZB'),
|
|
8
|
+
zigbeeHerdsmanConverters.devices.find((d) => d.model === '014G2461'),
|
|
9
|
+
zigbeeHerdsmanConverters.devices.find((d) => d.model === 'SPZB0001'),
|
|
10
|
+
zigbeeHerdsmanConverters.devices.find((d) => d.model === 'ZK03840')
|
|
11
|
+
];
|
|
12
|
+
|
|
13
|
+
class DeviceConfigure extends BaseExtension {
|
|
14
|
+
constructor(zigbee, options) {
|
|
15
|
+
super(zigbee, options);
|
|
16
|
+
|
|
17
|
+
this.configuring = new Set();
|
|
18
|
+
this.attempts = {};
|
|
19
|
+
this.name = 'DeviceConfigure';
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
setOptions(options) {
|
|
23
|
+
return typeof options === 'object';
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
shouldConfigure(device, mappedDevice) {
|
|
27
|
+
if (!device || !mappedDevice) {
|
|
28
|
+
return false;
|
|
29
|
+
}
|
|
30
|
+
if (!mappedDevice || !mappedDevice.configure) {
|
|
31
|
+
return false;
|
|
32
|
+
}
|
|
33
|
+
if (device.meta.hasOwnProperty('configured') &&
|
|
34
|
+
zigbeeHerdsmanConverters.getConfigureKey(mappedDevice)) {
|
|
35
|
+
return false;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
return device.interviewing !== true;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
async onZigbeeStarted() {
|
|
42
|
+
try {
|
|
43
|
+
this.coordinatorEndpoint = await this.zigbee.getDevicesByType('Coordinator')[0].endpoints[0];
|
|
44
|
+
|
|
45
|
+
for (const device of await this.zigbee.getClients()) {
|
|
46
|
+
const mappedDevice = zigbeeHerdsmanConverters.findByDevice(device);
|
|
47
|
+
|
|
48
|
+
if (forcedConfigureOnEachStart.find((d) => d && d.hasOwnProperty('zigbeeModel') && d.zigbeeModel.includes(device.modelID))) {
|
|
49
|
+
this.debug(`DeviceConfigure ${device.ieeeAddr} ${device.modelID} forced by adapter config`);
|
|
50
|
+
device.meta.configured = -1; // Force a reconfiguration for this device
|
|
51
|
+
}
|
|
52
|
+
if (this.shouldConfigure(device, mappedDevice)) {
|
|
53
|
+
this.debug(`DeviceConfigure ${device.ieeeAddr} ${device.modelID} needed`);
|
|
54
|
+
await this.configure(device, mappedDevice);
|
|
55
|
+
} else {
|
|
56
|
+
this.debug(`DeviceConfigure ${device.ieeeAddr} ${device.modelID} not needed`);
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
} catch (error) {
|
|
60
|
+
this.sendError(error);
|
|
61
|
+
this.error(`Failed to DeviceConfigure.onZigbeeStarted (${error.stack})`);
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
onZigbeeEvent(data, mappedDevice) {
|
|
66
|
+
try {
|
|
67
|
+
const device = data.device;
|
|
68
|
+
if (this.shouldConfigure(device, mappedDevice)) {
|
|
69
|
+
this.configure(device, mappedDevice);
|
|
70
|
+
}
|
|
71
|
+
} catch (error) {
|
|
72
|
+
this.sendError(error);
|
|
73
|
+
this.error(`Failed to DeviceConfigure.onZigbeeEvent (${error.stack})`);
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
onDeviceRemove(device) {
|
|
78
|
+
try {
|
|
79
|
+
if (this.configuring.has(device.ieeeAddr)) {
|
|
80
|
+
this.configuring.delete(device.ieeeAddr);
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
if (this.attempts.hasOwnProperty(device.ieeeAddr)) {
|
|
84
|
+
delete this.attempts[device.ieeeAddr];
|
|
85
|
+
}
|
|
86
|
+
} catch (error) {
|
|
87
|
+
this.sendError(error);
|
|
88
|
+
this.error(`Failed to DeviceConfigure.onDeviceRemove (${error.stack})`);
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
onDeviceLeave(data, entity) {
|
|
93
|
+
if (entity) {
|
|
94
|
+
this.onDeviceRemove(entity.device);
|
|
95
|
+
} else {
|
|
96
|
+
this.onDeviceRemove(data);
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
async configure(device, mappedDevice) {
|
|
101
|
+
try {
|
|
102
|
+
if (this.configuring.has(device.ieeeAddr) || this.attempts[device.ieeeAddr] >= 5) {
|
|
103
|
+
return false;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
this.configuring.add(device.ieeeAddr);
|
|
107
|
+
|
|
108
|
+
if (!this.attempts.hasOwnProperty(device.ieeeAddr)) {
|
|
109
|
+
this.attempts[device.ieeeAddr] = 0;
|
|
110
|
+
}
|
|
111
|
+
try {
|
|
112
|
+
await this.doConfigure(device, mappedDevice);
|
|
113
|
+
} catch (error) {
|
|
114
|
+
this.sendError(error);
|
|
115
|
+
this.warn(
|
|
116
|
+
`DeviceConfigure failed ${device.ieeeAddr} ${device.modelID}, ` +
|
|
117
|
+
`attempt ${this.attempts[device.ieeeAddr] + 1} (${error.stack})`,
|
|
118
|
+
);
|
|
119
|
+
this.attempts[device.ieeeAddr]++;
|
|
120
|
+
}
|
|
121
|
+
this.configuring.delete(device.ieeeAddr);
|
|
122
|
+
} catch (error) {
|
|
123
|
+
this.sendError(error);
|
|
124
|
+
this.error(
|
|
125
|
+
`Failed to DeviceConfigure.configure ${device.ieeeAddr} ${device.modelID} (${error.stack})`,
|
|
126
|
+
);
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
async doConfigure(device, mappedDevice) {
|
|
131
|
+
this.info(`Configuring ${device.ieeeAddr} ${device.modelID}`);
|
|
132
|
+
const coordinatorEndpoint = await this.zigbee.getDevicesByType('Coordinator')[0].endpoints[0];
|
|
133
|
+
try {
|
|
134
|
+
await mappedDevice.configure(device, coordinatorEndpoint, this);
|
|
135
|
+
device.meta.configured = zigbeeHerdsmanConverters.getConfigureKey(mappedDevice);
|
|
136
|
+
device.save();
|
|
137
|
+
this.info(`DeviceConfigure successful ${device.ieeeAddr} ${device.modelID}`);
|
|
138
|
+
} catch (error) {
|
|
139
|
+
this.sendError(error);
|
|
140
|
+
this.error(
|
|
141
|
+
`Failed to DeviceConfigure.configure ${device.ieeeAddr} ${device.modelID} (${error.stack})`,
|
|
142
|
+
);
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
module.exports = DeviceConfigure;
|
package/lib/zbDeviceEvent.js
CHANGED
|
@@ -1,48 +1,48 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
const BaseExtension = require('./zbBaseExtension');
|
|
4
|
-
const zigbeeHerdsmanConverters = require('zigbee-herdsman-converters');
|
|
5
|
-
|
|
6
|
-
class DeviceEvent extends BaseExtension {
|
|
7
|
-
constructor(zigbee, options) {
|
|
8
|
-
super(zigbee, options);
|
|
9
|
-
this.name = 'DeviceEvent';
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
async onZigbeeStarted() {
|
|
13
|
-
for (const device of await this.zigbee.getClients()) {
|
|
14
|
-
this.callOnEvent(device, 'start', {});
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
setOptions(options) {
|
|
19
|
-
return typeof options === 'object';
|
|
20
|
-
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
onZigbeeEvent(data, mappedDevice) {
|
|
24
|
-
if (data.device) {
|
|
25
|
-
this.callOnEvent(data.device, data.type, data, mappedDevice);
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
async stop() {
|
|
30
|
-
if (this.zigbee.getClients() > 0) {
|
|
31
|
-
for (const device of await this.zigbee.getClients()) {
|
|
32
|
-
this.callOnEvent(device, 'stop', {});
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
callOnEvent(device, type, data, mappedDevice) {
|
|
38
|
-
if (!mappedDevice) {
|
|
39
|
-
mappedDevice = zigbeeHerdsmanConverters.findByDevice(device);
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
if (mappedDevice && mappedDevice.onEvent) {
|
|
43
|
-
mappedDevice.onEvent(type, data, device);
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
module.exports = DeviceEvent;
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const BaseExtension = require('./zbBaseExtension');
|
|
4
|
+
const zigbeeHerdsmanConverters = require('zigbee-herdsman-converters');
|
|
5
|
+
|
|
6
|
+
class DeviceEvent extends BaseExtension {
|
|
7
|
+
constructor(zigbee, options) {
|
|
8
|
+
super(zigbee, options);
|
|
9
|
+
this.name = 'DeviceEvent';
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
async onZigbeeStarted() {
|
|
13
|
+
for (const device of await this.zigbee.getClients()) {
|
|
14
|
+
this.callOnEvent(device, 'start', {});
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
setOptions(options) {
|
|
19
|
+
return typeof options === 'object';
|
|
20
|
+
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
onZigbeeEvent(data, mappedDevice) {
|
|
24
|
+
if (data.device) {
|
|
25
|
+
this.callOnEvent(data.device, data.type, data, mappedDevice);
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
async stop() {
|
|
30
|
+
if (this.zigbee.getClients() > 0) {
|
|
31
|
+
for (const device of await this.zigbee.getClients()) {
|
|
32
|
+
this.callOnEvent(device, 'stop', {});
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
callOnEvent(device, type, data, mappedDevice) {
|
|
38
|
+
if (!mappedDevice) {
|
|
39
|
+
mappedDevice = zigbeeHerdsmanConverters.findByDevice(device);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
if (mappedDevice && mappedDevice.onEvent) {
|
|
43
|
+
mappedDevice.onEvent(type, data, device);
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
module.exports = DeviceEvent;
|