iobroker.zigbee 1.8.20 → 1.8.22

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 CHANGED
@@ -16,7 +16,7 @@ With the Zigbee-coordinator based on Texas Instruments SoC, deCONZ ConBee/RaspBe
16
16
  ## Hardware
17
17
 
18
18
 
19
- One coordinator device is required for each zigbee Adapter instance. The device must be flashed with the respective coordinator firmware. A list of supported coordinators, the necessary equipment for the firmware and the device preparation process for different coordinator devices are described [here (in English)](https://www.zigbee2mqtt.io/guide/adapters/) or [here (in Russian)](https://myzigbee.ru/books/%D0%BF%D1%80%D0%BE%D1%88%D0%B8%D0%B2%D0%BA%D0%B8/page/%D0%BF%D1%80%D0%BE%D1%88%D0%B8%D0%B2%D0%BA%D0%B0-cc2531cc2530)
19
+ One coordinator device is required for each zigbee Adapter instance. The device must be flashed with the respective coordinator firmware. A list of supported coordinators, the necessary equipment for the firmware and the device preparation process for different coordinator devices are described [here in English](https://www.zigbee2mqtt.io/guide/adapters/) or [smarthomescene.com ](https://smarthomescene.com/blog/best-zigbee-dongles-for-home-assistant-2023/) or [here in Russian](https://myzigbee.ru/books/%D0%BF%D1%80%D0%BE%D1%88%D0%B8%D0%B2%D0%BA%D0%B8/page/%D0%BF%D1%80%D0%BE%D1%88%D0%B8%D0%B2%D0%BA%D0%B0-cc2531cc2530)
20
20
 
21
21
 
22
22
  ### Texas Instruments SoC
@@ -25,16 +25,15 @@ Recommended devices are based on either the CC2652 or CC1352 chip. Devices based
25
25
  Only CC26xx/cc1352/cc2538 Devices support extraction of the NVRam backup which should allow to swap coordinator hardware without having to reconnect all zigbee devices to the network.
26
26
  Current firmware files for these devices can be found [on GitHub](https://github.com/Koenkk/Z-Stack-firmware)
27
27
 
28
- <span><img src="https://ae01.alicdn.com/kf/HTB1Httue3vD8KJjSsplq6yIEFXaJ/Wireless-Zigbee-CC2531-Sniffer-Bare-Board-Packet-Protocol-Analyzer-Module-USB-Interface-Dongle-Capture-Packet.jpg_640x640.jpg" width="100"></span>
29
- <span><img src="https://ae01.alicdn.com/kf/HTB1zAA5QVXXXXahapXXq6xXFXXXu/RF-TO-USB-CC2530-CC2591-RF-switch-USB-transparent-serial-data-transmission-equipment.jpg_640x640.jpg" width="100"></span>
30
- <span><img src="docs/de/img/sonoff.png" width="100"></span>
31
- <span><img src="docs/de/img/CC2538_CC2592_PA.PNG" width="100"></span>
32
- <span><img src="docs/de/img/cc26x2r.PNG" width="100"></span>
33
-
28
+ <span><img src="https://raw.githubusercontent.com/ioBroker/ioBroker.zigbee/master/docs/de/img/CC2531.png" width="100"></span>
29
+ <span><img src="https://raw.githubusercontent.com/ioBroker/ioBroker.zigbee/master/docs/de/img/CC2591.png" width="100"></span>
30
+ <span><img src="https://raw.githubusercontent.com/ioBroker/ioBroker.zigbee/master/docs/de/img/sonoff.png" width="100"></span>
31
+ <span><img src="https://raw.githubusercontent.com/ioBroker/ioBroker.zigbee/master/docs/de/img/CC2538_CC2592_PA.PNG" width="100"></span>
32
+ <span><img src="https://raw.githubusercontent.com/ioBroker/ioBroker.zigbee/master/docs/de/img/cc26x2r.PNG" width="100"></span>
34
33
 
34
+ tutorial/zigbee.png
35
35
  ### Dresden Elektronik SoC
36
-
37
- <span><img src="docs/en/img/deconz.png"></span>
36
+ <span><img src="https://raw.githubusercontent.com/ioBroker/ioBroker.zigbee/master/docs/en/img/deconz.png" width="180"></span>
38
37
 
39
38
  recommended:
40
39
  - ConBee II
@@ -111,11 +110,18 @@ There are knowledge bases that can be useful for working with Zigbee-devices and
111
110
 
112
111
  ## Supported devices
113
112
 
114
- Works with devices from this list https://github.com/ioBroker/ioBroker.zigbee/wiki/Supported-devices
113
+ [Works with devices from this list](https://github.com/ioBroker/ioBroker.zigbee/wiki/Supported-devices)
115
114
 
116
115
 
117
116
  ## More Informations
118
- https://github.com/ioBroker/ioBroker.zigbee/wiki
117
+
118
+ [in Deutsch](https://github.com/ioBroker/ioBroker.zigbee/blob/master/docs/de/readme.md)
119
+
120
+ [in English](https://github.com/ioBroker/ioBroker.zigbee/blob/master/docs/en/readme.md)
121
+
122
+ or
123
+
124
+ [wiki](https://github.com/ioBroker/ioBroker.zigbee/wiki)
119
125
 
120
126
 
121
127
 
@@ -125,19 +131,15 @@ You can thank the authors by these links:
125
131
  * to Kirov Ilya https://www.paypal.me/goofyk
126
132
  * to Arthur Rupp https://paypal.me/ArthurRupp
127
133
 
128
- <!--
129
- Placeholder for the next version (at the beginning of the line):
134
+ -----------------------------------------------------------------------------------------------------
130
135
 
131
- https://github.com/AlCalzone/release-script#usage
132
- npm run release major -- -p iobroker license --all 0.9.8 -> 1.0.0
133
- npm run release minor -- -p iobroker license --all 0.9.8 -> 0.10.0
134
- npm run release patch -- -p iobroker license --all 0.9.8 -> 0.9.9
135
- npm run release prerelease beta -- -p iobroker license --all v0.2.1 -> v0.2.2-beta.0
136
- ### **WORK IN PROGRESS**
137
- -->
136
+ ## Changelog
137
+ ### 1.8.22 (2023-08-05)
138
+ * (arteck) crash when meta is empty
138
139
 
140
+ ### 1.8.21 (2023-07-31)
141
+ * (arteck) no converter found
139
142
 
140
- ## Changelog
141
143
  ### 1.8.20 (2023-07-31)
142
144
  * (arteck) add log
143
145
 
@@ -96,15 +96,15 @@ function loadSettings(callback) {
96
96
  if (typeof load === 'undefined') {
97
97
  alert('Please implement save function in your admin/index.html');
98
98
  } else {
99
- // detect, that we are now in react container (themeNames = ['dark', 'blue', 'colored', 'light'])
100
-
101
- const _query = query.split('&');
102
-
103
- for (var q = 0; q < _query.length; q++) {
104
- if (_query[q].indexOf('react=') !== -1) {
105
- $('.adapter-container').addClass('react-' + _query[q].substring(6));
106
- theme = 'react-' + _query[q].substring(6);
107
- }
99
+ // detect, that we are now in react container (themeNames = ['dark', 'blue', 'colored', 'light'])
100
+
101
+ const _query = query.split('&');
102
+
103
+ for (var q = 0; q < _query.length; q++) {
104
+ if (_query[q].indexOf('react=') !== -1) {
105
+ $('.adapter-container').addClass('react-' + _query[q].substring(6));
106
+ theme = 'react-' + _query[q].substring(6);
107
+ }
108
108
  }
109
109
 
110
110
  load(res.native, onChange);
package/io-package.json CHANGED
@@ -1,8 +1,34 @@
1
1
  {
2
2
  "common": {
3
3
  "name": "zigbee",
4
- "version": "1.8.20",
4
+ "version": "1.8.22",
5
5
  "news": {
6
+ "1.8.22": {
7
+ "en": "crash when meta is empty",
8
+ "de": "crash, wenn meta leer ist",
9
+ "ru": "сбой, когда мета пуста",
10
+ "pt": "acidente quando meta está vazio",
11
+ "nl": "als meta leeg is",
12
+ "fr": "crash quand meta est vide",
13
+ "it": "crash quando il meta è vuoto",
14
+ "es": "estrellarse cuando meta está vacía",
15
+ "pl": "w przypadku, gdy meta jest pusta",
16
+ "uk": "аварійний випадок, коли мета",
17
+ "zh-cn": "c 当元空时发生事故"
18
+ },
19
+ "1.8.21": {
20
+ "en": "no converter found",
21
+ "de": "kein konverter gefunden",
22
+ "ru": "не найдено конвертер",
23
+ "pt": "não encontrado",
24
+ "nl": "geen converter gevonden",
25
+ "fr": "aucun convertisseur trouvé",
26
+ "it": "nessun convertitore trovato",
27
+ "es": "no convertidor encontrado",
28
+ "pl": "nie znaleziono konwerterów",
29
+ "uk": "не знайдено",
30
+ "zh-cn": "未找到转换器"
31
+ },
6
32
  "1.8.20": {
7
33
  "en": "add log",
8
34
  "de": "log",
@@ -67,19 +93,11 @@
67
93
  "pl": "baterie",
68
94
  "uk": "акумулятор",
69
95
  "zh-cn": "电池组"
70
- },
71
- "1.8.13": {
72
- "en": "see Readme https://github.com/ioBroker/ioBroker.zigbee/blob/master/README.md",
73
- "de": "see Readme https://github.com/ioBroker/ioBroker.zigbee/blob/master/README.md"
74
- },
75
- "1.8.12": {
76
- "en": "new Documentation",
77
- "de": "neue Dokumentation"
78
96
  }
79
97
  },
80
- "title": "Zigbee",
81
98
  "titleLang": {
82
99
  "en": "Zigbee",
100
+ "uk": "Zigbee",
83
101
  "ru": "Zigbee",
84
102
  "de": "ZigBee",
85
103
  "pt": "Zigbee",
@@ -92,6 +110,7 @@
92
110
  },
93
111
  "desc": {
94
112
  "en": "Zigbee adapter for Xiaomi (and other) devices via Chip cc26xx/cc25xx",
113
+ "uk": "Zigbee adapter for Xiaomi (and other) devices via Chip cc26xx/cc25xx",
95
114
  "ru": "Zigbee адаптер для Xiaomi (и других) устройств через Chip cc26xx/cc25xx",
96
115
  "de": "ZigBee-Adapter für Xiaomi (und andere) Geräte über Chip cc26xx/cc25xx",
97
116
  "pt": "Adaptador Zigbee para dispositivos Xiaomi (e outros) via Chip cc26xx/cc25xx",
@@ -530,7 +530,7 @@ class StatesController extends EventEmitter {
530
530
  return new Promise((resolve, reject) => {
531
531
  request.head(url, (err, res, body) => {
532
532
  if (err) {
533
- return reject(err);
533
+ return reject(err + ' ' + res + ' ' + body);
534
534
  }
535
535
  const stream = request(url);
536
536
  stream.pipe(
package/lib/utils.js CHANGED
@@ -138,8 +138,10 @@ function getModelRegEx( model) {
138
138
  }
139
139
 
140
140
  function getEntityInfo(entity) {
141
- if (entity) return `Type: ${entity.type} Name: ${entity.name}`
142
- return `getEntityInfo: Illegal Entity ${JSON.stringify(entity)}`
141
+ if (entity) {
142
+ return `Type: ${entity.type} Name: ${entity.name}`;
143
+ }
144
+ return `getEntityInfo: Illegal Entity ${JSON.stringify(entity)}`;
143
145
  }
144
146
 
145
147
  exports.secondsToMilliseconds = seconds => seconds * 1000;
@@ -313,12 +313,12 @@ class ZigbeeController extends EventEmitter {
313
313
  }
314
314
 
315
315
  async addPairingCode(code) {
316
- this.debug(`calling addPairingCode with ${code}`);
317
- if (code) {
318
- await this.herdsman.addInstallCode(code)
319
- this.info(`added code ${code} for pairing`)
320
- return true;
321
- }
316
+ this.debug(`calling addPairingCode with ${code}`);
317
+ if (code) {
318
+ await this.herdsman.addInstallCode(code);
319
+ this.info(`added code ${code} for pairing`);
320
+ return true;
321
+ }
322
322
  return false;
323
323
  }
324
324
 
@@ -784,7 +784,7 @@ class ZigbeeController extends EventEmitter {
784
784
  for (k in this) {
785
785
  yield k;
786
786
  }
787
- };
787
+ }
788
788
  }
789
789
  let result;
790
790
  if (cmd === 'configReport') {
@@ -806,26 +806,26 @@ class ZigbeeController extends EventEmitter {
806
806
 
807
807
  async addDevToGroup(devId, groupId, epid) {
808
808
  try {
809
- this.debug(`called addDevToGroup with ${devId}, ${groupId}, ${epid}`)
809
+ this.debug(`called addDevToGroup with ${devId}, ${groupId}, ${epid}`);
810
810
  const entity = await this.resolveEntity(devId);
811
811
  const group = await this.resolveEntity(groupId);
812
812
  this.debug(`addDevFromGroup - entity: ${utils.getEntityInfo(entity)}`);
813
813
  // generate group debug info and display it
814
- const members = await this.getGroupMembersFromController(groupId)
814
+ const members = await this.getGroupMembersFromController(groupId);
815
815
  let memberIDs = []
816
816
  for (let member of members) {
817
- memberIDs.push(member.ieee)
817
+ memberIDs.push(member.ieee);
818
818
  }
819
819
  this.debug(`addDevToGroup ${groupId} with ${memberIDs.length} members ${safeJsonStringify(memberIDs)}`);
820
820
  if (epid != undefined) {
821
821
  for (const ep of entity.endpoints) {
822
- this.debug(`checking ep ${ep.ID} of ${devId} (${epid})`)
822
+ this.debug(`checking ep ${ep.ID} of ${devId} (${epid})`);
823
823
  if (ep.ID == epid) {
824
824
  if (ep.inputClusters.includes(4) || ep.outputClusters.includes(4)) {
825
825
  this.debug(`adding endpoint ${ep.ID} (${epid}) to group ${groupId}`);
826
826
  await (ep.addToGroup(group.mapped));
827
827
  }
828
- else this.error(`cluster genGroups not supported for endpoint ${epid} of ${devId}`)
828
+ else this.error(`cluster genGroups not supported for endpoint ${epid} of ${devId}`);
829
829
  }
830
830
  }
831
831
  } else {
@@ -855,16 +855,16 @@ class ZigbeeController extends EventEmitter {
855
855
  }
856
856
 
857
857
  async removeDevFromGroup(devId, groupId, epid) {
858
- this.debug(`removeDevFromGroup with ${devId}, ${groupId}, ${epid}`)
858
+ this.debug(`removeDevFromGroup with ${devId}, ${groupId}, ${epid}`);
859
859
  let entity;
860
860
  try {
861
861
  entity = await this.resolveEntity(devId);
862
862
  const group = await this.resolveEntity(groupId);
863
863
 
864
- const members = await this.getGroupMembersFromController(groupId)
864
+ const members = await this.getGroupMembersFromController(groupId);
865
865
  let memberIDs = []
866
866
  for (let member of members) {
867
- memberIDs.push(member.ieee)
867
+ memberIDs.push(member.ieee)
868
868
  }
869
869
 
870
870
  this.debug(`removeDevFromGroup - entity: ${utils.getEntityInfo(entity)}`);
package/main.js CHANGED
@@ -47,8 +47,6 @@ const E_DEBUG = 2;
47
47
  const E_WARN = 3;
48
48
  const E_ERROR = 4;
49
49
 
50
- let _pairingMode = false;
51
-
52
50
  const errorCodes = {
53
51
  9999: {severity: E_INFO, message: 'No response'},
54
52
  233: {severity: E_DEBUG, message: 'MAC NO ACK'},
@@ -229,14 +227,13 @@ class Zigbee extends utils.Adapter {
229
227
  };
230
228
  const mN = (fs.existsSync(moduleName) ? moduleName : this.expandFileName(moduleName).replace('.', '_'));
231
229
  if (!fs.existsSync(mN)) {
232
- this.log.warn(`External converter not loaded - neither ${moduleName} nor ${mN} exist.`)
233
-
230
+ this.log.warn(`External converter not loaded - neither ${moduleName} nor ${mN} exist.`);
234
231
  }
235
232
  else {
236
233
  const converterCode = fs.readFileSync(mN, {encoding: 'utf8'}).toString();
237
234
  let converterLoaded = true;
238
235
  if (converterCode.match(/..\/lib\/legacy/gm)) {
239
- this.log.warn(`External converter ${mN} contains an unsupported reference to '/lib/legacy' - external converter not loaded.`)
236
+ this.log.warn(`External converter ${mN} contains an unsupported reference to '/lib/legacy' - external converter not loaded.`);
240
237
  converterLoaded = false;
241
238
  }
242
239
  else
@@ -244,7 +241,7 @@ class Zigbee extends utils.Adapter {
244
241
  // remove the require statements and attempt to place them in the sandbox
245
242
  const requiredLibraries = converterCode.matchAll(/(\w+) += +require\(['"](\S+)['"]\);/gm);
246
243
  for (const line of requiredLibraries) {
247
- const movedLine = line[2].replace('..', '../zigbee-herdsman-converters')
244
+ const movedLine = line[2].replace('..', '../zigbee-herdsman-converters');
248
245
  try {
249
246
  sandbox[line[1]] = require(movedLine);
250
247
  }
@@ -265,7 +262,7 @@ class Zigbee extends utils.Adapter {
265
262
  else yield converter;
266
263
  }
267
264
  catch (e) {
268
- this.log.error(`Unable to apply converter from module: ${mN} - the code does not run: ${e}`)
265
+ this.log.error(`Unable to apply converter from module: ${mN} - the code does not run: ${e}`);
269
266
  }
270
267
  }
271
268
  else
@@ -273,22 +270,18 @@ class Zigbee extends utils.Adapter {
273
270
 
274
271
  }
275
272
  }
276
- }
273
+ }
277
274
 
278
275
  applyExternalConverters() {
279
- try {
280
276
  for (const definition of this.getExternalDefinition()) {
281
277
  const toAdd = {...definition};
282
278
  delete toAdd['homeassistant'];
283
279
  try {
284
- zigbeeHerdsmanConverters.addDeviceDefinition(toAdd);
280
+ zigbeeHerdsmanConverters.addDeviceDefinition(toAdd);
281
+ } catch {
282
+ this.log.error(`unable to apply external converter ${JSON.stringfy(toAdd)}`);
285
283
  }
286
- catch { this.log.error(`unable to apply external converter ${JSON.stringfy(toAdd)}`) }
287
284
  }
288
- }
289
- catch(error) {
290
- this.log.error('error applying external converters');
291
- }
292
285
  }
293
286
 
294
287
  async doConnect() {
@@ -476,29 +469,33 @@ class Zigbee extends utils.Adapter {
476
469
 
477
470
  let voltage = 0;
478
471
  let battKey = false;
479
-
480
- if (mappedModel.meta != undefined && mappedModel.meta.battery != undefined) {
481
- const isVoltage = entity.mapped.meta.battery.hasOwnProperty('voltageToPercentage');
482
-
483
- if (isVoltage) {
484
- const keys = Object.keys(message.data);
485
-
486
- for (const key of keys) {
487
- const value = message.data[key];
488
-
489
- this.log.debug(`--> BatteryValue ${safeJsonStringify(value)} from battery search`);
490
-
491
- if (value != undefined && value[1] != undefined) {
492
- if (key == 65282 && value[1][1] != undefined) {
493
- voltage = value[1][1].elmVal;
494
- battKey = true;
495
- break;
472
+
473
+ if (mappedModel !== null && mappedModel !== undefined) {
474
+ if (mappedModel.meta !== undefined && mappedModel.meta !== null) {
475
+ if (mappedModel.meta.battery !== undefined) {
476
+ const isVoltage = entity.mapped.meta.battery.hasOwnProperty('voltageToPercentage');
477
+
478
+ if (isVoltage) {
479
+ const keys = Object.keys(message.data);
480
+
481
+ for (const key of keys) {
482
+ const value = message.data[key];
483
+
484
+ this.log.debug(`--> BatteryValue ${safeJsonStringify(value)} from battery search`);
485
+
486
+ if (value != undefined && value[1] != undefined) {
487
+ if (key == 65282 && value[1][1] != undefined) {
488
+ voltage = value[1][1].elmVal;
489
+ battKey = true;
490
+ break;
491
+ }
492
+ if (key == 65281) {
493
+ voltage = value[1];
494
+ battKey = true;
495
+ break;
496
+ }
497
+ }
496
498
  }
497
- if (key == 65281) {
498
- voltage = value[1];
499
- battKey = true;
500
- break;
501
- }
502
499
  }
503
500
  }
504
501
  }
@@ -551,9 +548,9 @@ class Zigbee extends utils.Adapter {
551
548
  }
552
549
  };
553
550
 
554
- try {
555
- for (const converter of converters) {
556
- this.stController.collectOptions(devId, model, (options) => {
551
+ for (const converter of converters) {
552
+ this.stController.collectOptions(devId, model, (options) => {
553
+ try {
557
554
  payload = converter.convert(mappedModel, message, publish, options, meta);
558
555
 
559
556
  if (payload) {
@@ -561,10 +558,10 @@ class Zigbee extends utils.Adapter {
561
558
  publish(payload);
562
559
  }
563
560
  }
564
- });
565
- }
566
- } catch (err) {
567
- this.log.error(`convert problem with '${model}' '${devId}' `);
561
+ } catch (err) {
562
+ this.log.warn(`convert problem with '${model}' '${devId}' `);
563
+ }
564
+ });
568
565
  }
569
566
  }
570
567
 
@@ -953,14 +950,12 @@ class Zigbee extends utils.Adapter {
953
950
  }
954
951
 
955
952
  onPairing(message, data) {
956
- if (Number.isInteger(data)) {
957
- _pairingMode = true;
953
+ if (Number.isInteger(data)) {
958
954
  this.setState('info.pairingCountdown', data, true);
959
955
  }
960
956
  if (data === 0) {
961
957
  // set pairing mode off
962
958
  this.setState('info.pairingMode', false, true);
963
- _pairingMode = false;
964
959
  }
965
960
  if (data) {
966
961
  this.logToPairing(`${message}: ${data.toString()}`);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "iobroker.zigbee",
3
- "version": "1.8.20",
3
+ "version": "1.8.22",
4
4
  "author": {
5
5
  "name": "Kirov Ilya",
6
6
  "email": "kirovilya@gmail.com"
@@ -18,14 +18,14 @@
18
18
  "node": ">=10"
19
19
  },
20
20
  "optionalDependencies": {
21
- "serialport": "^11.0.0"
21
+ "serialport": "^11.0.1"
22
22
  },
23
23
  "dependencies": {
24
- "@iobroker/adapter-core": "^2.6.8",
24
+ "@iobroker/adapter-core": "^3.0.3",
25
25
  "tar": "^6.1.15",
26
26
  "typescript": "^5.1.6",
27
27
  "zigbee-herdsman": "0.17.2",
28
- "zigbee-herdsman-converters": "15.49.0"
28
+ "zigbee-herdsman-converters": "15.54.0"
29
29
  },
30
30
  "description": "Zigbee devices",
31
31
  "devDependencies": {
@@ -37,9 +37,9 @@
37
37
  "axios": "^1.3.4",
38
38
  "chai": "^4.3.7",
39
39
  "chai-as-promised": "^7.1.1",
40
- "eslint": "^8.44.0",
41
- "eslint-config-prettier": "^8.8.0",
42
- "eslint-plugin-prettier": "^4.2.1",
40
+ "eslint": "^8.46.0",
41
+ "eslint-config-prettier": "^8.9.0",
42
+ "eslint-plugin-prettier": "^5.0.0",
43
43
  "gulp": "^4.0.2",
44
44
  "gulp-jsdoc3": "^3.0.0",
45
45
  "gulp-replace": "^1.1.4",