iobroker.iot 3.4.3 → 3.4.5

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/io-package.json CHANGED
@@ -1,8 +1,34 @@
1
1
  {
2
2
  "common": {
3
3
  "name": "iot",
4
- "version": "3.4.3",
4
+ "version": "3.4.5",
5
5
  "news": {
6
+ "3.4.5": {
7
+ "en": "Checked the max length of discovered devices for Alexa",
8
+ "de": "Überprüfte die maximale Länge der entdeckten Geräte für Alexa",
9
+ "ru": "Проверка максимальной длины обнаруженных устройств для Alexa",
10
+ "pt": "Verificado o comprimento máximo de dispositivos descobertos para Alexa",
11
+ "nl": "De maximale lengte van ontdekte apparaten voor Alexa gecontroleerd",
12
+ "fr": "Vérification de la longueur maximale des appareils découverts pour Alexa",
13
+ "it": "Controllata la lunghezza massima di dispositivi scoperti per Alexa",
14
+ "es": "Compruebe la longitud máxima de los dispositivos descubiertos para Alexa",
15
+ "pl": "Sprawdziliśmy maksymalną długość odkrytych urządzeń dla Alexa",
16
+ "uk": "Перевірити максимальну довжину відкритих пристроїв для Alexa",
17
+ "zh-cn": "为 Alexa 检查了已发现设备的最大长度"
18
+ },
19
+ "3.4.4": {
20
+ "en": "Corrected the name editing of the devices for Alexa 3",
21
+ "de": "Korrektur der Namensbearbeitung der Geräte für Alexa 3",
22
+ "ru": "Исправлено редактирование названия устройств для Alexa 3",
23
+ "pt": "Corrigido o nome de edição dos dispositivos para Alexa 3",
24
+ "nl": "De naambewerking van de apparaten voor Alexa 3 gecorrigeerd",
25
+ "fr": "Correction de l'édition du nom des appareils pour Alexa 3",
26
+ "it": "Corretto il nome di modifica dei dispositivi per Alexa 3",
27
+ "es": "Corregido el nombre de edición de los dispositivos para Alexa 3",
28
+ "pl": "Poprawił edycję nazwy urządzeń dla Alexa 3",
29
+ "uk": "Виправлено редагування назв пристроїв для Alexa 3",
30
+ "zh-cn": "校正了Alexa 3设备的名称编辑"
31
+ },
6
32
  "3.4.3": {
7
33
  "en": "corrected the addition of the devices for Alexa\nchanged compilation of GUI to remove deprecated packages",
8
34
  "de": "korrigierte die Ergänzung der Geräte für Alexa\ngeänderte Zusammenstellung von GUI, um deprecierte Pakete zu entfernen",
@@ -67,32 +93,6 @@
67
93
  "pl": "usunąć niektóre ostrzeżenia, które powinny być tylko logi debugowania",
68
94
  "uk": "видалення деяких попереджень, які повинні бути вилучені",
69
95
  "zh-cn": "删除一些只应该为调试日志的警告"
70
- },
71
- "3.2.1": {
72
- "en": "fixed issue that only valid JSON could be sent to app via message state",
73
- "de": "festes Problem, dass nur gültig JSON per Nachrichtenzustand an die App gesendet werden konnte",
74
- "ru": "фиксированный вопрос, который может быть отправлен только действительным JSON через состояние сообщения",
75
- "pt": "problema fixo que só JSON válido poderia ser enviado para aplicativo via estado de mensagem",
76
- "nl": "vast probleem dat alleen geldige JSON via berichtstatus naar de app kan worden verzonden",
77
- "fr": "problème corrigé que seul JSON valide pourrait être envoyé à l'application via l'état du message",
78
- "it": "problema fisso che solo valido JSON potrebbe essere inviato all'app tramite lo stato del messaggio",
79
- "es": "emisión fija que sólo válida JSON podría ser enviado a la aplicación a través del estado del mensaje",
80
- "pl": "stałe wydanie, że tylko poprawny JSON może być wysłany do aplikacji przez stan wiadomości",
81
- "uk": "виправлено проблему, що тільки дійсний JSON може бути відправлений на додаток через стан повідомлень",
82
- "zh-cn": "只能通过消息状态发送到应用程序的 JSON 的固定问题"
83
- },
84
- "3.2.0": {
85
- "en": "implemented geofence with ioBroker Visu app",
86
- "de": "geofence with ioBroker Visu app",
87
- "ru": "реализована геозона с приложением ioBroker Visu",
88
- "pt": "geofence implementado com aplicativo ioBroker Visu",
89
- "nl": "geïmplementeerd geofence met ioBroker Visu app",
90
- "fr": "géofence mise en œuvre avec l'application ioBroker Visu",
91
- "it": "geofence implementato con ioBroker Visu app",
92
- "es": "geofence implementado con aplicación ioBroker Visu",
93
- "pl": "zaimplementowany geofence z aplikacją ioBroker Visu",
94
- "uk": "впроваджено геоfence з додатком ioBroker Visu",
95
- "zh-cn": "使用 ioBroker Visu app 执行的地理栅栏"
96
96
  }
97
97
  },
98
98
  "titleLang": {
@@ -410,13 +410,13 @@ function AlexaSH2(adapter) {
410
410
  } else {
411
411
  // convert a single device into a group, because at least two devices found with the same name
412
412
  groups[friendlyNames[n]] = {
413
- applianceId: friendlyNames[n].replace(/[^a-zA-Zа-яА-Я0-9_=#;:?@&-]+/g, '_'),
413
+ applianceId: friendlyNames[n].replace(/[^a-zA-Zа-яА-Я0-9_=#;:?@&-]+/g, '_').substring(0, 128),
414
414
  applianceTypes: JSON.parse(JSON.stringify(names[friendlyNames[n]].applianceTypes)),
415
415
  manufacturerName: 'ioBroker group',
416
416
  modelName: (name || words['No name'][lang]).substring(0, 128),
417
417
  version: '1',
418
- friendlyName: friendlyNames[n],
419
- friendlyDescription: `${words['Group'][lang]} ${friendlyNames[n]}`,
418
+ friendlyName: friendlyNames[n].substring(0, 128),
419
+ friendlyDescription: `${words['Group'][lang]} ${friendlyNames[n]}`.substring(0, 128),
420
420
  isReachable: true,
421
421
  actions: JSON.parse(JSON.stringify(actions)),
422
422
  additionalApplianceDetails: {
@@ -477,18 +477,23 @@ function AlexaSH2(adapter) {
477
477
  }
478
478
  }
479
479
 
480
+ if (JSON.stringify(groups[friendlyNames[n]].additionalApplianceDetails).length > 5000) {
481
+ adapter.log.warn(`[ALEXA] "${groups[friendlyNames[n]].friendlyName}" has too long additionalApplianceDetails`);
482
+ return;
483
+ }
484
+
480
485
  result.push(groups[friendlyNames[n]]);
481
486
  names[friendlyNames[n]].disabled = true;
482
487
  }
483
488
  } else {
484
489
  const obj = {
485
- applianceId: friendlyNames[n].replace(/[^a-zA-Zа-яА-Я0-9_=#;:?@&-]+/g, '_'),
490
+ applianceId: friendlyNames[n].replace(/[^a-zA-Zа-яА-Я0-9_=#;:?@&-]+/g, '_').substring(0, 128),
486
491
  applianceTypes: [],
487
492
  manufacturerName: 'ioBroker',
488
493
  modelName: (name || words['No name'][lang]).substring(0, 128),
489
494
  version: '1',
490
- friendlyName: friendlyNames[n],
491
- friendlyDescription: friendlyDescription,
495
+ friendlyName: friendlyNames[n].substring(0, 128),
496
+ friendlyDescription: friendlyDescription.substring(0, 128),
492
497
  isReachable: true,
493
498
  actions: JSON.parse(JSON.stringify(actions)),
494
499
  additionalApplianceDetails: {
@@ -503,6 +508,11 @@ function AlexaSH2(adapter) {
503
508
  func,
504
509
  },
505
510
  };
511
+ if (JSON.stringify(obj.additionalApplianceDetails).length > 5000) {
512
+ adapter.log.warn(`[ALEXA] "${id}" has too long additionalApplianceDetails`);
513
+ return;
514
+ }
515
+
506
516
  names[friendlyNames[n]] = obj;
507
517
  smartType && names[friendlyNames[n]].applianceTypes.push(smartType);
508
518
  result.push(obj);
@@ -2544,7 +2554,7 @@ function AlexaSH2(adapter) {
2544
2554
  let names = {};
2545
2555
  enums = [];
2546
2556
 
2547
- if (_states && _states.rows) {
2557
+ if (_states?.rows) {
2548
2558
  for (let i = 0; i < _states.rows.length; i++) {
2549
2559
  if (_states.rows[i].value) {
2550
2560
  states[_states.rows[i].id] = _states.rows[i].value;
@@ -2552,18 +2562,14 @@ function AlexaSH2(adapter) {
2552
2562
 
2553
2563
  if (adapter.config.noCommon) {
2554
2564
  if (
2555
- _states.rows[i].value.common &&
2556
- _states.rows[i].value.common.custom &&
2557
- _states.rows[i].value.common.custom[adapter.namespace] &&
2558
- _states.rows[i].value.common.custom[adapter.namespace].smartName &&
2565
+ _states.rows[i].value.common?.custom?.[adapter.namespace]?.smartName &&
2559
2566
  _states.rows[i].value.common.custom[adapter.namespace].smartName !== 'ignore'
2560
2567
  ) {
2561
2568
  alexaIds.push(_states.rows[i].id);
2562
2569
  }
2563
2570
  } else {
2564
2571
  if (
2565
- _states.rows[i].value.common &&
2566
- _states.rows[i].value.common.smartName &&
2572
+ _states.rows[i].value.common?.smartName &&
2567
2573
  _states.rows[i].value.common.smartName !== 'ignore'
2568
2574
  ) {
2569
2575
  alexaIds.push(_states.rows[i].id);
@@ -2578,7 +2584,7 @@ function AlexaSH2(adapter) {
2578
2584
  let rooms = [];
2579
2585
  let funcs = [];
2580
2586
  let smartName;
2581
- if (doc && doc.rows) {
2587
+ if (doc?.rows) {
2582
2588
  for (let i = 0, l = doc.rows.length; i < l; i++) {
2583
2589
  if (doc.rows[i].value) {
2584
2590
  let _id = doc.rows[i].id;
@@ -2644,8 +2650,7 @@ function AlexaSH2(adapter) {
2644
2650
  let room = '';
2645
2651
  for (let r = 0; r < rooms.length; r++) {
2646
2652
  if (
2647
- !rooms[r].common ||
2648
- !rooms[r].common.members ||
2653
+ !rooms[r].common?.members ||
2649
2654
  typeof rooms[r].common.members !== 'object' ||
2650
2655
  !rooms[r].common.members.length
2651
2656
  ) {
@@ -2735,11 +2740,11 @@ function AlexaSH2(adapter) {
2735
2740
  }
2736
2741
  if (fnA > fnB) {
2737
2742
  return 1;
2738
- } else if (fnA < fnB) {
2743
+ }
2744
+ if (fnA < fnB) {
2739
2745
  return -1;
2740
- } else {
2741
- return 0;
2742
2746
  }
2747
+ return 0;
2743
2748
  });
2744
2749
 
2745
2750
  for (let k = result.length - 1; k >= 0; k--) {
@@ -2754,6 +2759,50 @@ function AlexaSH2(adapter) {
2754
2759
  }
2755
2760
  }
2756
2761
 
2762
+ // Check that all applianceId are unique: https://developer.amazon.com/en-US/blogs/alexa/post/Tx480XF5QCA6IN/managing-device-discovery-for-your-alexa-smart-home-skil
2763
+ const uniqueIds = [];
2764
+ for (let i = result.length - 1; i >= 0; i--) {
2765
+ if (uniqueIds.includes(result[i].applianceId)) {
2766
+ adapter.log.error(`[ALEXA] Duplicate applianceId: ${result[i].applianceId}`);
2767
+ result.splice(i, 1);
2768
+ continue;
2769
+ }
2770
+
2771
+ uniqueIds.push(result[i].applianceId);
2772
+
2773
+ // check the maximum length of capabilities
2774
+ if (result[i].actions.length > 100) {
2775
+ adapter.log.error(`[ALEXA] Too many actions by "${result[i].applianceId}": ${result[i].actions.length}`);
2776
+ result.splice(i, 1);
2777
+ }
2778
+ }
2779
+
2780
+ // Check the maximum number of devices
2781
+ if (result.length > 300) {
2782
+ adapter.log.error(`[ALEXA] Too many devices: ${result.length}`);
2783
+ result.splice(300);
2784
+ }
2785
+
2786
+ while (JSON.stringify(result).length > 255 * 1024) {
2787
+ // Find the biggest one
2788
+ let i = -1;
2789
+ let size = 0;
2790
+ for (let j = 0; j < result.length; j++) {
2791
+ const s = JSON.stringify(result[j]).length;
2792
+ if (s > size) {
2793
+ size = s;
2794
+ i = j;
2795
+ }
2796
+ }
2797
+
2798
+ if (i === -1) {
2799
+ break;
2800
+ }
2801
+ adapter.log.warn(`[ALEXA] Too big response. Device "${result[i].applianceId}" will be removed`);
2802
+ // Check the maximum size of the response
2803
+ result.splice(i, 1);
2804
+ }
2805
+
2757
2806
  callback(err, result, analyseAddedId);
2758
2807
  });
2759
2808
  });
package/main.js CHANGED
@@ -688,7 +688,7 @@ async function readCertificates() {
688
688
  throw new Error('Not exists');
689
689
  }
690
690
 
691
- if (!certificate || !certificate.val || !privateKey || !privateKey.val) {
691
+ if (!certificate?.val || !privateKey?.val) {
692
692
  throw new Error('Not exists');
693
693
  } else {
694
694
  return {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "iobroker.iot",
3
- "version": "3.4.3",
3
+ "version": "3.4.5",
4
4
  "description": "This adapter allows to communicate Amazon Alexa and Google Home with ioBroker.",
5
5
  "author": {
6
6
  "name": "bluefox",
@@ -22,26 +22,26 @@
22
22
  "url": "https://github.com/ioBroker/ioBroker.iot"
23
23
  },
24
24
  "dependencies": {
25
- "@iobroker/adapter-core": "^3.2.2",
26
- "@iobroker/types": "^6.0.11",
25
+ "@iobroker/adapter-core": "^3.2.3",
27
26
  "aws-iot-device-sdk": "^2.2.15",
28
27
  "iobroker.type-detector": "^3.0.5",
29
28
  "mime": "^3.0.0",
30
- "axios": "^1.7.7",
31
- "uuid": "^11.0.2"
29
+ "axios": "^1.7.9",
30
+ "uuid": "^11.0.3"
32
31
  },
33
32
  "devDependencies": {
34
33
  "@alcalzone/release-script": "^3.8.0",
35
34
  "@alcalzone/release-script-plugin-iobroker": "^3.7.2",
36
35
  "@alcalzone/release-script-plugin-license": "^3.7.0",
37
- "@iobroker/build-tools": "^2.0.6",
38
- "@iobroker/eslint-config": "^0.1.6",
39
- "@iobroker/legacy-testing": "^2.0.0",
40
- "@types/node": "^22.8.6",
36
+ "@iobroker/build-tools": "^2.0.12",
37
+ "@iobroker/eslint-config": "^1.0.0",
38
+ "@iobroker/legacy-testing": "^2.0.1",
39
+ "@iobroker/types": "^7.0.6",
40
+ "@types/node": "^22.10.2",
41
41
  "chai": "^4.5.0",
42
42
  "colorette": "^2.0.20",
43
- "mocha": "^10.8.2",
44
- "puppeteer": "^23.6.1"
43
+ "mocha": "^11.0.1",
44
+ "puppeteer": "^23.11.1"
45
45
  },
46
46
  "bugs": {
47
47
  "url": "https://github.com/ioBroker/ioBroker.iot/issues"