iobroker.iot 4.0.2 → 4.0.3
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 +3 -0
- package/admin/assets/index-BjEWVyqN.js +681 -0
- package/admin/index_m.html +1 -1
- package/admin/rules/assets/{ActionVisu-D9x2f6zu.js → ActionVisu-DE8dgNVF.js} +1 -1
- package/admin/rules/assets/{ActionVisu__loadShare__react__loadShare__-Cg21Ef1U.js → ActionVisu__loadShare__react__loadShare__-BKaC-p5K.js} +1 -1
- package/admin/rules/assets/{ActionVisu__loadShare__react_mf_2_dom__loadShare__-B1zRWn0u.js → ActionVisu__loadShare__react_mf_2_dom__loadShare__-Bs1o8DtQ.js} +2 -2
- package/admin/rules/assets/ActionVisu__mf_v__runtimeInit__mf_v__-DtUoI3FU.js +5 -0
- package/admin/rules/assets/bootstrap-Ba57tu25.js +1 -0
- package/admin/rules/assets/hostInit-hos3Txsy.js +1 -1
- package/admin/rules/assets/{index-Duo7mFlZ.js → index-CbxmbJvB.js} +2 -2
- package/admin/rules/assets/{index-CAAeiKCc.js → index-DjPMvPni.js} +2 -2
- package/admin/rules/assets/index-_Y2FN5EZ.js +1152 -0
- package/admin/rules/assets/{virtualExposes-BqVak7rX.js → virtualExposes-BNZJTatg.js} +2 -2
- package/admin/rules/customRuleBlocks.js +2 -2
- package/build-backend/lib/alexaCustom.js +71 -60
- package/build-backend/lib/alexaCustom.js.map +1 -1
- package/io-package.json +14 -14
- package/package.json +1 -1
- package/admin/assets/index-5zouxn2w.js +0 -680
- package/admin/rules/assets/ActionVisu__mf_v__runtimeInit__mf_v__-Cz053nO7.js +0 -10
- package/admin/rules/assets/bootstrap-BCFKIiwZ.js +0 -1
- package/admin/rules/assets/index-DwYdaT5M.js +0 -1151
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./ActionVisu-
|
|
2
|
-
import{_ as o}from"./preload-helper-Dp1pzeXC.js";const a={"./ActionVisu":async()=>{const t=await o(()=>import("./ActionVisu-
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./ActionVisu-DE8dgNVF.js","./ActionVisu__mf_v__runtimeInit__mf_v__-DtUoI3FU.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{_ as o}from"./preload-helper-Dp1pzeXC.js";const a={"./ActionVisu":async()=>{const t=await o(()=>import("./ActionVisu-DE8dgNVF.js"),__vite__mapDeps([0,1]),import.meta.url),e={};return Object.assign(e,t),Object.defineProperty(e,"__esModule",{value:!0,enumerable:!1}),e}};export{a as default};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./assets/index-
|
|
2
|
-
import{i as m,A as p}from"./assets/ActionVisu__mf_v__runtimeInit__mf_v__-
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./assets/index-_Y2FN5EZ.js","./assets/ActionVisu__loadShare__react__loadShare__-BKaC-p5K.js","./assets/_commonjsHelpers-Cpj98o6Y.js","./assets/ActionVisu__mf_v__runtimeInit__mf_v__-DtUoI3FU.js","./assets/ActionVisu__loadShare__react_mf_2_dom__loadShare__-Bs1o8DtQ.js","./assets/index-Do-nCdWy.js","./assets/index-DjPMvPni.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{i as m,A as p}from"./assets/ActionVisu__mf_v__runtimeInit__mf_v__-DtUoI3FU.js";import s from"./assets/virtualExposes-BNZJTatg.js";import{_ as n}from"./assets/preload-helper-Dp1pzeXC.js";const i={"@iobroker/adapter-react-v5":async()=>await n(()=>import("./assets/index-_Y2FN5EZ.js"),__vite__mapDeps([0,1,2,3,4]),import.meta.url),react:async()=>await n(()=>import("./assets/index-Do-nCdWy.js").then(t=>t.i),__vite__mapDeps([5,2]),import.meta.url),"react-dom":async()=>await n(()=>import("./assets/index-DjPMvPni.js").then(t=>t.i),__vite__mapDeps([6,2,1,3]),import.meta.url)},a={"@iobroker/adapter-react-v5":{name:"@iobroker/adapter-react-v5",version:"7.7.2",scope:["default"],loaded:!1,from:"ActionVisu",async get(){a["@iobroker/adapter-react-v5"].loaded=!0;const{"@iobroker/adapter-react-v5":e}=i,r={...await e()};return Object.defineProperty(r,"__esModule",{value:!0,enumerable:!1}),function(){return r}},shareConfig:{singleton:!0,requiredVersion:"*"}},react:{name:"react",version:"18.3.1",scope:["default"],loaded:!1,from:"ActionVisu",async get(){a.react.loaded=!0;const{react:e}=i,r={...await e()};return Object.defineProperty(r,"__esModule",{value:!0,enumerable:!1}),function(){return r}},shareConfig:{singleton:!0,requiredVersion:"*"}},"react-dom":{name:"react-dom",version:"18.3.1",scope:["default"],loaded:!1,from:"ActionVisu",async get(){a["react-dom"].loaded=!0;const{"react-dom":e}=i,r={...await e()};return Object.defineProperty(r,"__esModule",{value:!0,enumerable:!1}),function(){return r}},shareConfig:{singleton:!0,requiredVersion:"*"}}},f=[],u={},c="default",d="ActionVisu";async function k(e={},t=[]){const r=m({name:d,remotes:f,shared:a,plugins:[],shareStrategy:"version-first"});var o=u[c];if(o||(o=u[c]={from:d}),!(t.indexOf(o)>=0)){t.push(o),r.initShareScopeMap("default",e);try{await Promise.all(await r.initializeSharing("default",{strategy:"version-first",from:"build",initScope:t}))}catch(l){console.error(l)}return p.initResolve(r),r}}function y(e){if(!(e in s))throw new Error(`Module ${e} does not exist in container.`);return s[e]().then(t=>()=>t)}export{y as get,k as init};
|
|
@@ -16,7 +16,6 @@ class AlexaCustom {
|
|
|
16
16
|
openSessions = {};
|
|
17
17
|
knownDevices = {};
|
|
18
18
|
knownUsers = {};
|
|
19
|
-
lastSkillRequestWasV2 = false;
|
|
20
19
|
config;
|
|
21
20
|
adapter;
|
|
22
21
|
constructor(adapter) {
|
|
@@ -53,7 +52,7 @@ class AlexaCustom {
|
|
|
53
52
|
#writeResponse(_channelId, _stateId, _command, _value) {
|
|
54
53
|
// adapter.log.warn('[CUSTOM] Unknown applianceId: ' + deviceId);
|
|
55
54
|
}
|
|
56
|
-
#getResponseV1(text, repromptText, shouldEndSession) {
|
|
55
|
+
#getResponseV1(text, repromptText, requestId, shouldEndSession) {
|
|
57
56
|
let speechPlainText = text;
|
|
58
57
|
let speechType = 'PlainText';
|
|
59
58
|
if (text.startsWith('<speak>')) {
|
|
@@ -67,11 +66,14 @@ class AlexaCustom {
|
|
|
67
66
|
const response = {
|
|
68
67
|
version: '1.0',
|
|
69
68
|
sessionAttributes: {},
|
|
69
|
+
responseId: requestId,
|
|
70
70
|
response: {
|
|
71
|
-
outputSpeech:
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
71
|
+
outputSpeech: speechType === 'PlainText'
|
|
72
|
+
? {
|
|
73
|
+
type: 'PlainText',
|
|
74
|
+
text,
|
|
75
|
+
}
|
|
76
|
+
: { type: 'SSML', ssml: `text` },
|
|
75
77
|
card: {
|
|
76
78
|
content: speechPlainText,
|
|
77
79
|
title: (0, texts_1.default)(this.lang, 'Answer from ioBroker') || 'ioBroker',
|
|
@@ -82,16 +84,21 @@ class AlexaCustom {
|
|
|
82
84
|
};
|
|
83
85
|
if (repromptText) {
|
|
84
86
|
response.response.reprompt = {
|
|
85
|
-
outputSpeech:
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
87
|
+
outputSpeech: repromptType === 'PlainText'
|
|
88
|
+
? {
|
|
89
|
+
type: 'PlainText',
|
|
90
|
+
text: repromptText,
|
|
91
|
+
}
|
|
92
|
+
: {
|
|
93
|
+
type: 'SSML',
|
|
94
|
+
ssml: repromptText,
|
|
95
|
+
},
|
|
89
96
|
};
|
|
90
97
|
}
|
|
91
98
|
return response;
|
|
92
99
|
}
|
|
93
|
-
#getResponseV2(text, repromptText, shouldEndSession) {
|
|
94
|
-
const response = this.#getResponseV1(text, repromptText, shouldEndSession);
|
|
100
|
+
#getResponseV2(text, repromptText, requestId, shouldEndSession) {
|
|
101
|
+
const response = this.#getResponseV1(text, repromptText, requestId, shouldEndSession);
|
|
95
102
|
if (!shouldEndSession) {
|
|
96
103
|
// We redirect the user to the Dialog Intent to capture the full traffic
|
|
97
104
|
response.response.directives = [
|
|
@@ -167,7 +174,8 @@ class AlexaCustom {
|
|
|
167
174
|
}
|
|
168
175
|
processAfter(request, text, shouldEndSession, callback) {
|
|
169
176
|
void this.adapter.setState('smart.lastResponse', text, true);
|
|
170
|
-
const sessionId = request.session
|
|
177
|
+
const sessionId = request.session?.sessionId || '';
|
|
178
|
+
const requestId = request.request?.requestId || '';
|
|
171
179
|
if (this.openSessions[sessionId].responseTimer) {
|
|
172
180
|
clearTimeout(this.openSessions[sessionId].responseTimer);
|
|
173
181
|
this.openSessions[sessionId].responseTimer = null;
|
|
@@ -178,18 +186,18 @@ class AlexaCustom {
|
|
|
178
186
|
? this.openSessions[sessionId].isV2Skill
|
|
179
187
|
: !!request.customSkillV2;
|
|
180
188
|
if (isV2Skill) {
|
|
181
|
-
callback(this.#getResponseV2(text, null, shouldEndSession));
|
|
189
|
+
callback(this.#getResponseV2(text, null, requestId, shouldEndSession));
|
|
182
190
|
}
|
|
183
191
|
else {
|
|
184
|
-
callback(this.#getResponseV1(text, null, shouldEndSession));
|
|
192
|
+
callback(this.#getResponseV1(text, null, requestId, shouldEndSession));
|
|
185
193
|
}
|
|
186
194
|
}
|
|
187
195
|
touchSession(sessionId, isV2Skill) {
|
|
188
|
-
if (this.openSessions[sessionId]
|
|
196
|
+
if (this.openSessions[sessionId]?.expiryTimer) {
|
|
189
197
|
clearTimeout(this.openSessions[sessionId].expiryTimer);
|
|
190
198
|
this.openSessions[sessionId].expiryTimer = null;
|
|
191
199
|
}
|
|
192
|
-
this.openSessions[sessionId]
|
|
200
|
+
this.openSessions[sessionId] ||= {
|
|
193
201
|
expiryTimer: null,
|
|
194
202
|
responseTimer: null,
|
|
195
203
|
request: null,
|
|
@@ -201,7 +209,7 @@ class AlexaCustom {
|
|
|
201
209
|
}, 60000); // latest after 10 mins we declare a session as closed
|
|
202
210
|
}
|
|
203
211
|
deleteSession(sessionId) {
|
|
204
|
-
if (this.openSessions[sessionId]
|
|
212
|
+
if (this.openSessions[sessionId]?.expiryTimer) {
|
|
205
213
|
clearTimeout(this.openSessions[sessionId].expiryTimer);
|
|
206
214
|
}
|
|
207
215
|
delete this.openSessions[sessionId];
|
|
@@ -254,53 +262,53 @@ class AlexaCustom {
|
|
|
254
262
|
return { error: 'Invalid request: no intent!' };
|
|
255
263
|
}
|
|
256
264
|
const isV2Skill = !!request.customSkillV2;
|
|
257
|
-
this.lastSkillRequestWasV2 = isV2Skill;
|
|
258
265
|
const getResponse = isV2Skill ? this.#getResponseV2 : this.#getResponseV1;
|
|
266
|
+
const requestId = request.request?.requestId || '';
|
|
259
267
|
if (!isEnabled) {
|
|
260
268
|
if (this.lang === 'en') {
|
|
261
|
-
return getResponse('The service is not activated. Please enable Alexa integration in the iot Adapter.', null, true);
|
|
269
|
+
return getResponse('The service is not activated. Please enable Alexa integration in the iot Adapter.', null, requestId, true);
|
|
262
270
|
}
|
|
263
271
|
if (this.lang === 'ru') {
|
|
264
|
-
return getResponse('Услуга не активирована. Включите интеграцию Alexa в адаптере Интернета вещей.', null, true);
|
|
272
|
+
return getResponse('Услуга не активирована. Включите интеграцию Alexa в адаптере Интернета вещей.', null, requestId, true);
|
|
265
273
|
}
|
|
266
|
-
return getResponse('Der Service ist nicht aktiviert. Bitte aktiviere die Alex-Integration im iot-Adapter um Ihn zu aktivieren.', null, true);
|
|
274
|
+
return getResponse('Der Service ist nicht aktiviert. Bitte aktiviere die Alex-Integration im iot-Adapter um Ihn zu aktivieren.', null, requestId, true);
|
|
267
275
|
}
|
|
268
|
-
const sessionId = request.session
|
|
269
|
-
this.adapter.log.debug(`Custom Skill ${isV2Skill ? 'V2' : 'V1'} request: ${request.request.type}/${request.request.intent && request.request.intent.name} for session ${sessionId}, dialog: ${request.request.dialogState}`);
|
|
276
|
+
const sessionId = request.session?.sessionId || '';
|
|
270
277
|
if (request.request.type === 'LaunchRequest') {
|
|
271
278
|
this.adapter.log.debug(request.request.type);
|
|
272
279
|
this.touchSession(sessionId, isV2Skill);
|
|
273
280
|
if (this.lang === 'en') {
|
|
274
|
-
return getResponse('Hello, what do you want to know or control?', 'What do you want to know or control?');
|
|
281
|
+
return getResponse('Hello, what do you want to know or control?', 'What do you want to know or control?', requestId);
|
|
275
282
|
}
|
|
276
283
|
if (this.lang === 'ru') {
|
|
277
|
-
return getResponse('Привет. Что вы хотите знать или контролировать?', 'Что вы хотите знать или контролировать?');
|
|
284
|
+
return getResponse('Привет. Что вы хотите знать или контролировать?', 'Что вы хотите знать или контролировать?', requestId);
|
|
278
285
|
}
|
|
279
|
-
return getResponse('Hallo, was möchtest Du wissen oder steuern?', 'Was möchtest Du wissen oder steuern?');
|
|
286
|
+
return getResponse('Hallo, was möchtest Du wissen oder steuern?', 'Was möchtest Du wissen oder steuern?', requestId);
|
|
280
287
|
}
|
|
281
288
|
if (request.request.type === 'IntentRequest') {
|
|
289
|
+
this.adapter.log.debug(`Custom Skill ${isV2Skill ? 'V2' : 'V1'} request: ${request.request.type}/${request.request.intent?.name} for session ${sessionId}, dialog: ${request.request.dialogState}`);
|
|
282
290
|
if (request.request.intent) {
|
|
283
291
|
this.touchSession(sessionId, isV2Skill);
|
|
284
292
|
if (request.request.intent.name === 'AMAZON.HelpIntent') {
|
|
285
293
|
if (this.lang === 'en') {
|
|
286
|
-
return getResponse('This skill will pass all recognized words to your ioBroker installation and you can configure actions and responses there! What do you want to know or control?', 'What do you want to know or control?');
|
|
294
|
+
return getResponse('This skill will pass all recognized words to your ioBroker installation and you can configure actions and responses there! What do you want to know or control?', 'What do you want to know or control?', requestId);
|
|
287
295
|
}
|
|
288
296
|
if (this.lang === 'ru') {
|
|
289
|
-
return getResponse('Этот навык передаст все распознанные слова в вашу установку ioBroker, и вы сможете настроить действия и ответы там! Что вы хотите знать или контролировать?', 'Что вы хотите знать или контролировать?');
|
|
297
|
+
return getResponse('Этот навык передаст все распознанные слова в вашу установку ioBroker, и вы сможете настроить действия и ответы там! Что вы хотите знать или контролировать?', 'Что вы хотите знать или контролировать?', requestId);
|
|
290
298
|
}
|
|
291
|
-
return getResponse('Dieser Skill gibt alle erkannten Wörter an Deine ioBroker-Installation weiter und Du kannst dort Aktionen und Antworten konfigurieren! Was möchtest Du wissen oder steuern?', 'Was möchtest Du wissen oder steuern?');
|
|
299
|
+
return getResponse('Dieser Skill gibt alle erkannten Wörter an Deine ioBroker-Installation weiter und Du kannst dort Aktionen und Antworten konfigurieren! Was möchtest Du wissen oder steuern?', 'Was möchtest Du wissen oder steuern?', requestId);
|
|
292
300
|
}
|
|
293
301
|
else if (request.request.intent.name === 'AMAZON.CancelIntent' ||
|
|
294
302
|
request.request.intent.name === 'AMAZON.StopIntent') {
|
|
295
303
|
this.adapter.log.debug(request.request.intent.name);
|
|
296
304
|
this.deleteSession(sessionId);
|
|
297
305
|
if (this.lang === 'en') {
|
|
298
|
-
return getResponse('Goodbye!', null, true);
|
|
306
|
+
return getResponse('Goodbye!', null, requestId, true);
|
|
299
307
|
}
|
|
300
308
|
if (this.lang === 'ru') {
|
|
301
|
-
return getResponse('До скорого!', null, true);
|
|
309
|
+
return getResponse('До скорого!', null, requestId, true);
|
|
302
310
|
}
|
|
303
|
-
return getResponse('Bis bald!', null, true);
|
|
311
|
+
return getResponse('Bis bald!', null, requestId, true);
|
|
304
312
|
}
|
|
305
313
|
const textsLog = [];
|
|
306
314
|
const texts = [];
|
|
@@ -360,34 +368,36 @@ class AlexaCustom {
|
|
|
360
368
|
// No slots and nothing from above
|
|
361
369
|
this.adapter.log.warn(`Unexpected ALEXA Request: ${JSON.stringify(request)}`);
|
|
362
370
|
if (this.lang === 'en') {
|
|
363
|
-
return getResponse('I did not hear you. Please repeat your question!', null);
|
|
371
|
+
return getResponse('I did not hear you. Please repeat your question!', null, requestId);
|
|
364
372
|
}
|
|
365
373
|
if (this.lang === 'ru') {
|
|
366
|
-
return getResponse('Я не слышал тебя. Пожалуйста, повторите свой вопрос!', null);
|
|
374
|
+
return getResponse('Я не слышал тебя. Пожалуйста, повторите свой вопрос!', null, requestId);
|
|
367
375
|
}
|
|
368
|
-
return getResponse('Ich habe Dich nicht verstanden. Bitte wiederhole deine Frage!', null);
|
|
376
|
+
return getResponse('Ich habe Dich nicht verstanden. Bitte wiederhole deine Frage!', null, requestId);
|
|
369
377
|
}
|
|
378
|
+
const internRequest = request.request;
|
|
370
379
|
// collect all filled slots (v1 and v2 skill)
|
|
371
|
-
if (
|
|
372
|
-
const slots = Object.keys(
|
|
380
|
+
if (internRequest.intent.slots) {
|
|
381
|
+
const slots = Object.keys(internRequest.intent.slots);
|
|
373
382
|
slots.forEach(slotId => {
|
|
374
|
-
const slot =
|
|
383
|
+
const slot = internRequest.intent.slots[slotId];
|
|
375
384
|
let value = slot.value;
|
|
376
|
-
const resolution = slot.resolutions?.resolutionsPerAuthority
|
|
385
|
+
const resolution = slot.resolutions?.resolutionsPerAuthority &&
|
|
386
|
+
slot.resolutions.resolutionsPerAuthority.length > 0
|
|
377
387
|
? slot.resolutions.resolutionsPerAuthority[0]
|
|
378
388
|
: null;
|
|
379
|
-
if (resolution
|
|
389
|
+
if (resolution?.status.code === 'ER_SUCCESS_MATCH') {
|
|
380
390
|
const resolutionValue = resolution.values[0].value;
|
|
381
391
|
value = resolutionValue.name;
|
|
382
392
|
}
|
|
383
|
-
if (value
|
|
393
|
+
if (value?.length) {
|
|
384
394
|
texts.push(value);
|
|
385
395
|
textsLog.push(`${slotId} = ${value}`);
|
|
386
396
|
}
|
|
387
397
|
});
|
|
388
398
|
}
|
|
389
399
|
let text = texts.join(' ');
|
|
390
|
-
const intent =
|
|
400
|
+
const intent = internRequest.intent.name || '';
|
|
391
401
|
if (originalIntentName.startsWith('queryIntentStarteDialog')) {
|
|
392
402
|
// v2 Skill StarteDialog* intents are automatically handled without sending anywhere
|
|
393
403
|
let response = '';
|
|
@@ -414,18 +424,18 @@ class AlexaCustom {
|
|
|
414
424
|
response = 'Ja?';
|
|
415
425
|
}
|
|
416
426
|
}
|
|
417
|
-
return getResponse(response, response);
|
|
427
|
+
return getResponse(response, response, requestId);
|
|
418
428
|
}
|
|
419
429
|
if (intent === 'queryIntent' && stopPhrases[this.lang].includes(text.toLowerCase())) {
|
|
420
430
|
// v2 Skill when in dialog mode, we need to take care of the exit criteria ourselves
|
|
421
431
|
this.deleteSession(sessionId);
|
|
422
432
|
if (this.lang === 'en') {
|
|
423
|
-
return getResponse('Goodbye!', null, true);
|
|
433
|
+
return getResponse('Goodbye!', null, requestId, true);
|
|
424
434
|
}
|
|
425
435
|
if (this.lang === 'ru') {
|
|
426
|
-
return getResponse('До скорого!', null, true);
|
|
436
|
+
return getResponse('До скорого!', null, requestId, true);
|
|
427
437
|
}
|
|
428
|
-
return getResponse('Bis bald!', null, true);
|
|
438
|
+
return getResponse('Bis bald!', null, requestId, true);
|
|
429
439
|
}
|
|
430
440
|
// v1 and v2 Skill
|
|
431
441
|
const deviceId = request?.context?.System?.device?.deviceId
|
|
@@ -457,15 +467,15 @@ class AlexaCustom {
|
|
|
457
467
|
await this.adapter.setStateAsync('smart.lastCommandObj', JSON.stringify(commandObj), true);
|
|
458
468
|
this.adapter.log.debug(`${intent}: ${textsLog.join(', ')}`);
|
|
459
469
|
if (intent) {
|
|
460
|
-
let
|
|
470
|
+
let textTimeout;
|
|
461
471
|
if (this.lang === 'en') {
|
|
462
|
-
|
|
472
|
+
textTimeout = `Processing of ${text} is not possible!`;
|
|
463
473
|
}
|
|
464
474
|
else if (this.lang === 'ru') {
|
|
465
|
-
|
|
475
|
+
textTimeout = `Обработка ${text} не возможна!`;
|
|
466
476
|
}
|
|
467
477
|
else {
|
|
468
|
-
|
|
478
|
+
textTimeout = `Die Verarbeitung von ${text} ist nicht möglich!`;
|
|
469
479
|
}
|
|
470
480
|
if (this.config.text2command !== null &&
|
|
471
481
|
this.config.text2command !== undefined &&
|
|
@@ -476,7 +486,7 @@ class AlexaCustom {
|
|
|
476
486
|
this.openSessions[sessionId].responseTimer = setTimeout(() => {
|
|
477
487
|
this.openSessions[sessionId].responseTimer = null;
|
|
478
488
|
if (resolve) {
|
|
479
|
-
this.processAfter(request,
|
|
489
|
+
this.processAfter(request, textTimeout, true, resolve);
|
|
480
490
|
resolve = null;
|
|
481
491
|
}
|
|
482
492
|
}, 1000);
|
|
@@ -496,7 +506,7 @@ class AlexaCustom {
|
|
|
496
506
|
this.adapter.log.debug(`Response from text2command: ${typedResult.response}`);
|
|
497
507
|
void this.adapter.setState('smart.lastResponse', typedResult.response, true);
|
|
498
508
|
if (resolve) {
|
|
499
|
-
resolve(getResponse(typedResult.response, null, true));
|
|
509
|
+
resolve(getResponse(typedResult.response, null, requestId, true));
|
|
500
510
|
resolve = null;
|
|
501
511
|
}
|
|
502
512
|
});
|
|
@@ -508,30 +518,31 @@ class AlexaCustom {
|
|
|
508
518
|
clearTimeout(this.openSessions[sessionId].responseTimer);
|
|
509
519
|
this.openSessions[sessionId].callback = resolve;
|
|
510
520
|
this.openSessions[sessionId].request = request;
|
|
511
|
-
this.openSessions[sessionId].responseTimer = setTimeout(() => this.processAfter(request,
|
|
521
|
+
this.openSessions[sessionId].responseTimer = setTimeout(() => this.processAfter(request, textTimeout, true, resolve), 200);
|
|
512
522
|
});
|
|
513
523
|
}
|
|
514
524
|
if (this.lang === 'en') {
|
|
515
|
-
return getResponse('I did not understand the question!', null);
|
|
525
|
+
return getResponse('I did not understand the question!', null, requestId);
|
|
516
526
|
}
|
|
517
527
|
if (this.lang === 'ru') {
|
|
518
|
-
return getResponse('Я не поняла ваш вопрос!', null);
|
|
528
|
+
return getResponse('Я не поняла ваш вопрос!', null, requestId);
|
|
519
529
|
}
|
|
520
|
-
return getResponse('Ich habe Deine Frage nicht verstanden!', null);
|
|
530
|
+
return getResponse('Ich habe Deine Frage nicht verstanden!', null, requestId);
|
|
521
531
|
}
|
|
522
532
|
this.adapter.log.warn(`Unexpected ALEXA Request: ${JSON.stringify(request)}`);
|
|
523
533
|
if (this.lang === 'en') {
|
|
524
|
-
return getResponse('Please repeat your question!', null);
|
|
534
|
+
return getResponse('Please repeat your question!', null, requestId);
|
|
525
535
|
}
|
|
526
536
|
if (this.lang === 'ru') {
|
|
527
|
-
return getResponse('Пожалуйста, повторите вопрос!', null);
|
|
537
|
+
return getResponse('Пожалуйста, повторите вопрос!', null, requestId);
|
|
528
538
|
}
|
|
529
|
-
return getResponse('Bitte wiederhole die Frage!', null);
|
|
539
|
+
return getResponse('Bitte wiederhole die Frage!', null, requestId);
|
|
530
540
|
}
|
|
531
541
|
if (request.request.type === 'SessionEndedRequest') {
|
|
532
542
|
this.adapter.log.debug(`SessionEndedRequest: ${request.request.reason}`);
|
|
533
543
|
this.deleteSession(sessionId);
|
|
534
544
|
// Should not be called
|
|
545
|
+
// A skill cannot return a response to SessionEndedRequest.
|
|
535
546
|
return { error: 'Unexpected Session Ended' };
|
|
536
547
|
}
|
|
537
548
|
this.adapter.log.debug(`Unknown Request type: ${JSON.stringify(request)}`);
|