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.
- package/.eslintignore +1 -1
- package/.eslintrc.json +36 -36
- package/.github/FUNDING.yml +3 -3
- package/.github/stale.yml +13 -13
- package/.github/workflows/test-and-release.yml +151 -151
- package/.travis/wiki.sh +27 -27
- package/LICENSE +21 -21
- package/README.md +378 -367
- package/admin/adapter-settings.js +244 -244
- package/admin/admin.js +2926 -2926
- package/admin/img/philips_ensis.png +0 -0
- package/admin/img/philips_hue_lom001.png +0 -0
- package/admin/index.html +159 -159
- package/admin/index_m.html +1161 -1158
- package/admin/moment.min.js +1 -1
- package/admin/shuffle.min.js +2 -2
- package/admin/tab_m.html +944 -944
- package/admin/vis-network.min.css +1 -1
- package/admin/vis-network.min.js +27 -26
- package/admin/words.js +112 -108
- package/docs/de/readme.md +27 -27
- package/docs/en/readme.md +30 -30
- 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 +340 -355
- package/lib/backup.js +171 -133
- package/lib/binding.js +325 -325
- package/lib/colors.js +460 -460
- package/lib/commands.js +501 -501
- package/lib/developer.js +148 -148
- package/lib/devices.js +3145 -3144
- package/lib/exclude.js +168 -168
- package/lib/exposes.js +805 -795
- package/lib/groups.js +342 -342
- package/lib/json.js +60 -60
- package/lib/networkmap.js +56 -56
- package/lib/ota.js +179 -179
- package/lib/rgb.js +255 -255
- package/lib/seriallist.js +37 -37
- package/lib/states.js +6416 -6407
- package/lib/statescontroller.js +658 -627
- package/lib/tools.js +54 -54
- package/lib/utils.js +151 -151
- package/lib/zbBaseExtension.js +36 -32
- package/lib/zbDelayedAction.js +152 -152
- package/lib/zbDeviceAvailability.js +315 -318
- package/lib/zbDeviceConfigure.js +152 -152
- package/lib/zbDeviceEvent.js +49 -49
- package/lib/zigbeecontroller.js +946 -946
- package/main.js +22 -4
- package/package.json +3 -3
- package/support/docgen.js +93 -93
package/main.js
CHANGED
|
@@ -45,6 +45,8 @@ const E_DEBUG=2;
|
|
|
45
45
|
const E_WARN=3;
|
|
46
46
|
const E_ERROR=4;
|
|
47
47
|
|
|
48
|
+
let _pairingMode = false;
|
|
49
|
+
|
|
48
50
|
const errorCodes = {
|
|
49
51
|
9999: { severity:E_INFO, message:'No response'},
|
|
50
52
|
233: { severity:E_DEBUG, message:'MAC NO ACK'},
|
|
@@ -507,6 +509,21 @@ class Zigbee extends utils.Adapter {
|
|
|
507
509
|
const stateDesc = changedState.stateDesc;
|
|
508
510
|
const value = changedState.value;
|
|
509
511
|
|
|
512
|
+
if (stateDesc.id == 'send_payload') {
|
|
513
|
+
try {
|
|
514
|
+
const json_value = JSON.parse(value);
|
|
515
|
+
const payload = { device:deviceId.replace('0x', ''), payload:json_value };
|
|
516
|
+
const result = await(this.SendPayload(payload));
|
|
517
|
+
if (result.hasOwnProperty('success') && result.success) {
|
|
518
|
+
this.acknowledgeState(deviceId, model, stateDesc, value);
|
|
519
|
+
}
|
|
520
|
+
} catch (error) {
|
|
521
|
+
this.log.warn(`send_payload: ${value} does not parse as JSON Object : ${error.message}`);
|
|
522
|
+
return;
|
|
523
|
+
}
|
|
524
|
+
return;
|
|
525
|
+
}
|
|
526
|
+
|
|
510
527
|
if (stateDesc.isOption) {
|
|
511
528
|
// acknowledge state with given value
|
|
512
529
|
this.acknowledgeState(deviceId, model, stateDesc, value);
|
|
@@ -530,6 +547,7 @@ class Zigbee extends utils.Adapter {
|
|
|
530
547
|
await converter.convertGet(entity.device.endpoints[0], ckey, {});
|
|
531
548
|
} catch (error) {
|
|
532
549
|
this.log.warn(`Failed to read state '${JSON.stringify(ckey)}'of '${entity.device.ieeeAddr}' after query with '${JSON.stringify(error)}'`);
|
|
550
|
+
|
|
533
551
|
}
|
|
534
552
|
}
|
|
535
553
|
}
|
|
@@ -615,8 +633,6 @@ class Zigbee extends utils.Adapter {
|
|
|
615
633
|
// not exposed as states. It serves as a wrapper function for "publishFromState" with
|
|
616
634
|
// extended parameter checking
|
|
617
635
|
//
|
|
618
|
-
// This function is NEVER called from within the adapter itself. The entire structure
|
|
619
|
-
// is built for end user use.
|
|
620
636
|
// The payload can either be a JSON object or the string representation of a JSON object
|
|
621
637
|
// The following keys are supported in the object:
|
|
622
638
|
// device: name of the device. For a device zigbee.0.0011223344556677 this would be 0011223344556677
|
|
@@ -643,7 +659,6 @@ class Zigbee extends utils.Adapter {
|
|
|
643
659
|
const isDevice = payload.device.indexOf('group_') == -1;
|
|
644
660
|
const stateList = [];
|
|
645
661
|
const devID = (isDevice ? `0x${payload.device}`:parseInt(payload.device.replace('group_', '')));
|
|
646
|
-
this.log.warn(`A ${payload.device} ${devID}`);
|
|
647
662
|
|
|
648
663
|
const entity = await this.zbController.resolveEntity(devID);
|
|
649
664
|
if (!entity) {
|
|
@@ -741,7 +756,7 @@ class Zigbee extends utils.Adapter {
|
|
|
741
756
|
}
|
|
742
757
|
}
|
|
743
758
|
}
|
|
744
|
-
|
|
759
|
+
|
|
745
760
|
/**
|
|
746
761
|
* @param {() => void} callback
|
|
747
762
|
*/
|
|
@@ -813,6 +828,7 @@ class Zigbee extends utils.Adapter {
|
|
|
813
828
|
disableLed: this.config.disableLed,
|
|
814
829
|
disablePing: this.config.disablePing,
|
|
815
830
|
transmitPower: this.config.transmitPower,
|
|
831
|
+
disableBackup: this.config.disableBackup,
|
|
816
832
|
extPanIdFix: extPanIdFix,
|
|
817
833
|
startWithInconsistent: this.config.startWithInconsistent || false,
|
|
818
834
|
};
|
|
@@ -821,10 +837,12 @@ class Zigbee extends utils.Adapter {
|
|
|
821
837
|
onPairing(message, data) {
|
|
822
838
|
if (Number.isInteger(data)) {
|
|
823
839
|
this.setState('info.pairingCountdown', data, true);
|
|
840
|
+
_pairingMode = true;
|
|
824
841
|
}
|
|
825
842
|
if (data === 0) {
|
|
826
843
|
// set pairing mode off
|
|
827
844
|
this.setState('info.pairingMode', false,true);
|
|
845
|
+
_pairingMode = false;
|
|
828
846
|
}
|
|
829
847
|
if (data) {
|
|
830
848
|
this.logToPairing(`${message}: ${data.toString()}`);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "iobroker.zigbee",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.7.0",
|
|
4
4
|
"author": {
|
|
5
5
|
"name": "Kirov Ilya",
|
|
6
6
|
"email": "kirovilya@gmail.com"
|
|
@@ -18,8 +18,8 @@
|
|
|
18
18
|
"node": ">=10"
|
|
19
19
|
},
|
|
20
20
|
"dependencies": {
|
|
21
|
-
"zigbee-herdsman": "0.14.
|
|
22
|
-
"zigbee-herdsman-converters": "14.0.
|
|
21
|
+
"zigbee-herdsman": "0.14.33",
|
|
22
|
+
"zigbee-herdsman-converters": "14.0.528",
|
|
23
23
|
"@iobroker/adapter-core": "^2.4.0",
|
|
24
24
|
"tar": "^6.0.5",
|
|
25
25
|
"typescript": "^4.0.5"
|
package/support/docgen.js
CHANGED
|
@@ -1,93 +1,93 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* This script generates the supported devices page.
|
|
3
|
-
*
|
|
4
|
-
*/
|
|
5
|
-
|
|
6
|
-
let devices = [...require('zigbee-herdsman-converters').devices];
|
|
7
|
-
|
|
8
|
-
for (const device of devices) {
|
|
9
|
-
if (device.whiteLabel) {
|
|
10
|
-
for (const whiteLabel of device.whiteLabel) {
|
|
11
|
-
const whiteLabelDevice = {
|
|
12
|
-
...device,
|
|
13
|
-
model: whiteLabel.model,
|
|
14
|
-
vendor: whiteLabel.vendor,
|
|
15
|
-
description: whiteLabel.description,
|
|
16
|
-
whiteLabelOf: device,
|
|
17
|
-
};
|
|
18
|
-
|
|
19
|
-
delete whiteLabelDevice.whiteLabel;
|
|
20
|
-
|
|
21
|
-
devices.push(whiteLabelDevice);
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
devices = new Map(devices.map((d) => [d.model, d]));
|
|
27
|
-
|
|
28
|
-
const Devices = require('../lib/devices');
|
|
29
|
-
let iobDevices = Devices.devices;
|
|
30
|
-
Devices.fillStatesWithExposes('');
|
|
31
|
-
|
|
32
|
-
const iobCount = iobDevices.filter((d) => (!d.exposed)).length;
|
|
33
|
-
iobDevices = new Map(iobDevices.map((d) => d.models.map((m) => [m, d])).flat());
|
|
34
|
-
|
|
35
|
-
const fs = require('fs');
|
|
36
|
-
const outputdir = process.argv[2];
|
|
37
|
-
|
|
38
|
-
if (!outputdir) {
|
|
39
|
-
console.error('Please specify an output directory');
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
const file = 'Supported-devices.md';
|
|
43
|
-
let text = `*NOTE: Automatically generated by 'npm run docgen'* \n\n` +
|
|
44
|
-
`Currently **${iobDevices.size}**(${iobCount} described in adapter) devices are supported.\n\n` +
|
|
45
|
-
`(⭐EXP) - means that the device is presented automatically, based on the 'exposes' from the zigbee-herdsman-converters.\n\n`;
|
|
46
|
-
|
|
47
|
-
const logDevices = (devmodels) => {
|
|
48
|
-
let result = '';
|
|
49
|
-
|
|
50
|
-
devmodels.forEach((devmodel) => {
|
|
51
|
-
const iobDevice = iobDevices.get(devmodel);
|
|
52
|
-
const device = devices.get(devmodel);
|
|
53
|
-
const pathImg = (iobDevice.icon.startsWith('http')) ? devmodel : iobDevice.icon.replace(new RegExp('img/', 'g'), '').replace(new RegExp('.png', 'g'), '');
|
|
54
|
-
const icon = (iobDevice.icon.startsWith('http')) ? iobDevice.icon : `https://github.com/ioBroker/ioBroker.zigbee/raw/master/admin/${iobDevice.icon}`;
|
|
55
|
-
let brand;
|
|
56
|
-
const models = [];
|
|
57
|
-
let zmodels;
|
|
58
|
-
if (device.zigbeeModel) {
|
|
59
|
-
zmodels = device.zigbeeModel;
|
|
60
|
-
} else {
|
|
61
|
-
zmodels = [devmodel];
|
|
62
|
-
}
|
|
63
|
-
zmodels.forEach((modelId) => {
|
|
64
|
-
const re = /[^\x20-\x7E]+/g;
|
|
65
|
-
const model = modelId.replace(re, ' ');
|
|
66
|
-
const desc = `${device.description} (${device.supports})`;
|
|
67
|
-
const name = `**${device.model}${(iobDevice.exposed) ? ' (⭐EXP)': ''}**<br>`;
|
|
68
|
-
if (brand == undefined) {
|
|
69
|
-
brand= {
|
|
70
|
-
name: name,
|
|
71
|
-
desc: desc,
|
|
72
|
-
pathImg: pathImg,
|
|
73
|
-
};
|
|
74
|
-
}
|
|
75
|
-
models.push(model);
|
|
76
|
-
});
|
|
77
|
-
const modelsStr = models.join(', ');
|
|
78
|
-
result += `| ${brand.name} (${modelsStr}) | ${brand.desc} |  |\n`;
|
|
79
|
-
});
|
|
80
|
-
|
|
81
|
-
return result;
|
|
82
|
-
};
|
|
83
|
-
|
|
84
|
-
const vendors = Array.from(new Set([...iobDevices.keys()].map((m) => (devices.get(m)) ? devices.get(m).vendor : null)));
|
|
85
|
-
vendors.sort();
|
|
86
|
-
text += '| Model | Description | Picture |\n';
|
|
87
|
-
text += '| ------------- | ------------- | -------------------------- |\n';
|
|
88
|
-
vendors.forEach((vendor) => {
|
|
89
|
-
text += `| | **${vendor}** | |\n`;
|
|
90
|
-
text += logDevices([...iobDevices.keys()].map((m) => devices.get(m)).filter((d) => d && d.vendor === vendor).map((d) => d.model));
|
|
91
|
-
});
|
|
92
|
-
|
|
93
|
-
fs.writeFileSync(outputdir + '/' + file, text);
|
|
1
|
+
/**
|
|
2
|
+
* This script generates the supported devices page.
|
|
3
|
+
*
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
let devices = [...require('zigbee-herdsman-converters').devices];
|
|
7
|
+
|
|
8
|
+
for (const device of devices) {
|
|
9
|
+
if (device.whiteLabel) {
|
|
10
|
+
for (const whiteLabel of device.whiteLabel) {
|
|
11
|
+
const whiteLabelDevice = {
|
|
12
|
+
...device,
|
|
13
|
+
model: whiteLabel.model,
|
|
14
|
+
vendor: whiteLabel.vendor,
|
|
15
|
+
description: whiteLabel.description,
|
|
16
|
+
whiteLabelOf: device,
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
delete whiteLabelDevice.whiteLabel;
|
|
20
|
+
|
|
21
|
+
devices.push(whiteLabelDevice);
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
devices = new Map(devices.map((d) => [d.model, d]));
|
|
27
|
+
|
|
28
|
+
const Devices = require('../lib/devices');
|
|
29
|
+
let iobDevices = Devices.devices;
|
|
30
|
+
Devices.fillStatesWithExposes('');
|
|
31
|
+
|
|
32
|
+
const iobCount = iobDevices.filter((d) => (!d.exposed)).length;
|
|
33
|
+
iobDevices = new Map(iobDevices.map((d) => d.models.map((m) => [m, d])).flat());
|
|
34
|
+
|
|
35
|
+
const fs = require('fs');
|
|
36
|
+
const outputdir = process.argv[2];
|
|
37
|
+
|
|
38
|
+
if (!outputdir) {
|
|
39
|
+
console.error('Please specify an output directory');
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
const file = 'Supported-devices.md';
|
|
43
|
+
let text = `*NOTE: Automatically generated by 'npm run docgen'* \n\n` +
|
|
44
|
+
`Currently **${iobDevices.size}**(${iobCount} described in adapter) devices are supported.\n\n` +
|
|
45
|
+
`(⭐EXP) - means that the device is presented automatically, based on the 'exposes' from the zigbee-herdsman-converters.\n\n`;
|
|
46
|
+
|
|
47
|
+
const logDevices = (devmodels) => {
|
|
48
|
+
let result = '';
|
|
49
|
+
|
|
50
|
+
devmodels.forEach((devmodel) => {
|
|
51
|
+
const iobDevice = iobDevices.get(devmodel);
|
|
52
|
+
const device = devices.get(devmodel);
|
|
53
|
+
const pathImg = (iobDevice.icon.startsWith('http')) ? devmodel : iobDevice.icon.replace(new RegExp('img/', 'g'), '').replace(new RegExp('.png', 'g'), '');
|
|
54
|
+
const icon = (iobDevice.icon.startsWith('http')) ? iobDevice.icon : `https://github.com/ioBroker/ioBroker.zigbee/raw/master/admin/${iobDevice.icon}`;
|
|
55
|
+
let brand;
|
|
56
|
+
const models = [];
|
|
57
|
+
let zmodels;
|
|
58
|
+
if (device.zigbeeModel) {
|
|
59
|
+
zmodels = device.zigbeeModel;
|
|
60
|
+
} else {
|
|
61
|
+
zmodels = [devmodel];
|
|
62
|
+
}
|
|
63
|
+
zmodels.forEach((modelId) => {
|
|
64
|
+
const re = /[^\x20-\x7E]+/g;
|
|
65
|
+
const model = modelId.replace(re, ' ');
|
|
66
|
+
const desc = `${device.description} (${device.supports})`;
|
|
67
|
+
const name = `**${device.model}${(iobDevice.exposed) ? ' (⭐EXP)': ''}**<br>`;
|
|
68
|
+
if (brand == undefined) {
|
|
69
|
+
brand= {
|
|
70
|
+
name: name,
|
|
71
|
+
desc: desc,
|
|
72
|
+
pathImg: pathImg,
|
|
73
|
+
};
|
|
74
|
+
}
|
|
75
|
+
models.push(model);
|
|
76
|
+
});
|
|
77
|
+
const modelsStr = models.join(', ');
|
|
78
|
+
result += `| ${brand.name} (${modelsStr}) | ${brand.desc} |  |\n`;
|
|
79
|
+
});
|
|
80
|
+
|
|
81
|
+
return result;
|
|
82
|
+
};
|
|
83
|
+
|
|
84
|
+
const vendors = Array.from(new Set([...iobDevices.keys()].map((m) => (devices.get(m)) ? devices.get(m).vendor : null)));
|
|
85
|
+
vendors.sort();
|
|
86
|
+
text += '| Model | Description | Picture |\n';
|
|
87
|
+
text += '| ------------- | ------------- | -------------------------- |\n';
|
|
88
|
+
vendors.forEach((vendor) => {
|
|
89
|
+
text += `| | **${vendor}** | |\n`;
|
|
90
|
+
text += logDevices([...iobDevices.keys()].map((m) => devices.get(m)).filter((d) => d && d.vendor === vendor).map((d) => d.model));
|
|
91
|
+
});
|
|
92
|
+
|
|
93
|
+
fs.writeFileSync(outputdir + '/' + file, text);
|