iobroker.zigbee 1.10.2 → 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/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
 
@@ -537,12 +547,12 @@ class Zigbee extends utils.Adapter {
537
547
  }
538
548
 
539
549
  let converters = mappedModel.fromZigbee.filter(c => c && c.cluster === cluster && (
540
- (c.type instanceof Array) ? c.type.includes(type) : c.type === type));
550
+ Array.isArray(c.type) ? c.type.includes(type) : c.type === type));
541
551
 
542
552
 
543
553
  if (!converters.length && type === 'readResponse') {
544
554
  converters = mappedModel.fromZigbee.filter(c => c.cluster === cluster && (
545
- (c.type instanceof Array) ? c.type.includes('attributeReport') : c.type === 'attributeReport'));
555
+ Array.isArray(c.type) ? c.type.includes('attributeReport') : c.type === 'attributeReport'));
546
556
  }
547
557
 
548
558
  if (!converters.length) {
@@ -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
- const converter = mappedModel.toZigbee.find(c => c && (c.key.includes(stateDesc.prop) || c.key.includes(stateDesc.setattr) || c.key.includes(stateDesc.id)));
695
- if (!converter) {
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') {
@@ -744,8 +788,8 @@ class Zigbee extends utils.Adapter {
744
788
  }
745
789
  }
746
790
 
747
- if (preparedOptions.hasOwnProperty('state')) {
748
- if (preparedOptions !== undefined) {
791
+ if (preparedOptions !== undefined) {
792
+ if (preparedOptions.hasOwnProperty('state')) {
749
793
  meta.state = preparedOptions.state;
750
794
  }
751
795
  }
@@ -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: false,
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.2",
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.0.4",
25
- "@iobroker/dm-utils": "^0.1.9",
26
- "humanize-duration": "^3.31.0",
27
- "tar": "^6.2.0",
28
- "typescript": "^5.3.3",
29
- "zigbee-herdsman": "0.33.2",
30
- "zigbee-herdsman-converters": "18.20.0"
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.7.0",
35
- "@alcalzone/release-script-plugin-iobroker": "^3.7.0",
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": "^4.1.0",
39
- "axios": "^1.6.3",
40
- "chai": "^4.3.5",
40
+ "@iobroker/testing": "^5.0.0",
41
+ "chai": "^5.1.2",
41
42
  "chai-as-promised": "^7.1.1",
42
- "eslint": "^8.52.0",
43
+ "eslint": "^9.13.0",
43
44
  "eslint-config-prettier": "^9.1.0",
44
- "eslint-plugin-prettier": "^5.0.0",
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.2.0"
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
+ */