iobroker.zigbee 1.6.16 → 1.6.17
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 +425 -424
- package/admin/adapter-settings.js +244 -244
- package/admin/admin.js +2926 -2926
- 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.js +26 -26
- package/admin/words.js +109 -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 +367 -355
- package/lib/backup.js +132 -132
- 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 +803 -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 +627 -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 +321 -318
- package/lib/zbDeviceConfigure.js +152 -152
- package/lib/zbDeviceEvent.js +49 -49
- package/lib/zigbeecontroller.js +946 -946
- package/main.js +42 -3
- package/package.json +77 -77
- package/support/docgen.js +93 -93
package/main.js
CHANGED
|
@@ -197,6 +197,7 @@ class Zigbee extends utils.Adapter {
|
|
|
197
197
|
this.zbController.on('event', this.onZigbeeEvent.bind(this));
|
|
198
198
|
this.zbController.on('msg', this.onZigbeeEvent.bind(this));
|
|
199
199
|
this.zbController.on('publish', this.publishToState.bind(this));
|
|
200
|
+
this.zbController.on('deviceStatusUpdate', this.onDeviceStatusUpdate.bind(this));
|
|
200
201
|
this.zbController.configure(zigbeeOptions);
|
|
201
202
|
await this.callPluginMethod('configure', [zigbeeOptions]);
|
|
202
203
|
|
|
@@ -507,6 +508,21 @@ class Zigbee extends utils.Adapter {
|
|
|
507
508
|
const stateDesc = changedState.stateDesc;
|
|
508
509
|
const value = changedState.value;
|
|
509
510
|
|
|
511
|
+
if (stateDesc.id == 'send_payload') {
|
|
512
|
+
try {
|
|
513
|
+
const json_value = JSON.parse(value);
|
|
514
|
+
const payload = { device:deviceId.replace('0x', ''), payload:json_value };
|
|
515
|
+
const result = await(this.SendPayload(payload));
|
|
516
|
+
if (result.hasOwnProperty('success') && result.success) {
|
|
517
|
+
this.acknowledgeState(deviceId, model, stateDesc, value);
|
|
518
|
+
}
|
|
519
|
+
} catch (error) {
|
|
520
|
+
this.log.warn(`send_payload: ${value} does not parse as JSON Object : ${error.message}`);
|
|
521
|
+
return;
|
|
522
|
+
}
|
|
523
|
+
return;
|
|
524
|
+
}
|
|
525
|
+
|
|
510
526
|
if (stateDesc.isOption) {
|
|
511
527
|
// acknowledge state with given value
|
|
512
528
|
this.acknowledgeState(deviceId, model, stateDesc, value);
|
|
@@ -530,6 +546,7 @@ class Zigbee extends utils.Adapter {
|
|
|
530
546
|
await converter.convertGet(entity.device.endpoints[0], ckey, {});
|
|
531
547
|
} catch (error) {
|
|
532
548
|
this.log.warn(`Failed to read state '${JSON.stringify(ckey)}'of '${entity.device.ieeeAddr}' after query with '${JSON.stringify(error)}'`);
|
|
549
|
+
|
|
533
550
|
}
|
|
534
551
|
}
|
|
535
552
|
}
|
|
@@ -615,8 +632,6 @@ class Zigbee extends utils.Adapter {
|
|
|
615
632
|
// not exposed as states. It serves as a wrapper function for "publishFromState" with
|
|
616
633
|
// extended parameter checking
|
|
617
634
|
//
|
|
618
|
-
// This function is NEVER called from within the adapter itself. The entire structure
|
|
619
|
-
// is built for end user use.
|
|
620
635
|
// The payload can either be a JSON object or the string representation of a JSON object
|
|
621
636
|
// The following keys are supported in the object:
|
|
622
637
|
// device: name of the device. For a device zigbee.0.0011223344556677 this would be 0011223344556677
|
|
@@ -643,7 +658,6 @@ class Zigbee extends utils.Adapter {
|
|
|
643
658
|
const isDevice = payload.device.indexOf('group_') == -1;
|
|
644
659
|
const stateList = [];
|
|
645
660
|
const devID = (isDevice ? `0x${payload.device}`:parseInt(payload.device.replace('group_', '')));
|
|
646
|
-
this.log.warn(`A ${payload.device} ${devID}`);
|
|
647
661
|
|
|
648
662
|
const entity = await this.zbController.resolveEntity(devID);
|
|
649
663
|
if (!entity) {
|
|
@@ -741,6 +755,31 @@ class Zigbee extends utils.Adapter {
|
|
|
741
755
|
}
|
|
742
756
|
}
|
|
743
757
|
}
|
|
758
|
+
async onDeviceStatusUpdate(deviceId, status) {
|
|
759
|
+
if (!deviceId) return;
|
|
760
|
+
|
|
761
|
+
this.log.debug(`onDeviceStatusUpdate: ${deviceId}: ${status}`);
|
|
762
|
+
|
|
763
|
+
try {
|
|
764
|
+
let colorIeee = '#46a100ff';
|
|
765
|
+
|
|
766
|
+
if (!status) {
|
|
767
|
+
colorIeee = '#ff0400ff'; // dev is offline
|
|
768
|
+
}
|
|
769
|
+
|
|
770
|
+
if (!this.config.colorize) {
|
|
771
|
+
colorIeee = null;
|
|
772
|
+
}
|
|
773
|
+
|
|
774
|
+
await this.extendObjectAsync(deviceId, {
|
|
775
|
+
common: {
|
|
776
|
+
color: colorIeee
|
|
777
|
+
}
|
|
778
|
+
});
|
|
779
|
+
} catch (e) {
|
|
780
|
+
this.log.error(e.toString());
|
|
781
|
+
}
|
|
782
|
+
}
|
|
744
783
|
|
|
745
784
|
/**
|
|
746
785
|
* @param {() => void} callback
|
package/package.json
CHANGED
|
@@ -1,77 +1,77 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "iobroker.zigbee",
|
|
3
|
-
"version": "1.6.
|
|
4
|
-
"author": {
|
|
5
|
-
"name": "Kirov Ilya",
|
|
6
|
-
"email": "kirovilya@gmail.com"
|
|
7
|
-
},
|
|
8
|
-
"bugs": {
|
|
9
|
-
"url": "https://github.com/ioBroker/ioBroker.zigbee/issues"
|
|
10
|
-
},
|
|
11
|
-
"contributors": [
|
|
12
|
-
{
|
|
13
|
-
"name": "Kirov Ilya",
|
|
14
|
-
"email": "kirovilya@gmail.com"
|
|
15
|
-
}
|
|
16
|
-
],
|
|
17
|
-
"engines": {
|
|
18
|
-
"node": ">=10"
|
|
19
|
-
},
|
|
20
|
-
"dependencies": {
|
|
21
|
-
"zigbee-herdsman": "0.14.
|
|
22
|
-
"zigbee-herdsman-converters": "14.0.
|
|
23
|
-
"@iobroker/adapter-core": "^2.4.0",
|
|
24
|
-
"tar": "^6.0.5",
|
|
25
|
-
"typescript": "^4.0.5"
|
|
26
|
-
},
|
|
27
|
-
"description": "Zigbee devices",
|
|
28
|
-
"devDependencies": {
|
|
29
|
-
"@alcalzone/release-script": "~3.4.2",
|
|
30
|
-
"@iobroker/testing": "^2.5.4",
|
|
31
|
-
"axios": "^0.21.1",
|
|
32
|
-
"mixin-deep": "^1.3.2",
|
|
33
|
-
"eslint": "^7.18.0",
|
|
34
|
-
"eslint-config-google": "*",
|
|
35
|
-
"lint-diff": "*",
|
|
36
|
-
"chai": "^4.3.4",
|
|
37
|
-
"chai-as-promised": "^7.1.1",
|
|
38
|
-
"gulp": "^4.0.2",
|
|
39
|
-
"gulp-jsdoc3": "^3.0.0",
|
|
40
|
-
"gulp-replace": "^1.1.3",
|
|
41
|
-
"mocha": "^9.1.3"
|
|
42
|
-
},
|
|
43
|
-
"homepage": "https://github.com/ioBroker/ioBroker.zigbee",
|
|
44
|
-
"keywords": [
|
|
45
|
-
"ioBroker",
|
|
46
|
-
"zigbee",
|
|
47
|
-
"cc2531",
|
|
48
|
-
"cc2530",
|
|
49
|
-
"cc2538",
|
|
50
|
-
"cc2652",
|
|
51
|
-
"deconz",
|
|
52
|
-
"conbee",
|
|
53
|
-
"raspbee",
|
|
54
|
-
"ezsp",
|
|
55
|
-
"efr32"
|
|
56
|
-
],
|
|
57
|
-
"license": "MIT",
|
|
58
|
-
"main": "main.js",
|
|
59
|
-
"optionalDependencies": {},
|
|
60
|
-
"readmeFilename": "README.md",
|
|
61
|
-
"repository": {
|
|
62
|
-
"type": "git",
|
|
63
|
-
"url": "git+https://github.com/ioBroker/ioBroker.zigbee.git"
|
|
64
|
-
},
|
|
65
|
-
"scripts": {
|
|
66
|
-
"test": "npm run test:package && npm run test:unit",
|
|
67
|
-
"docgen": "node support/docgen.js",
|
|
68
|
-
"test:package": "mocha test/package --exit",
|
|
69
|
-
"test:unit": "mocha test/unit --exit",
|
|
70
|
-
"test:integration": "mocha test/integration --exit",
|
|
71
|
-
"watch:parcel": "parcel admin/src/index.tsx -d admin/build --hmr-port 1235",
|
|
72
|
-
"test:js": "mocha --opts test/mocha.custom.opts",
|
|
73
|
-
"lint": "npm run lint:js",
|
|
74
|
-
"lint:js": "eslint",
|
|
75
|
-
"release": "release-script"
|
|
76
|
-
}
|
|
77
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "iobroker.zigbee",
|
|
3
|
+
"version": "1.6.17",
|
|
4
|
+
"author": {
|
|
5
|
+
"name": "Kirov Ilya",
|
|
6
|
+
"email": "kirovilya@gmail.com"
|
|
7
|
+
},
|
|
8
|
+
"bugs": {
|
|
9
|
+
"url": "https://github.com/ioBroker/ioBroker.zigbee/issues"
|
|
10
|
+
},
|
|
11
|
+
"contributors": [
|
|
12
|
+
{
|
|
13
|
+
"name": "Kirov Ilya",
|
|
14
|
+
"email": "kirovilya@gmail.com"
|
|
15
|
+
}
|
|
16
|
+
],
|
|
17
|
+
"engines": {
|
|
18
|
+
"node": ">=10"
|
|
19
|
+
},
|
|
20
|
+
"dependencies": {
|
|
21
|
+
"zigbee-herdsman": "0.14.26",
|
|
22
|
+
"zigbee-herdsman-converters": "14.0.491",
|
|
23
|
+
"@iobroker/adapter-core": "^2.4.0",
|
|
24
|
+
"tar": "^6.0.5",
|
|
25
|
+
"typescript": "^4.0.5"
|
|
26
|
+
},
|
|
27
|
+
"description": "Zigbee devices",
|
|
28
|
+
"devDependencies": {
|
|
29
|
+
"@alcalzone/release-script": "~3.4.2",
|
|
30
|
+
"@iobroker/testing": "^2.5.4",
|
|
31
|
+
"axios": "^0.21.1",
|
|
32
|
+
"mixin-deep": "^1.3.2",
|
|
33
|
+
"eslint": "^7.18.0",
|
|
34
|
+
"eslint-config-google": "*",
|
|
35
|
+
"lint-diff": "*",
|
|
36
|
+
"chai": "^4.3.4",
|
|
37
|
+
"chai-as-promised": "^7.1.1",
|
|
38
|
+
"gulp": "^4.0.2",
|
|
39
|
+
"gulp-jsdoc3": "^3.0.0",
|
|
40
|
+
"gulp-replace": "^1.1.3",
|
|
41
|
+
"mocha": "^9.1.3"
|
|
42
|
+
},
|
|
43
|
+
"homepage": "https://github.com/ioBroker/ioBroker.zigbee",
|
|
44
|
+
"keywords": [
|
|
45
|
+
"ioBroker",
|
|
46
|
+
"zigbee",
|
|
47
|
+
"cc2531",
|
|
48
|
+
"cc2530",
|
|
49
|
+
"cc2538",
|
|
50
|
+
"cc2652",
|
|
51
|
+
"deconz",
|
|
52
|
+
"conbee",
|
|
53
|
+
"raspbee",
|
|
54
|
+
"ezsp",
|
|
55
|
+
"efr32"
|
|
56
|
+
],
|
|
57
|
+
"license": "MIT",
|
|
58
|
+
"main": "main.js",
|
|
59
|
+
"optionalDependencies": {},
|
|
60
|
+
"readmeFilename": "README.md",
|
|
61
|
+
"repository": {
|
|
62
|
+
"type": "git",
|
|
63
|
+
"url": "git+https://github.com/ioBroker/ioBroker.zigbee.git"
|
|
64
|
+
},
|
|
65
|
+
"scripts": {
|
|
66
|
+
"test": "npm run test:package && npm run test:unit",
|
|
67
|
+
"docgen": "node support/docgen.js",
|
|
68
|
+
"test:package": "mocha test/package --exit",
|
|
69
|
+
"test:unit": "mocha test/unit --exit",
|
|
70
|
+
"test:integration": "mocha test/integration --exit",
|
|
71
|
+
"watch:parcel": "parcel admin/src/index.tsx -d admin/build --hmr-port 1235",
|
|
72
|
+
"test:js": "mocha --opts test/mocha.custom.opts",
|
|
73
|
+
"lint": "npm run lint:js",
|
|
74
|
+
"lint:js": "eslint",
|
|
75
|
+
"release": "release-script"
|
|
76
|
+
}
|
|
77
|
+
}
|
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);
|