iobroker.iot 3.4.4 → 3.5.0
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/LICENSE +1 -1
- package/README.md +8 -1
- package/admin/assets/index-BEsx55sp.js +629 -0
- package/admin/index_m.html +1 -1
- package/admin/rules/asset-manifest.json +13 -15
- package/admin/rules/customRuleBlocks.js +3 -3
- package/admin/rules/customRuleBlocks.js.map +1 -1
- package/admin/rules/static/js/main.d3996fb4.js +5 -0
- package/admin/rules/static/js/main.d3996fb4.js.map +1 -0
- package/admin/rules/static/js/node_modules_prop-types_index_js.33ef8ebd.chunk.js +3 -0
- package/admin/rules/static/js/{node_modules_prop-types_index_js.998adfa4.chunk.js.map → node_modules_prop-types_index_js.33ef8ebd.chunk.js.map} +1 -1
- package/admin/rules/static/js/node_modules_react_index_js.a7ba3bfd.chunk.js +11 -0
- package/admin/rules/static/js/node_modules_react_index_js.a7ba3bfd.chunk.js.map +1 -0
- package/admin/rules/static/js/{src_ActionVisu_jsx.e5871f1f.chunk.js → src_ActionVisu_jsx.df7b4b10.chunk.js} +2 -2
- package/admin/rules/static/js/{src_ActionVisu_jsx.e5871f1f.chunk.js.map → src_ActionVisu_jsx.df7b4b10.chunk.js.map} +1 -1
- package/admin/rules/static/js/vendors-node_modules_iobroker_adapter-react-v5_build_index_js.c019ce26.chunk.js +1037 -0
- package/admin/rules/static/js/vendors-node_modules_iobroker_adapter-react-v5_build_index_js.c019ce26.chunk.js.map +1 -0
- package/admin/rules/static/js/vendors-node_modules_react-dom_index_js.7a914b58.chunk.js +26 -0
- package/admin/rules/static/js/vendors-node_modules_react-dom_index_js.7a914b58.chunk.js.map +1 -0
- package/io-package.json +31 -27
- package/lib/alexaSmartHomeV2.js +68 -19
- package/lib/notifications.js +37 -0
- package/main.js +26 -17
- package/package.json +9 -9
- package/admin/assets/index-CS3uF5ZS.js +0 -639
- package/admin/rules/static/js/main.aeb070a1.js +0 -5
- package/admin/rules/static/js/main.aeb070a1.js.map +0 -1
- package/admin/rules/static/js/node_modules_prop-types_index_js.998adfa4.chunk.js +0 -3
- package/admin/rules/static/js/node_modules_react-dom_index_js-_ef070.106c4109.chunk.js +0 -11
- package/admin/rules/static/js/node_modules_react-dom_index_js-_ef070.106c4109.chunk.js.map +0 -1
- package/admin/rules/static/js/node_modules_react-dom_index_js-_ef071.a71f5d5d.chunk.js +0 -11
- package/admin/rules/static/js/node_modules_react-dom_index_js-_ef071.a71f5d5d.chunk.js.map +0 -1
- package/admin/rules/static/js/node_modules_react_index_js.d0cc0ba3.chunk.js +0 -11
- package/admin/rules/static/js/node_modules_react_index_js.d0cc0ba3.chunk.js.map +0 -1
- package/admin/rules/static/js/vendors-node_modules_iobroker_adapter-react-v5_build_index_js.892c0b30.chunk.js +0 -1037
- package/admin/rules/static/js/vendors-node_modules_iobroker_adapter-react-v5_build_index_js.892c0b30.chunk.js.map +0 -1
package/io-package.json
CHANGED
|
@@ -1,8 +1,34 @@
|
|
|
1
1
|
{
|
|
2
2
|
"common": {
|
|
3
3
|
"name": "iot",
|
|
4
|
-
"version": "3.
|
|
4
|
+
"version": "3.5.0",
|
|
5
5
|
"news": {
|
|
6
|
+
"3.5.0": {
|
|
7
|
+
"en": "added notification manager support (notifications will be sent as push notifications to the Visu App)",
|
|
8
|
+
"de": "unterstützung von Benachrichtigungsmanagern (Anmerkungen werden als Push-Benachrichtigungen an die Visu App gesendet)",
|
|
9
|
+
"ru": "добавлена поддержка менеджера уведомлений (уведомления будут отправляться в виде push-уведомлений в приложение Visu)",
|
|
10
|
+
"pt": "suporte adicional do gerenciador de notificações (as notificações serão enviadas como notificações push para o Visu App)",
|
|
11
|
+
"nl": "toegevoegde notificatiemanager ondersteuning (meldingen worden verzonden als push notificaties naar de Visu App)",
|
|
12
|
+
"fr": "support du gestionnaire de notification ajouté (les notifications seront envoyées sous forme de notifications poussées à l'application Visu)",
|
|
13
|
+
"it": "supporto del gestore di notifiche aggiunto (le notifiche verranno inviate come notifiche push all'App Visu)",
|
|
14
|
+
"es": "apoyo añadido al administrador de notificaciones (las notificaciones se enviarán como notificaciones push a la aplicación Visu)",
|
|
15
|
+
"pl": "dodane wsparcie menedżera powiadomień (powiadomienia będą wysyłane jako powiadomienia do aplikacji Visu)",
|
|
16
|
+
"uk": "додана підтримка менеджера повідомлень (повідомлення буде відправлено як поштові повідомлення до додатку Visu)",
|
|
17
|
+
"zh-cn": "新增通知管理器支持( 通知将作为推送通知发送给 Visu App)"
|
|
18
|
+
},
|
|
19
|
+
"3.4.5": {
|
|
20
|
+
"en": "Checked the max length of discovered devices for Alexa",
|
|
21
|
+
"de": "Überprüfte die maximale Länge der entdeckten Geräte für Alexa",
|
|
22
|
+
"ru": "Проверка максимальной длины обнаруженных устройств для Alexa",
|
|
23
|
+
"pt": "Verificado o comprimento máximo de dispositivos descobertos para Alexa",
|
|
24
|
+
"nl": "De maximale lengte van ontdekte apparaten voor Alexa gecontroleerd",
|
|
25
|
+
"fr": "Vérification de la longueur maximale des appareils découverts pour Alexa",
|
|
26
|
+
"it": "Controllata la lunghezza massima di dispositivi scoperti per Alexa",
|
|
27
|
+
"es": "Compruebe la longitud máxima de los dispositivos descubiertos para Alexa",
|
|
28
|
+
"pl": "Sprawdziliśmy maksymalną długość odkrytych urządzeń dla Alexa",
|
|
29
|
+
"uk": "Перевірити максимальну довжину відкритих пристроїв для Alexa",
|
|
30
|
+
"zh-cn": "为 Alexa 检查了已发现设备的最大长度"
|
|
31
|
+
},
|
|
6
32
|
"3.4.4": {
|
|
7
33
|
"en": "Corrected the name editing of the devices for Alexa 3",
|
|
8
34
|
"de": "Korrektur der Namensbearbeitung der Geräte für Alexa 3",
|
|
@@ -67,32 +93,6 @@
|
|
|
67
93
|
"pl": "Popraw błąd przy ponownym połączeniu\nprzygotowany adapter do nowego jOBrokera Stan aplikacji Visu",
|
|
68
94
|
"uk": "Виправлення помилки на відключенні\nготовий адаптер для нового ioBroker Вису застосунки",
|
|
69
95
|
"zh-cn": "重新连接时修正错误\n为新 ioBroker 准备适配器 Visu 应用程序状态"
|
|
70
|
-
},
|
|
71
|
-
"3.2.2": {
|
|
72
|
-
"en": "remove some warnings which should only be debug log",
|
|
73
|
-
"de": "einige warnungen entfernen, die nur debug log sein sollten",
|
|
74
|
-
"ru": "удалить некоторые предупреждения, которые должны быть только отладочным журналом",
|
|
75
|
-
"pt": "remover alguns avisos que só devem ser debug log",
|
|
76
|
-
"nl": "sommige waarschuwingen verwijderen die alleen debuglog mogen zijn",
|
|
77
|
-
"fr": "supprimer quelques avertissements qui ne devraient être que debug log",
|
|
78
|
-
"it": "rimuovere alcuni avvisi che dovrebbero essere solo debug log",
|
|
79
|
-
"es": "eliminar algunas advertencias que sólo deben ser debug log",
|
|
80
|
-
"pl": "usunąć niektóre ostrzeżenia, które powinny być tylko logi debugowania",
|
|
81
|
-
"uk": "видалення деяких попереджень, які повинні бути вилучені",
|
|
82
|
-
"zh-cn": "删除一些只应该为调试日志的警告"
|
|
83
|
-
},
|
|
84
|
-
"3.2.1": {
|
|
85
|
-
"en": "fixed issue that only valid JSON could be sent to app via message state",
|
|
86
|
-
"de": "festes Problem, dass nur gültig JSON per Nachrichtenzustand an die App gesendet werden konnte",
|
|
87
|
-
"ru": "фиксированный вопрос, который может быть отправлен только действительным JSON через состояние сообщения",
|
|
88
|
-
"pt": "problema fixo que só JSON válido poderia ser enviado para aplicativo via estado de mensagem",
|
|
89
|
-
"nl": "vast probleem dat alleen geldige JSON via berichtstatus naar de app kan worden verzonden",
|
|
90
|
-
"fr": "problème corrigé que seul JSON valide pourrait être envoyé à l'application via l'état du message",
|
|
91
|
-
"it": "problema fisso che solo valido JSON potrebbe essere inviato all'app tramite lo stato del messaggio",
|
|
92
|
-
"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",
|
|
93
|
-
"pl": "stałe wydanie, że tylko poprawny JSON może być wysłany do aplikacji przez stan wiadomości",
|
|
94
|
-
"uk": "виправлено проблему, що тільки дійсний JSON може бути відправлений на додаток через стан повідомлень",
|
|
95
|
-
"zh-cn": "只能通过消息状态发送到应用程序的 JSON 的固定问题"
|
|
96
96
|
}
|
|
97
97
|
},
|
|
98
98
|
"titleLang": {
|
|
@@ -142,6 +142,10 @@
|
|
|
142
142
|
"extIcon": "https://raw.githubusercontent.com/ioBroker/ioBroker.iot/master/admin/iot.png",
|
|
143
143
|
"type": "communication",
|
|
144
144
|
"messagebox": true,
|
|
145
|
+
"supportedMessages": {
|
|
146
|
+
"custom": true,
|
|
147
|
+
"notifications": true
|
|
148
|
+
},
|
|
145
149
|
"stopBeforeUpdate": true,
|
|
146
150
|
"materialize": true,
|
|
147
151
|
"logTransporter": true,
|
package/lib/alexaSmartHomeV2.js
CHANGED
|
@@ -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
|
|
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
|
|
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
|
-
}
|
|
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
|
});
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Build up a mail object from the notification message
|
|
3
|
+
*
|
|
4
|
+
* @param message received message from notification manager
|
|
5
|
+
* @returns message to send to app
|
|
6
|
+
*/
|
|
7
|
+
function buildMessageFromNotification(message) {
|
|
8
|
+
const subject = message.category.name;
|
|
9
|
+
const { instances } = message.category;
|
|
10
|
+
|
|
11
|
+
const readableInstances = Object.entries(instances).map(
|
|
12
|
+
([instance, entry]) => `${instance.substring('system.adapter.'.length)}: ${getNewestMessage(entry.messages)}`,
|
|
13
|
+
);
|
|
14
|
+
|
|
15
|
+
const text = `${message.category.description}
|
|
16
|
+
${message.host}:
|
|
17
|
+
${readableInstances.join('\n')}
|
|
18
|
+
`;
|
|
19
|
+
|
|
20
|
+
return { title: subject, message: text };
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* Extract the newest message out of a notification messages together with the localized date
|
|
25
|
+
*
|
|
26
|
+
* @param messages all messages in current notification
|
|
27
|
+
* @returns string
|
|
28
|
+
*/
|
|
29
|
+
function getNewestMessage(messages) {
|
|
30
|
+
const newestMessage = messages.sort((a, b) => (a.ts < b.ts ? 1 : -1))[0];
|
|
31
|
+
|
|
32
|
+
return `${new Date(newestMessage.ts).toLocaleString()} ${newestMessage.message}`;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
module.exports = {
|
|
36
|
+
buildMessageFromNotification,
|
|
37
|
+
};
|
package/main.js
CHANGED
|
@@ -11,6 +11,7 @@ const GoogleHome = require('./lib/googleHome');
|
|
|
11
11
|
const YandexAlisa = require('./lib/alisa');
|
|
12
12
|
const Remote = require('./lib/remote');
|
|
13
13
|
const { handleGeofenceData, handleDevicesData, handleSendToAdapter, handleGetInstances } = require('./lib/visuApp.js');
|
|
14
|
+
const { buildMessageFromNotification } = require('./lib/notifications');
|
|
14
15
|
|
|
15
16
|
const packageJSON = JSON.parse(readFileSync(`${__dirname}/package.json`, 'utf8'));
|
|
16
17
|
|
|
@@ -27,11 +28,9 @@ let alexaCustom = null;
|
|
|
27
28
|
let yandexAlisa = null;
|
|
28
29
|
let remote = null;
|
|
29
30
|
let device = null;
|
|
30
|
-
let defaultHistory = null;
|
|
31
31
|
let urlKey = '';
|
|
32
32
|
|
|
33
33
|
let connected = false;
|
|
34
|
-
let uuid = null;
|
|
35
34
|
let secret;
|
|
36
35
|
let adapter;
|
|
37
36
|
let connectStarted;
|
|
@@ -312,7 +311,19 @@ function startAdapter(options) {
|
|
|
312
311
|
obj.callback && adapter.sendTo(obj.from, obj.command, result, obj.callback);
|
|
313
312
|
}
|
|
314
313
|
break;
|
|
315
|
-
|
|
314
|
+
case 'sendNotification':
|
|
315
|
+
try {
|
|
316
|
+
const { message, title } = buildMessageFromNotification(obj.message);
|
|
317
|
+
await sendMessageToApp(JSON.stringify({ message, title }));
|
|
318
|
+
if (obj.callback) {
|
|
319
|
+
adapter.sendTo(obj.from, 'sendNotification', { sent: true }, obj.callback);
|
|
320
|
+
}
|
|
321
|
+
} catch {
|
|
322
|
+
if (obj.callback) {
|
|
323
|
+
adapter.sendTo(obj.from, 'sendNotification', { sent: false }, obj.callback);
|
|
324
|
+
}
|
|
325
|
+
}
|
|
326
|
+
break;
|
|
316
327
|
default:
|
|
317
328
|
adapter.log.warn(`Unknown command: ${obj.command}`);
|
|
318
329
|
break;
|
|
@@ -432,8 +443,8 @@ async function sendMessageToApp(message) {
|
|
|
432
443
|
|
|
433
444
|
json.ttlSeconds = parseInt(json.ttlSeconds, 0) || undefined;
|
|
434
445
|
|
|
435
|
-
if (json.ttlSeconds && json.ttlSeconds >
|
|
436
|
-
json.ttlSeconds =
|
|
446
|
+
if (json.ttlSeconds && json.ttlSeconds > 3_600 * 48) {
|
|
447
|
+
json.ttlSeconds = 3_600 * 48;
|
|
437
448
|
}
|
|
438
449
|
|
|
439
450
|
if (!json.message) {
|
|
@@ -467,7 +478,9 @@ async function controlState(id, data) {
|
|
|
467
478
|
if (!obj || !obj.common) {
|
|
468
479
|
throw new Error(`Unknown ID: ${data.id}`);
|
|
469
480
|
} else {
|
|
470
|
-
if (typeof data.val === 'string')
|
|
481
|
+
if (typeof data.val === 'string') {
|
|
482
|
+
data.val = data.val.replace(/^@ifttt\s?/, '');
|
|
483
|
+
}
|
|
471
484
|
if (obj.common.type === 'boolean') {
|
|
472
485
|
data.val =
|
|
473
486
|
data.val === true ||
|
|
@@ -573,7 +586,7 @@ function onDisconnect(event) {
|
|
|
573
586
|
adapter.log.error(
|
|
574
587
|
`Two devices are trying to connect with the same iot account. This is not allowed. Stopping`,
|
|
575
588
|
);
|
|
576
|
-
adapter.getForeignObjectAsync(
|
|
589
|
+
adapter.getForeignObjectAsync(`system.adapter.${adapter.namespace}`).then(obj => {
|
|
577
590
|
obj.common.enabled = false;
|
|
578
591
|
return adapter.setForeignObjectAsync(obj._id, obj);
|
|
579
592
|
});
|
|
@@ -688,7 +701,7 @@ async function readCertificates() {
|
|
|
688
701
|
throw new Error('Not exists');
|
|
689
702
|
}
|
|
690
703
|
|
|
691
|
-
if (!certificate
|
|
704
|
+
if (!certificate?.val || !privateKey?.val) {
|
|
692
705
|
throw new Error('Not exists');
|
|
693
706
|
} else {
|
|
694
707
|
return {
|
|
@@ -746,10 +759,9 @@ async function fetchCertificates(login, pass, _forceUserCreation) {
|
|
|
746
759
|
private: response.data.certificates.keyPair.PrivateKey,
|
|
747
760
|
certificate: response.data.certificates.certificatePem,
|
|
748
761
|
};
|
|
749
|
-
} else {
|
|
750
|
-
adapter.log.error(`Cannot fetch connection certificates: ${JSON.stringify(response.data)}`);
|
|
751
|
-
throw new Error(response.data);
|
|
752
762
|
}
|
|
763
|
+
adapter.log.error(`Cannot fetch connection certificates: ${JSON.stringify(response.data)}`);
|
|
764
|
+
throw new Error(response.data);
|
|
753
765
|
}
|
|
754
766
|
|
|
755
767
|
function sendToAsync(instance, command, request) {
|
|
@@ -792,9 +804,8 @@ async function processMessage(type, request) {
|
|
|
792
804
|
return response;
|
|
793
805
|
})
|
|
794
806
|
.catch(err => adapter.log.error(`Error in processing of remote request: ${err.toString()}`));
|
|
795
|
-
} else {
|
|
796
|
-
adapter.log.error(`Received command, but remote already closed.`);
|
|
797
807
|
}
|
|
808
|
+
adapter.log.error(`Received command, but remote already closed.`);
|
|
798
809
|
} else if (type.startsWith('nightscout')) {
|
|
799
810
|
if (adapter.config.nightscout) {
|
|
800
811
|
let state = await adapter.getForeignStateAsync(
|
|
@@ -899,7 +910,6 @@ async function processMessage(type, request) {
|
|
|
899
910
|
}
|
|
900
911
|
|
|
901
912
|
try {
|
|
902
|
-
/** @type {{ command?: string; presence?: Record<string, boolean>, devices?: Record<string, any> }} */
|
|
903
913
|
const visuData = JSON.parse(request);
|
|
904
914
|
|
|
905
915
|
if (visuData.presence) {
|
|
@@ -951,10 +961,9 @@ async function processMessage(type, request) {
|
|
|
951
961
|
return { result: err };
|
|
952
962
|
}
|
|
953
963
|
return { result: 'Ok' };
|
|
954
|
-
} else {
|
|
955
|
-
adapter.log.warn('Received service text2command, but instance is not defined');
|
|
956
|
-
return { result: 'but instance is not defined' };
|
|
957
964
|
}
|
|
965
|
+
adapter.log.warn('Received service text2command, but instance is not defined');
|
|
966
|
+
return { result: 'but instance is not defined' };
|
|
958
967
|
} else if (type.startsWith('simpleApi')) {
|
|
959
968
|
return { result: 'not implemented' };
|
|
960
969
|
} else if (isCustom) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "iobroker.iot",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.5.0",
|
|
4
4
|
"description": "This adapter allows to communicate Amazon Alexa and Google Home with ioBroker.",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "bluefox",
|
|
@@ -23,25 +23,25 @@
|
|
|
23
23
|
},
|
|
24
24
|
"dependencies": {
|
|
25
25
|
"@iobroker/adapter-core": "^3.2.3",
|
|
26
|
-
"@iobroker/types": "^7.0.5",
|
|
27
26
|
"aws-iot-device-sdk": "^2.2.15",
|
|
27
|
+
"axios": "^1.7.9",
|
|
28
28
|
"iobroker.type-detector": "^3.0.5",
|
|
29
29
|
"mime": "^3.0.0",
|
|
30
|
-
"
|
|
31
|
-
"uuid": "^11.0.3"
|
|
30
|
+
"uuid": "^11.0.5"
|
|
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.
|
|
36
|
+
"@iobroker/build-tools": "^2.0.13",
|
|
38
37
|
"@iobroker/eslint-config": "^1.0.0",
|
|
39
|
-
"@iobroker/legacy-testing": "^2.0.
|
|
40
|
-
"@types
|
|
38
|
+
"@iobroker/legacy-testing": "^2.0.2",
|
|
39
|
+
"@iobroker/types": "^7.0.6",
|
|
40
|
+
"@types/node": "^22.13.0",
|
|
41
41
|
"chai": "^4.5.0",
|
|
42
42
|
"colorette": "^2.0.20",
|
|
43
|
-
"mocha": "^11.0
|
|
44
|
-
"puppeteer": "^23.
|
|
43
|
+
"mocha": "^11.1.0",
|
|
44
|
+
"puppeteer": "^23.11.1"
|
|
45
45
|
},
|
|
46
46
|
"bugs": {
|
|
47
47
|
"url": "https://github.com/ioBroker/ioBroker.iot/issues"
|