iobroker.zigbee 1.10.3 → 1.10.11
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/README.md +268 -17
- package/admin/adapter-settings.js +105 -18
- package/admin/admin.js +77 -45
- package/admin/i18n/de/translations.json +1 -1
- package/admin/i18n/en/translations.json +1 -1
- package/admin/i18n/fr/translations.json +1 -1
- package/admin/i18n/nl/translations.json +1 -1
- package/admin/i18n/pl/translations.json +1 -1
- package/admin/i18n/pt/translations.json +1 -1
- package/admin/img/E2204.png +0 -0
- package/admin/img/group_1.png +0 -0
- package/admin/img/group_2.png +0 -0
- package/admin/img/group_3.png +0 -0
- package/admin/img/group_4.png +0 -0
- package/admin/img/group_5.png +0 -0
- package/admin/img/group_6.png +0 -0
- package/admin/img/group_7.png +0 -0
- package/admin/index_m.html +286 -32
- package/admin/tab_m.html +312 -7
- package/admin/words.js +2 -2
- package/docs/de/readme.md +15 -16
- package/docs/en/readme.md +19 -19
- package/io-package.json +104 -99
- package/lib/backup.js +1 -2
- package/lib/commands.js +6 -5
- package/lib/developer.js +6 -2
- package/lib/devices.js +6 -2
- package/lib/groups.js +1 -25
- package/lib/ota.js +2 -2
- package/lib/statescontroller.js +48 -39
- package/lib/utils.js +4 -1
- package/lib/zigbeecontroller.js +70 -26
- package/main.js +57 -8
- package/package.json +17 -16
- package/support/docgen.js +3 -1
package/lib/zigbeecontroller.js
CHANGED
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
const pathLib = require('path');
|
|
4
4
|
const ZigbeeHerdsman = require('zigbee-herdsman');
|
|
5
5
|
const zigbeeHerdsmanConverters = require('zigbee-herdsman-converters');
|
|
6
|
+
const ZDO = require('zigbee-herdsman/dist/zspec/zdo');
|
|
6
7
|
const zigbeeHerdsmanConvertersPhilips = require('zigbee-herdsman-converters/lib/philips');
|
|
7
8
|
const EventEmitter = require('events').EventEmitter;
|
|
8
9
|
const safeJsonStringify = require('./json');
|
|
@@ -11,6 +12,7 @@ const DeviceConfigureExt = require('./zbDeviceConfigure');
|
|
|
11
12
|
const DeviceEventExt = require('./zbDeviceEvent');
|
|
12
13
|
const DelayedActionExt = require('./zbDelayedAction');
|
|
13
14
|
const utils = require('./utils');
|
|
15
|
+
const { waitForDebugger } = require('inspector');
|
|
14
16
|
const groupConverters = [
|
|
15
17
|
zigbeeHerdsmanConverters.toZigbee.light_onoff_brightness,
|
|
16
18
|
zigbeeHerdsmanConverters.toZigbee.light_color_colortemp,
|
|
@@ -301,9 +303,9 @@ class ZigbeeController extends EventEmitter {
|
|
|
301
303
|
}
|
|
302
304
|
|
|
303
305
|
async removeGroupById(id) {
|
|
304
|
-
const group = await this.getGroupByID(id);
|
|
306
|
+
const group = await this.getGroupByID(Number(id));
|
|
305
307
|
try {
|
|
306
|
-
group && group.
|
|
308
|
+
group && group.removeFromNetwork();
|
|
307
309
|
} catch (error) {
|
|
308
310
|
this.sendError(error);
|
|
309
311
|
this.error(`error in removeGroupById: ${error}`);
|
|
@@ -552,7 +554,8 @@ class ZigbeeController extends EventEmitter {
|
|
|
552
554
|
const device = await this.herdsman.getDeviceByIeeeAddr(deviceID);
|
|
553
555
|
if (device) {
|
|
554
556
|
try {
|
|
555
|
-
await
|
|
557
|
+
await device.removeFromNetwork();
|
|
558
|
+
//this.herdsman.adapter.removeDevice(device.networkAddress, device.ieeeAddr);
|
|
556
559
|
} catch (error) {
|
|
557
560
|
this.sendError(error);
|
|
558
561
|
if (error)
|
|
@@ -814,20 +817,25 @@ class ZigbeeController extends EventEmitter {
|
|
|
814
817
|
|
|
815
818
|
if (type === 'foundation') {
|
|
816
819
|
cfg.disableDefaultResponse = true;
|
|
820
|
+
|
|
817
821
|
if (cmd === 'read' && !Array.isArray(zclData)) {
|
|
818
|
-
// needs to be iterable (string[] | number [])
|
|
822
|
+
/* // needs to be iterable (string[] | number [])
|
|
819
823
|
zclData[Symbol.iterator] = function* () {
|
|
820
824
|
let k;
|
|
821
825
|
for (k in this) {
|
|
822
826
|
yield k;
|
|
823
827
|
}
|
|
824
828
|
};
|
|
829
|
+
*/
|
|
825
830
|
}
|
|
826
831
|
let result;
|
|
827
832
|
if (cmd === 'configReport') {
|
|
828
833
|
result = await endpoint.configureReporting(cid, zclData, cfg);
|
|
829
834
|
} else {
|
|
830
|
-
|
|
835
|
+
if (cmd === 'read' && !Array.isArray(zclData))
|
|
836
|
+
result = await endpoint[cmd](cid, Object.keys(zclData), cfg);
|
|
837
|
+
else
|
|
838
|
+
result = await endpoint[cmd](cid, zclData, cfg);
|
|
831
839
|
}
|
|
832
840
|
callback && callback(undefined, result);
|
|
833
841
|
} else if (type === 'functionalResp') {
|
|
@@ -999,27 +1007,63 @@ class ZigbeeController extends EventEmitter {
|
|
|
999
1007
|
}
|
|
1000
1008
|
|
|
1001
1009
|
async getChannelsEnergy() {
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
|
|
1010
|
+
/*
|
|
1011
|
+
const BLANK_EUI64 = "0xFFFFFFFFFFFFFFFF";
|
|
1012
|
+
const SLEEPY = 0xffff;
|
|
1013
|
+
|
|
1014
|
+
let clusterId = ZDO.ClusterId.NWK_UPDATE_REQUEST;
|
|
1015
|
+
|
|
1016
|
+
//for (let i=26;i>0;i--)
|
|
1017
|
+
{
|
|
1018
|
+
try
|
|
1019
|
+
{
|
|
1020
|
+
let result = {};
|
|
1021
|
+
let payload = ZDO.Buffalo.buildRequest(false, clusterId, [11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26], 0x05, undefined, 0, undefined);
|
|
1022
|
+
this.warn(`Payload is [${JSON.stringify(payload)}]`);
|
|
1023
|
+
result = await this.herdsman.adapter.sendZdo(0x0, 0x0, clusterId , payload, false);
|
|
1024
|
+
this.warn(`result is ${JSON.stringify(result)}`)
|
|
1025
|
+
//await this.Wait(5000);
|
|
1026
|
+
|
|
1027
|
+
//let payload1 = ZDO.Buffalo.buildRequest(true, clusterId, [16,17,18,19,20], 0x5, undefined, 0, undefined);
|
|
1028
|
+
//result = await this.herdsman.adapter.sendZdo(0x0, 0x0, clusterId , payload1, false);
|
|
1029
|
+
//this.warn(`result 2 is ${JSON.stringify(result)}`)
|
|
1030
|
+
//await this.Wait(5000);
|
|
1031
|
+
|
|
1032
|
+
|
|
1033
|
+
//let payload2 = ZDO.Buffalo.buildRequest(true, clusterId, [21,22,23,24,25], 0x5, undefined, 0, undefined);
|
|
1034
|
+
//result = await this.herdsman.adapter.sendZdo(0x0, 0x0, clusterId , payload2, false);
|
|
1035
|
+
//this.warn(`result 3 is ${JSON.stringify(result)}`)
|
|
1036
|
+
/* const payload = {
|
|
1037
|
+
dstaddr: 0x0,
|
|
1038
|
+
dstaddrmode: 0x02,
|
|
1039
|
+
channelmask: 0x07FFF800,
|
|
1040
|
+
scanduration: 0x5,
|
|
1041
|
+
scancount: 1,
|
|
1042
|
+
nwkmanageraddr: 0x0000
|
|
1043
|
+
};
|
|
1044
|
+
const energyScan = this.herdsman.adapter.znp.waitFor(
|
|
1045
|
+
2, // unpi_1.Constants.Type.AREQ,
|
|
1046
|
+
5, // Subsystem.ZDO,
|
|
1047
|
+
'mgmtNwkUpdateNotify'
|
|
1048
|
+
);
|
|
1049
|
+
await this.herdsman.adapter.znp.request(
|
|
1050
|
+
0x5, // Subsystem.ZDO
|
|
1051
|
+
'mgmtNwkUpdateReq',
|
|
1052
|
+
payload,
|
|
1053
|
+
energyScan.ID
|
|
1054
|
+
);
|
|
1055
|
+
const result = await energyScan.start().promise;
|
|
1056
|
+
|
|
1057
|
+
|
|
1058
|
+
//return result.payload;
|
|
1059
|
+
}
|
|
1060
|
+
catch (error) {
|
|
1061
|
+
this.sendError(error);
|
|
1062
|
+
this.error(`Failed to touchlinkReset ${error.stack}`);
|
|
1063
|
+
|
|
1064
|
+
}
|
|
1065
|
+
}
|
|
1066
|
+
*/
|
|
1023
1067
|
}
|
|
1024
1068
|
}
|
|
1025
1069
|
|
package/main.js
CHANGED
|
@@ -467,6 +467,16 @@ class Zigbee extends utils.Adapter {
|
|
|
467
467
|
const devId = device.ieeeAddr.substr(2);
|
|
468
468
|
const meta = {device};
|
|
469
469
|
|
|
470
|
+
if (this.stController.checkDebugDevice(devId)) {
|
|
471
|
+
const shortMessage = {};
|
|
472
|
+
for(const propertyName in message) {
|
|
473
|
+
shortMessage[propertyName] = message[propertyName];
|
|
474
|
+
}
|
|
475
|
+
shortMessage.device = device.ieeeAddr;
|
|
476
|
+
shortMessage.meta = undefined;
|
|
477
|
+
shortMessage.endpoint = (message.endpoint.ID ? message.endpoint.ID: -1);
|
|
478
|
+
this.log.warn(`ELEVATED: Zigbee Event of Type ${type} from device ${safeJsonStringify(device.ieeeAddr)}, incoming event: ${safeJsonStringify(shortMessage)}`);
|
|
479
|
+
}
|
|
470
480
|
// this assigment give possibility to use iobroker logger in code of the converters, via meta.logger
|
|
471
481
|
meta.logger = this.log;
|
|
472
482
|
|
|
@@ -613,6 +623,7 @@ class Zigbee extends utils.Adapter {
|
|
|
613
623
|
|
|
614
624
|
async publishFromState(deviceId, model, stateModel, stateList, options) {
|
|
615
625
|
let isGroup = false;
|
|
626
|
+
const has_elevated_debug = this.stController.checkDebugDevice(deviceId)
|
|
616
627
|
|
|
617
628
|
this.log.debug(`publishFromState : ${deviceId} ${model} ${safeJsonStringify(stateList)}`);
|
|
618
629
|
if (model === 'group') {
|
|
@@ -628,6 +639,13 @@ class Zigbee extends utils.Adapter {
|
|
|
628
639
|
|
|
629
640
|
if (!mappedModel) {
|
|
630
641
|
this.log.debug(`No mapped model for ${model}`);
|
|
642
|
+
if (has_elevated_debug) this.log.warn(`ELEVATED: No mapped model for ${model}`)
|
|
643
|
+
return;
|
|
644
|
+
}
|
|
645
|
+
|
|
646
|
+
if (!mappedModel.toZigbee)
|
|
647
|
+
{
|
|
648
|
+
this.log.error(`No toZigbee in mapped model for ${model}`);
|
|
631
649
|
return;
|
|
632
650
|
}
|
|
633
651
|
|
|
@@ -691,8 +709,33 @@ class Zigbee extends utils.Adapter {
|
|
|
691
709
|
}
|
|
692
710
|
return;
|
|
693
711
|
}
|
|
694
|
-
|
|
695
|
-
|
|
712
|
+
|
|
713
|
+
let converter = undefined;
|
|
714
|
+
for (const c of mappedModel.toZigbee) {
|
|
715
|
+
|
|
716
|
+
if (!c.hasOwnProperty('convertSet')) continue;
|
|
717
|
+
this.log.debug(`Type of toZigbee is '${typeof c}', Contains key ${(c.hasOwnProperty('key')?JSON.stringify(c.key):'false ')}`)
|
|
718
|
+
if (!c.hasOwnProperty('key') && c.hasOwnProperty('convertSet') && converter === undefined)
|
|
719
|
+
{
|
|
720
|
+
converter = c;
|
|
721
|
+
|
|
722
|
+
if (has_elevated_debug) this.log.warn(`ELEVATED: setting converter to keyless converter for ${deviceId} of type ${model}`)
|
|
723
|
+
this.log.debug('setting converter to keyless converter')
|
|
724
|
+
continue;
|
|
725
|
+
}
|
|
726
|
+
if (c.key.includes(stateDesc.prop) || c.key.includes(stateDesc.setattr) || c.key.includes(stateDesc.id))
|
|
727
|
+
{
|
|
728
|
+
this.log.debug(`${(converter===undefined?'Setting':'Overriding')}' converter to converter with key(s)'${JSON.stringify(c.key)}}`)
|
|
729
|
+
if (has_elevated_debug) this.log.warn(`ELEVATED: ${(converter===undefined?'Setting':'Overriding')}' converter to converter with key(s)'${JSON.stringify(c.key)}}`)
|
|
730
|
+
converter = c;
|
|
731
|
+
}
|
|
732
|
+
|
|
733
|
+
}
|
|
734
|
+
/*
|
|
735
|
+
if (!mappedModel.toZigbee[0].hasOwnProperty('key') && mappedModel.toZigbee[0].hasOwnProperty('convertSet')) converter = mappedModel.toZigbee[0];
|
|
736
|
+
converter = mappedModel.toZigbee.find(c => c && c.hasOwnProperty('key') && (c.key.includes(stateDesc.prop) || c.key.includes(stateDesc.setattr) || c.key.includes(stateDesc.id)));
|
|
737
|
+
*/
|
|
738
|
+
if (converter === undefined) {
|
|
696
739
|
this.log.error(`No converter available for '${model}' with key '${stateDesc.id}' `);
|
|
697
740
|
this.sendError(`No converter available for '${model}' with key '${stateDesc.id}' `);
|
|
698
741
|
return;
|
|
@@ -714,6 +757,7 @@ class Zigbee extends utils.Adapter {
|
|
|
714
757
|
const epName = stateDesc.epname !== undefined ? stateDesc.epname : (stateDesc.prop || stateDesc.id);
|
|
715
758
|
const key = stateDesc.prop || stateDesc.id || stateDesc.setattr;
|
|
716
759
|
this.log.debug(`convert ${key}, ${safeJsonStringify(preparedValue)}, ${safeJsonStringify(preparedOptions)}`);
|
|
760
|
+
if (has_elevated_debug) this.log.warn(`ELEVATED: convert ${key}, ${safeJsonStringify(preparedValue)}, ${safeJsonStringify(preparedOptions)} for device ${deviceId}`);
|
|
717
761
|
|
|
718
762
|
let target;
|
|
719
763
|
if (model === 'group') {
|
|
@@ -753,6 +797,7 @@ class Zigbee extends utils.Adapter {
|
|
|
753
797
|
try {
|
|
754
798
|
const result = await converter.convertSet(target, key, preparedValue, meta);
|
|
755
799
|
this.log.debug(`convert result ${safeJsonStringify(result)}`);
|
|
800
|
+
if (has_elevated_debug) this.log.warn(`ELEVATED: convert result ${safeJsonStringify(result)} for device ${deviceId}`);
|
|
756
801
|
if (result !== undefined) {
|
|
757
802
|
if (stateModel && !isGroup) {
|
|
758
803
|
this.acknowledgeState(deviceId, model, stateDesc, value);
|
|
@@ -760,13 +805,16 @@ class Zigbee extends utils.Adapter {
|
|
|
760
805
|
// process sync state list
|
|
761
806
|
this.processSyncStatesList(deviceId, model, syncStateList);
|
|
762
807
|
|
|
763
|
-
if (isGroup) {
|
|
764
|
-
await this.callPluginMethod('queryGroupMemberState', [deviceId, stateDesc]);
|
|
765
|
-
this.acknowledgeState(deviceId, model, stateDesc, value);
|
|
766
|
-
}
|
|
808
|
+
// if (isGroup) {
|
|
809
|
+
// await this.callPluginMethod('queryGroupMemberState', [deviceId, stateDesc]);
|
|
810
|
+
// this.acknowledgeState(deviceId, model, stateDesc, value);
|
|
811
|
+
// }
|
|
767
812
|
}
|
|
813
|
+
else
|
|
814
|
+
if (has_elevated_debug) this.log.warn(`Error convert result for ${key} with ${safeJsonStringify(preparedValue)} is undefined on device ${deviceId}.`);
|
|
768
815
|
|
|
769
816
|
} catch (error) {
|
|
817
|
+
if (has_elevated_debug) this.log.warn(`caught error ${safeJsonStringify(error)} is undefined on device ${deviceId}.`);
|
|
770
818
|
this.filterError(`Error ${error.code} on send command to ${deviceId}.` +
|
|
771
819
|
` Error: ${error.stack}`, `Send command to ${deviceId} failed with`, error);
|
|
772
820
|
}
|
|
@@ -961,9 +1009,10 @@ class Zigbee extends utils.Adapter {
|
|
|
961
1009
|
const adapterType = this.config.adapterType || 'zstack';
|
|
962
1010
|
// https://github.com/ioBroker/ioBroker.zigbee/issues/668
|
|
963
1011
|
const extPanIdFix = this.config.extPanIdFix ? this.config.extPanIdFix : false;
|
|
964
|
-
|
|
965
1012
|
const baudRate = parseInt(this.config.baudRate ? this.config.baudRate : 115200);
|
|
966
1013
|
|
|
1014
|
+
const setRtscts = this.config.flowCTRL ? this.config.flowCTRL : false;
|
|
1015
|
+
|
|
967
1016
|
return {
|
|
968
1017
|
net: {
|
|
969
1018
|
panId: panID,
|
|
@@ -974,7 +1023,7 @@ class Zigbee extends utils.Adapter {
|
|
|
974
1023
|
sp: {
|
|
975
1024
|
port: port,
|
|
976
1025
|
baudRate: baudRate,
|
|
977
|
-
rtscts:
|
|
1026
|
+
rtscts: setRtscts,
|
|
978
1027
|
adapter: adapterType,
|
|
979
1028
|
},
|
|
980
1029
|
dbDir: dbDir,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "iobroker.zigbee",
|
|
3
|
-
"version": "1.10.
|
|
3
|
+
"version": "1.10.11",
|
|
4
4
|
"author": {
|
|
5
5
|
"name": "Kirov Ilya",
|
|
6
6
|
"email": "kirovilya@gmail.com"
|
|
@@ -21,32 +21,33 @@
|
|
|
21
21
|
"serialport": "^12.0.0"
|
|
22
22
|
},
|
|
23
23
|
"dependencies": {
|
|
24
|
-
"@iobroker/adapter-core": "^3.
|
|
25
|
-
"@iobroker/dm-utils": "^0.
|
|
26
|
-
"humanize-duration": "^3.
|
|
27
|
-
"tar": "^
|
|
28
|
-
"
|
|
29
|
-
"
|
|
30
|
-
"
|
|
24
|
+
"@iobroker/adapter-core": "^3.1.3",
|
|
25
|
+
"@iobroker/dm-utils": "^0.5.0",
|
|
26
|
+
"humanize-duration": "^3.32.1",
|
|
27
|
+
"tar": "^7.4.3",
|
|
28
|
+
"ajv": "^8.17.1",
|
|
29
|
+
"uri-js": "^4.4.1",
|
|
30
|
+
"typescript": "^5.6.3",
|
|
31
|
+
"zigbee-herdsman": "2.1.4",
|
|
32
|
+
"zigbee-herdsman-converters": "20.28.0"
|
|
31
33
|
},
|
|
32
34
|
"description": "Zigbee devices",
|
|
33
35
|
"devDependencies": {
|
|
34
|
-
"@alcalzone/release-script": "^3.
|
|
35
|
-
"@alcalzone/release-script-plugin-iobroker": "^3.7.
|
|
36
|
+
"@alcalzone/release-script": "^3.8.0",
|
|
37
|
+
"@alcalzone/release-script-plugin-iobroker": "^3.7.2",
|
|
36
38
|
"@alcalzone/release-script-plugin-license": "^3.7.0",
|
|
37
39
|
"@alcalzone/release-script-plugin-manual-review": "^3.7.0",
|
|
38
|
-
"@iobroker/testing": "^
|
|
39
|
-
"
|
|
40
|
-
"chai": "^4.4.1",
|
|
40
|
+
"@iobroker/testing": "^5.0.0",
|
|
41
|
+
"chai": "^5.1.2",
|
|
41
42
|
"chai-as-promised": "^7.1.1",
|
|
42
|
-
"eslint": "^
|
|
43
|
+
"eslint": "^9.13.0",
|
|
43
44
|
"eslint-config-prettier": "^9.1.0",
|
|
44
|
-
"eslint-plugin-prettier": "^5.
|
|
45
|
+
"eslint-plugin-prettier": "^5.2.1",
|
|
45
46
|
"gulp": "^4.0.2",
|
|
46
47
|
"gulp-jsdoc3": "^3.0.0",
|
|
47
48
|
"gulp-replace": "^1.1.4",
|
|
48
49
|
"mixin-deep": "^2.0.1",
|
|
49
|
-
"mocha": "^10.
|
|
50
|
+
"mocha": "^10.8.2"
|
|
50
51
|
},
|
|
51
52
|
"homepage": "https://github.com/ioBroker/ioBroker.zigbee",
|
|
52
53
|
"keywords": [
|
package/support/docgen.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* This script generates the supported devices page.
|
|
3
3
|
*
|
|
4
|
-
|
|
4
|
+
|
|
5
5
|
|
|
6
6
|
let devices = [...require('zigbee-herdsman-converters').devices];
|
|
7
7
|
|
|
@@ -91,3 +91,5 @@ vendors.forEach((vendor) => {
|
|
|
91
91
|
});
|
|
92
92
|
|
|
93
93
|
fs.writeFileSync(outputdir + '/' + file, text);
|
|
94
|
+
|
|
95
|
+
*/
|