iobroker.iot 3.6.0 → 4.0.2
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 +8 -4
- package/admin/assets/index-5zouxn2w.js +680 -0
- package/admin/index_m.html +1 -1
- package/admin/rules/assets/{index-BRdNnGcA.js → index-DwYdaT5M.js} +80 -81
- package/admin/rules/customRuleBlocks.js +2 -2
- package/{lib → build-backend/lib}/AlexaSmartHomeV3/Alexa/AlexaResponse.js +101 -95
- package/build-backend/lib/AlexaSmartHomeV3/Alexa/AlexaResponse.js.map +1 -0
- package/{lib → build-backend/lib}/AlexaSmartHomeV3/Alexa/Capabilities/Base.js +22 -36
- package/build-backend/lib/AlexaSmartHomeV3/Alexa/Capabilities/Base.js.map +1 -0
- package/build-backend/lib/AlexaSmartHomeV3/Alexa/Capabilities/BrightnessController.js +19 -0
- package/build-backend/lib/AlexaSmartHomeV3/Alexa/Capabilities/BrightnessController.js.map +1 -0
- package/build-backend/lib/AlexaSmartHomeV3/Alexa/Capabilities/ColorController.js +14 -0
- package/build-backend/lib/AlexaSmartHomeV3/Alexa/Capabilities/ColorController.js.map +1 -0
- package/build-backend/lib/AlexaSmartHomeV3/Alexa/Capabilities/ColorTemperatureController.js +19 -0
- package/build-backend/lib/AlexaSmartHomeV3/Alexa/Capabilities/ColorTemperatureController.js.map +1 -0
- package/build-backend/lib/AlexaSmartHomeV3/Alexa/Capabilities/ContactSensor.js +16 -0
- package/build-backend/lib/AlexaSmartHomeV3/Alexa/Capabilities/ContactSensor.js.map +1 -0
- package/build-backend/lib/AlexaSmartHomeV3/Alexa/Capabilities/LockController.js +14 -0
- package/build-backend/lib/AlexaSmartHomeV3/Alexa/Capabilities/LockController.js.map +1 -0
- package/{lib → build-backend/lib}/AlexaSmartHomeV3/Alexa/Capabilities/ModeController.js +27 -28
- package/build-backend/lib/AlexaSmartHomeV3/Alexa/Capabilities/ModeController.js.map +1 -0
- package/build-backend/lib/AlexaSmartHomeV3/Alexa/Capabilities/MotionSensor.js +14 -0
- package/build-backend/lib/AlexaSmartHomeV3/Alexa/Capabilities/MotionSensor.js.map +1 -0
- package/build-backend/lib/AlexaSmartHomeV3/Alexa/Capabilities/PercentageController.js +14 -0
- package/build-backend/lib/AlexaSmartHomeV3/Alexa/Capabilities/PercentageController.js.map +1 -0
- package/build-backend/lib/AlexaSmartHomeV3/Alexa/Capabilities/PowerController.js +19 -0
- package/build-backend/lib/AlexaSmartHomeV3/Alexa/Capabilities/PowerController.js.map +1 -0
- package/build-backend/lib/AlexaSmartHomeV3/Alexa/Capabilities/Speaker.js +25 -0
- package/build-backend/lib/AlexaSmartHomeV3/Alexa/Capabilities/Speaker.js.map +1 -0
- package/build-backend/lib/AlexaSmartHomeV3/Alexa/Capabilities/TemperatureSensor.js +14 -0
- package/build-backend/lib/AlexaSmartHomeV3/Alexa/Capabilities/TemperatureSensor.js.map +1 -0
- package/build-backend/lib/AlexaSmartHomeV3/Alexa/Capabilities/ThermostatController.js +37 -0
- package/build-backend/lib/AlexaSmartHomeV3/Alexa/Capabilities/ThermostatController.js.map +1 -0
- package/build-backend/lib/AlexaSmartHomeV3/Alexa/Capabilities/index.js +32 -0
- package/build-backend/lib/AlexaSmartHomeV3/Alexa/Capabilities/index.js.map +1 -0
- package/build-backend/lib/AlexaSmartHomeV3/Alexa/Directives/Base.js +29 -0
- package/build-backend/lib/AlexaSmartHomeV3/Alexa/Directives/Base.js.map +1 -0
- package/{lib → build-backend/lib}/AlexaSmartHomeV3/Alexa/Directives/ChangeReport.js +34 -27
- package/build-backend/lib/AlexaSmartHomeV3/Alexa/Directives/ChangeReport.js.map +1 -0
- package/build-backend/lib/AlexaSmartHomeV3/Alexa/Directives/Discovery.js +39 -0
- package/build-backend/lib/AlexaSmartHomeV3/Alexa/Directives/Discovery.js.map +1 -0
- package/{lib → build-backend/lib}/AlexaSmartHomeV3/Alexa/Directives/ReportState.js +19 -22
- package/build-backend/lib/AlexaSmartHomeV3/Alexa/Directives/ReportState.js.map +1 -0
- package/build-backend/lib/AlexaSmartHomeV3/Alexa/Directives/index.js +14 -0
- package/build-backend/lib/AlexaSmartHomeV3/Alexa/Directives/index.js.map +1 -0
- package/build-backend/lib/AlexaSmartHomeV3/Alexa/ModeValues/Base.js +36 -0
- package/build-backend/lib/AlexaSmartHomeV3/Alexa/ModeValues/Base.js.map +1 -0
- package/build-backend/lib/AlexaSmartHomeV3/Alexa/ModeValues/Closed.js +57 -0
- package/build-backend/lib/AlexaSmartHomeV3/Alexa/ModeValues/Closed.js.map +1 -0
- package/build-backend/lib/AlexaSmartHomeV3/Alexa/ModeValues/Open.js +57 -0
- package/build-backend/lib/AlexaSmartHomeV3/Alexa/ModeValues/Open.js.map +1 -0
- package/build-backend/lib/AlexaSmartHomeV3/Alexa/ModeValues/index.js +12 -0
- package/build-backend/lib/AlexaSmartHomeV3/Alexa/ModeValues/index.js.map +1 -0
- package/build-backend/lib/AlexaSmartHomeV3/Alexa/Properties/AdjustableProperty.js +16 -0
- package/build-backend/lib/AlexaSmartHomeV3/Alexa/Properties/AdjustableProperty.js.map +1 -0
- package/build-backend/lib/AlexaSmartHomeV3/Alexa/Properties/Base.js +127 -0
- package/build-backend/lib/AlexaSmartHomeV3/Alexa/Properties/Base.js.map +1 -0
- package/build-backend/lib/AlexaSmartHomeV3/Alexa/Properties/Brightness.js +18 -0
- package/build-backend/lib/AlexaSmartHomeV3/Alexa/Properties/Brightness.js.map +1 -0
- package/build-backend/lib/AlexaSmartHomeV3/Alexa/Properties/Color.js +38 -0
- package/build-backend/lib/AlexaSmartHomeV3/Alexa/Properties/Color.js.map +1 -0
- package/{lib → build-backend/lib}/AlexaSmartHomeV3/Alexa/Properties/ColorTemperatureInKelvin.js +20 -29
- package/build-backend/lib/AlexaSmartHomeV3/Alexa/Properties/ColorTemperatureInKelvin.js.map +1 -0
- package/build-backend/lib/AlexaSmartHomeV3/Alexa/Properties/DetectionState.js +23 -0
- package/build-backend/lib/AlexaSmartHomeV3/Alexa/Properties/DetectionState.js.map +1 -0
- package/{lib → build-backend/lib}/AlexaSmartHomeV3/Alexa/Properties/LockState.js +9 -12
- package/build-backend/lib/AlexaSmartHomeV3/Alexa/Properties/LockState.js.map +1 -0
- package/build-backend/lib/AlexaSmartHomeV3/Alexa/Properties/Mode.js +34 -0
- package/build-backend/lib/AlexaSmartHomeV3/Alexa/Properties/Mode.js.map +1 -0
- package/build-backend/lib/AlexaSmartHomeV3/Alexa/Properties/Muted.js +19 -0
- package/build-backend/lib/AlexaSmartHomeV3/Alexa/Properties/Muted.js.map +1 -0
- package/build-backend/lib/AlexaSmartHomeV3/Alexa/Properties/Percentage.js +18 -0
- package/build-backend/lib/AlexaSmartHomeV3/Alexa/Properties/Percentage.js.map +1 -0
- package/{lib → build-backend/lib}/AlexaSmartHomeV3/Alexa/Properties/PowerState.js +9 -9
- package/build-backend/lib/AlexaSmartHomeV3/Alexa/Properties/PowerState.js.map +1 -0
- package/build-backend/lib/AlexaSmartHomeV3/Alexa/Properties/TargetSetpoint.js +31 -0
- package/build-backend/lib/AlexaSmartHomeV3/Alexa/Properties/TargetSetpoint.js.map +1 -0
- package/build-backend/lib/AlexaSmartHomeV3/Alexa/Properties/Temperature.js +22 -0
- package/build-backend/lib/AlexaSmartHomeV3/Alexa/Properties/Temperature.js.map +1 -0
- package/build-backend/lib/AlexaSmartHomeV3/Alexa/Properties/ThermostatMode.js +49 -0
- package/build-backend/lib/AlexaSmartHomeV3/Alexa/Properties/ThermostatMode.js.map +1 -0
- package/build-backend/lib/AlexaSmartHomeV3/Alexa/Properties/Volume.js +21 -0
- package/build-backend/lib/AlexaSmartHomeV3/Alexa/Properties/Volume.js.map +1 -0
- package/build-backend/lib/AlexaSmartHomeV3/Alexa/Properties/index.js +38 -0
- package/build-backend/lib/AlexaSmartHomeV3/Alexa/Properties/index.js.map +1 -0
- package/build-backend/lib/AlexaSmartHomeV3/Controls/AdjustableControl.js +20 -0
- package/build-backend/lib/AlexaSmartHomeV3/Controls/AdjustableControl.js.map +1 -0
- package/build-backend/lib/AlexaSmartHomeV3/Controls/AdjustablePercentageControl.js +26 -0
- package/build-backend/lib/AlexaSmartHomeV3/Controls/AdjustablePercentageControl.js.map +1 -0
- package/build-backend/lib/AlexaSmartHomeV3/Controls/AirCondition.js +148 -0
- package/build-backend/lib/AlexaSmartHomeV3/Controls/AirCondition.js.map +1 -0
- package/build-backend/lib/AlexaSmartHomeV3/Controls/Blind.js +13 -0
- package/build-backend/lib/AlexaSmartHomeV3/Controls/Blind.js.map +1 -0
- package/build-backend/lib/AlexaSmartHomeV3/Controls/ContactSensor.js +17 -0
- package/build-backend/lib/AlexaSmartHomeV3/Controls/ContactSensor.js.map +1 -0
- package/{lib → build-backend/lib}/AlexaSmartHomeV3/Controls/Control.js +73 -104
- package/build-backend/lib/AlexaSmartHomeV3/Controls/Control.js.map +1 -0
- package/build-backend/lib/AlexaSmartHomeV3/Controls/Ct.js +182 -0
- package/build-backend/lib/AlexaSmartHomeV3/Controls/Ct.js.map +1 -0
- package/build-backend/lib/AlexaSmartHomeV3/Controls/Dimmer.js +127 -0
- package/build-backend/lib/AlexaSmartHomeV3/Controls/Dimmer.js.map +1 -0
- package/build-backend/lib/AlexaSmartHomeV3/Controls/Door.js +10 -0
- package/build-backend/lib/AlexaSmartHomeV3/Controls/Door.js.map +1 -0
- package/build-backend/lib/AlexaSmartHomeV3/Controls/Gate.js +38 -0
- package/build-backend/lib/AlexaSmartHomeV3/Controls/Gate.js.map +1 -0
- package/build-backend/lib/AlexaSmartHomeV3/Controls/Hue.js +208 -0
- package/build-backend/lib/AlexaSmartHomeV3/Controls/Hue.js.map +1 -0
- package/{lib → build-backend/lib}/AlexaSmartHomeV3/Controls/Light.js +15 -22
- package/build-backend/lib/AlexaSmartHomeV3/Controls/Light.js.map +1 -0
- package/build-backend/lib/AlexaSmartHomeV3/Controls/Lock.js +35 -0
- package/build-backend/lib/AlexaSmartHomeV3/Controls/Lock.js.map +1 -0
- package/build-backend/lib/AlexaSmartHomeV3/Controls/Motion.js +17 -0
- package/build-backend/lib/AlexaSmartHomeV3/Controls/Motion.js.map +1 -0
- package/build-backend/lib/AlexaSmartHomeV3/Controls/ReadOnlyDetector.js +26 -0
- package/build-backend/lib/AlexaSmartHomeV3/Controls/ReadOnlyDetector.js.map +1 -0
- package/build-backend/lib/AlexaSmartHomeV3/Controls/Slider.js +10 -0
- package/build-backend/lib/AlexaSmartHomeV3/Controls/Slider.js.map +1 -0
- package/build-backend/lib/AlexaSmartHomeV3/Controls/Socket.js +21 -0
- package/build-backend/lib/AlexaSmartHomeV3/Controls/Socket.js.map +1 -0
- package/build-backend/lib/AlexaSmartHomeV3/Controls/Temperature.js +21 -0
- package/build-backend/lib/AlexaSmartHomeV3/Controls/Temperature.js.map +1 -0
- package/build-backend/lib/AlexaSmartHomeV3/Controls/Thermostat.js +85 -0
- package/build-backend/lib/AlexaSmartHomeV3/Controls/Thermostat.js.map +1 -0
- package/build-backend/lib/AlexaSmartHomeV3/Controls/VacuumCleaner.js +27 -0
- package/build-backend/lib/AlexaSmartHomeV3/Controls/VacuumCleaner.js.map +1 -0
- package/build-backend/lib/AlexaSmartHomeV3/Controls/Volume.js +116 -0
- package/build-backend/lib/AlexaSmartHomeV3/Controls/Volume.js.map +1 -0
- package/build-backend/lib/AlexaSmartHomeV3/Controls/VolumeGroup.js +10 -0
- package/build-backend/lib/AlexaSmartHomeV3/Controls/VolumeGroup.js.map +1 -0
- package/build-backend/lib/AlexaSmartHomeV3/Controls/Window.js +10 -0
- package/build-backend/lib/AlexaSmartHomeV3/Controls/Window.js.map +1 -0
- package/build-backend/lib/AlexaSmartHomeV3/Controls/index.js +121 -0
- package/build-backend/lib/AlexaSmartHomeV3/Controls/index.js.map +1 -0
- package/{lib → build-backend/lib}/AlexaSmartHomeV3/Device.js +29 -30
- package/build-backend/lib/AlexaSmartHomeV3/Device.js.map +1 -0
- package/build-backend/lib/AlexaSmartHomeV3/DeviceManager.js +392 -0
- package/build-backend/lib/AlexaSmartHomeV3/DeviceManager.js.map +1 -0
- package/build-backend/lib/AlexaSmartHomeV3/Exceptions/AlexaV3Exception.js +10 -0
- package/build-backend/lib/AlexaSmartHomeV3/Exceptions/AlexaV3Exception.js.map +1 -0
- package/build-backend/lib/AlexaSmartHomeV3/Exceptions/HourlyDeviceRateLimitExceeded.js +10 -0
- package/build-backend/lib/AlexaSmartHomeV3/Exceptions/HourlyDeviceRateLimitExceeded.js.map +1 -0
- package/build-backend/lib/AlexaSmartHomeV3/Exceptions/OverallDailyRateLimitExceeded.js +10 -0
- package/build-backend/lib/AlexaSmartHomeV3/Exceptions/OverallDailyRateLimitExceeded.js.map +1 -0
- package/{lib → build-backend/lib}/AlexaSmartHomeV3/Helpers/AdapterProvider.js +12 -21
- package/build-backend/lib/AlexaSmartHomeV3/Helpers/AdapterProvider.js.map +1 -0
- package/build-backend/lib/AlexaSmartHomeV3/Helpers/FileHelper.js +53 -0
- package/build-backend/lib/AlexaSmartHomeV3/Helpers/FileHelper.js.map +1 -0
- package/{lib → build-backend/lib}/AlexaSmartHomeV3/Helpers/IotProxy.js +9 -26
- package/build-backend/lib/AlexaSmartHomeV3/Helpers/IotProxy.js.map +1 -0
- package/build-backend/lib/AlexaSmartHomeV3/Helpers/Logger.js +93 -0
- package/build-backend/lib/AlexaSmartHomeV3/Helpers/Logger.js.map +1 -0
- package/build-backend/lib/AlexaSmartHomeV3/Helpers/RateLimiter.js +112 -0
- package/build-backend/lib/AlexaSmartHomeV3/Helpers/RateLimiter.js.map +1 -0
- package/build-backend/lib/AlexaSmartHomeV3/Helpers/Utils.js +625 -0
- package/build-backend/lib/AlexaSmartHomeV3/Helpers/Utils.js.map +1 -0
- package/build-backend/lib/Utils.js +96 -0
- package/build-backend/lib/Utils.js.map +1 -0
- package/build-backend/lib/adminCommonSocket.js +715 -0
- package/build-backend/lib/adminCommonSocket.js.map +1 -0
- package/build-backend/lib/alexaCustom.js +542 -0
- package/build-backend/lib/alexaCustom.js.map +1 -0
- package/{lib → build-backend/lib}/alexaSmartHomeV2.js +4 -8
- package/{lib → build-backend/lib}/alexaSmartHomeV3.js +25 -45
- package/build-backend/lib/alexaSmartHomeV3.js.map +1 -0
- package/{lib → build-backend/lib}/alisa.js +41 -44
- package/{lib → build-backend/lib}/devices.js +11 -8
- package/build-backend/lib/devices.js.map +1 -0
- package/{lib → build-backend/lib}/functions.js +11 -8
- package/build-backend/lib/functions.js.map +1 -0
- package/{lib → build-backend/lib}/googleHome.js +25 -26
- package/{lib → build-backend/lib}/notifications.js +15 -22
- package/build-backend/lib/notifications.js.map +1 -0
- package/{lib → build-backend/lib}/remote.js +615 -636
- package/build-backend/lib/remote.js.map +1 -0
- package/{lib → build-backend/lib}/rooms.js +11 -8
- package/build-backend/lib/rooms.js.map +1 -0
- package/{lib → build-backend/lib}/texts.js +6 -4
- package/build-backend/lib/texts.js.map +1 -0
- package/build-backend/lib/translate.js +21 -0
- package/build-backend/lib/translate.js.map +1 -0
- package/{lib → build-backend/lib}/visuApp.js +45 -65
- package/build-backend/lib/visuApp.js.map +1 -0
- package/build-backend/main.js +1361 -0
- package/build-backend/main.js.map +1 -0
- package/io-package.json +14 -14
- package/package.json +18 -15
- package/admin/assets/index-DCbOB3g_.js +0 -681
- package/lib/AlexaSmartHomeV3/Alexa/Capabilities/BrightnessController.js +0 -15
- package/lib/AlexaSmartHomeV3/Alexa/Capabilities/ColorController.js +0 -10
- package/lib/AlexaSmartHomeV3/Alexa/Capabilities/ColorTemperatureController.js +0 -15
- package/lib/AlexaSmartHomeV3/Alexa/Capabilities/ContactSensor.js +0 -10
- package/lib/AlexaSmartHomeV3/Alexa/Capabilities/LockController.js +0 -10
- package/lib/AlexaSmartHomeV3/Alexa/Capabilities/MotionSensor.js +0 -10
- package/lib/AlexaSmartHomeV3/Alexa/Capabilities/PercentageController.js +0 -10
- package/lib/AlexaSmartHomeV3/Alexa/Capabilities/PowerController.js +0 -15
- package/lib/AlexaSmartHomeV3/Alexa/Capabilities/Speaker.js +0 -20
- package/lib/AlexaSmartHomeV3/Alexa/Capabilities/TemperatureSensor.js +0 -10
- package/lib/AlexaSmartHomeV3/Alexa/Capabilities/ThermostatController.js +0 -34
- package/lib/AlexaSmartHomeV3/Alexa/Capabilities/index.js +0 -14
- package/lib/AlexaSmartHomeV3/Alexa/Directives/Base.js +0 -27
- package/lib/AlexaSmartHomeV3/Alexa/Directives/Discovery.js +0 -39
- package/lib/AlexaSmartHomeV3/Alexa/Directives/index.js +0 -13
- package/lib/AlexaSmartHomeV3/Alexa/ModeValues/Base.js +0 -38
- package/lib/AlexaSmartHomeV3/Alexa/ModeValues/Closed.js +0 -55
- package/lib/AlexaSmartHomeV3/Alexa/ModeValues/Open.js +0 -56
- package/lib/AlexaSmartHomeV3/Alexa/ModeValues/index.js +0 -14
- package/lib/AlexaSmartHomeV3/Alexa/Properties/AdjustableProperty.js +0 -11
- package/lib/AlexaSmartHomeV3/Alexa/Properties/Base.js +0 -108
- package/lib/AlexaSmartHomeV3/Alexa/Properties/Brightness.js +0 -14
- package/lib/AlexaSmartHomeV3/Alexa/Properties/Color.js +0 -40
- package/lib/AlexaSmartHomeV3/Alexa/Properties/DetectionState.js +0 -22
- package/lib/AlexaSmartHomeV3/Alexa/Properties/Mode.js +0 -32
- package/lib/AlexaSmartHomeV3/Alexa/Properties/Muted.js +0 -17
- package/lib/AlexaSmartHomeV3/Alexa/Properties/Percentage.js +0 -14
- package/lib/AlexaSmartHomeV3/Alexa/Properties/TargetSetpoint.js +0 -28
- package/lib/AlexaSmartHomeV3/Alexa/Properties/Temperature.js +0 -20
- package/lib/AlexaSmartHomeV3/Alexa/Properties/ThermostatMode.js +0 -52
- package/lib/AlexaSmartHomeV3/Alexa/Properties/Volume.js +0 -19
- package/lib/AlexaSmartHomeV3/Alexa/Properties/index.js +0 -14
- package/lib/AlexaSmartHomeV3/Controls/AdjustableControl.js +0 -22
- package/lib/AlexaSmartHomeV3/Controls/AdjustablePercentageControl.js +0 -28
- package/lib/AlexaSmartHomeV3/Controls/AirCondition.js +0 -144
- package/lib/AlexaSmartHomeV3/Controls/Blind.js +0 -12
- package/lib/AlexaSmartHomeV3/Controls/ContactSensor.js +0 -17
- package/lib/AlexaSmartHomeV3/Controls/Ct.js +0 -172
- package/lib/AlexaSmartHomeV3/Controls/Dimmer.js +0 -124
- package/lib/AlexaSmartHomeV3/Controls/Door.js +0 -9
- package/lib/AlexaSmartHomeV3/Controls/Gate.js +0 -42
- package/lib/AlexaSmartHomeV3/Controls/Hue.js +0 -207
- package/lib/AlexaSmartHomeV3/Controls/Lock.js +0 -36
- package/lib/AlexaSmartHomeV3/Controls/Motion.js +0 -17
- package/lib/AlexaSmartHomeV3/Controls/ReadOnlyDetector.js +0 -25
- package/lib/AlexaSmartHomeV3/Controls/Slider.js +0 -10
- package/lib/AlexaSmartHomeV3/Controls/Socket.js +0 -21
- package/lib/AlexaSmartHomeV3/Controls/Temperature.js +0 -22
- package/lib/AlexaSmartHomeV3/Controls/Thermostat.js +0 -86
- package/lib/AlexaSmartHomeV3/Controls/VacuumCleaner.js +0 -28
- package/lib/AlexaSmartHomeV3/Controls/Volume.js +0 -109
- package/lib/AlexaSmartHomeV3/Controls/VolumeGroup.js +0 -9
- package/lib/AlexaSmartHomeV3/Controls/Window.js +0 -9
- package/lib/AlexaSmartHomeV3/Controls/index.js +0 -14
- package/lib/AlexaSmartHomeV3/DeviceManager.js +0 -415
- package/lib/AlexaSmartHomeV3/Exceptions/AlexaV3Exception.js +0 -8
- package/lib/AlexaSmartHomeV3/Exceptions/HourlyDeviceRateLimitExceeded.js +0 -5
- package/lib/AlexaSmartHomeV3/Exceptions/OverallDailyRateLimitExceeded.js +0 -5
- package/lib/AlexaSmartHomeV3/Helpers/FileHelper.js +0 -70
- package/lib/AlexaSmartHomeV3/Helpers/Logger.js +0 -95
- package/lib/AlexaSmartHomeV3/Helpers/RateLimiter.js +0 -82
- package/lib/AlexaSmartHomeV3/Helpers/Utils.js +0 -583
- package/lib/Utils.js +0 -608
- package/lib/adminCommonSocket.js +0 -781
- package/lib/alexaCustom.js +0 -622
- package/lib/translate.js +0 -19
- package/main.js +0 -1454
|
@@ -0,0 +1,542 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const texts_1 = __importDefault(require("./texts"));
|
|
7
|
+
// Stop phrases all in lower case!
|
|
8
|
+
// Required by v2 custom skill to detect when the user wants to cancel the conversation
|
|
9
|
+
const stopPhrases = {
|
|
10
|
+
de: ['es reicht', 'ich bin fertig', 'ende', 'abbrechen', 'stopp', 'stop', 'beenden', 'danke', 'danke schön'],
|
|
11
|
+
en: ['enough', 'i am done', "i'm done", 'stop', 'quit', 'bye', 'thanks', 'thank you'],
|
|
12
|
+
ru: ['достаточно', 'я готов', 'хватит'],
|
|
13
|
+
};
|
|
14
|
+
class AlexaCustom {
|
|
15
|
+
lang = 'de';
|
|
16
|
+
openSessions = {};
|
|
17
|
+
knownDevices = {};
|
|
18
|
+
knownUsers = {};
|
|
19
|
+
lastSkillRequestWasV2 = false;
|
|
20
|
+
config;
|
|
21
|
+
adapter;
|
|
22
|
+
constructor(adapter) {
|
|
23
|
+
this.config = adapter.config;
|
|
24
|
+
this.adapter = adapter;
|
|
25
|
+
if (this.config.customKnownAlexaDevices && Array.isArray(this.config.customKnownAlexaDevices)) {
|
|
26
|
+
this.config.customKnownAlexaDevices.forEach(device => {
|
|
27
|
+
this.knownDevices[device.id] = device;
|
|
28
|
+
// {
|
|
29
|
+
// "id": "amzn1.ask.device.XXXXXXXXX", // just show last X chars in UI, should be unique enough
|
|
30
|
+
// "room": "enum.room.xyz",
|
|
31
|
+
// "lastSeen": 1234567899,
|
|
32
|
+
// }
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
if (this.config.customKnownAlexaUsers && Array.isArray(this.config.customKnownAlexaUsers)) {
|
|
36
|
+
this.config.customKnownAlexaUsers.forEach(device => {
|
|
37
|
+
this.knownUsers[device.id] = device;
|
|
38
|
+
// {
|
|
39
|
+
// "id": "amzn1.ask.account.XXXXXXXXX", // just show last X chars in UI, should be unique enough
|
|
40
|
+
// "name": "Holger",
|
|
41
|
+
// "lastSeen": 1234567899,
|
|
42
|
+
// }
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
getKnownDevices() {
|
|
47
|
+
return Object.values(this.knownDevices);
|
|
48
|
+
}
|
|
49
|
+
getKnownUsers() {
|
|
50
|
+
return Object.values(this.knownUsers);
|
|
51
|
+
}
|
|
52
|
+
// eslint-disable-next-line no-unused-private-class-members
|
|
53
|
+
#writeResponse(_channelId, _stateId, _command, _value) {
|
|
54
|
+
// adapter.log.warn('[CUSTOM] Unknown applianceId: ' + deviceId);
|
|
55
|
+
}
|
|
56
|
+
#getResponseV1(text, repromptText, shouldEndSession) {
|
|
57
|
+
let speechPlainText = text;
|
|
58
|
+
let speechType = 'PlainText';
|
|
59
|
+
if (text.startsWith('<speak>')) {
|
|
60
|
+
speechPlainText = text.replace(/<[^>]*>/g, '').trim();
|
|
61
|
+
speechType = 'SSML';
|
|
62
|
+
}
|
|
63
|
+
let repromptType = 'PlainText';
|
|
64
|
+
if (repromptText?.startsWith('<speak>')) {
|
|
65
|
+
repromptType = 'SSML';
|
|
66
|
+
}
|
|
67
|
+
const response = {
|
|
68
|
+
version: '1.0',
|
|
69
|
+
sessionAttributes: {},
|
|
70
|
+
response: {
|
|
71
|
+
outputSpeech: {
|
|
72
|
+
type: speechType,
|
|
73
|
+
text: text,
|
|
74
|
+
},
|
|
75
|
+
card: {
|
|
76
|
+
content: speechPlainText,
|
|
77
|
+
title: (0, texts_1.default)(this.lang, 'Answer from ioBroker') || 'ioBroker',
|
|
78
|
+
type: 'Simple',
|
|
79
|
+
},
|
|
80
|
+
shouldEndSession: shouldEndSession || false,
|
|
81
|
+
},
|
|
82
|
+
};
|
|
83
|
+
if (repromptText) {
|
|
84
|
+
response.response.reprompt = {
|
|
85
|
+
outputSpeech: {
|
|
86
|
+
type: repromptType,
|
|
87
|
+
ssml: repromptText,
|
|
88
|
+
},
|
|
89
|
+
};
|
|
90
|
+
}
|
|
91
|
+
return response;
|
|
92
|
+
}
|
|
93
|
+
#getResponseV2(text, repromptText, shouldEndSession) {
|
|
94
|
+
const response = this.#getResponseV1(text, repromptText, shouldEndSession);
|
|
95
|
+
if (!shouldEndSession) {
|
|
96
|
+
// We redirect the user to the Dialog Intent to capture the full traffic
|
|
97
|
+
response.response.directives = [
|
|
98
|
+
{
|
|
99
|
+
type: 'Dialog.ElicitSlot',
|
|
100
|
+
updatedIntent: {
|
|
101
|
+
name: 'queryIntent',
|
|
102
|
+
confirmationStatus: 'NONE',
|
|
103
|
+
slots: {
|
|
104
|
+
query: {
|
|
105
|
+
name: 'query',
|
|
106
|
+
value: '',
|
|
107
|
+
confirmationStatus: 'NONE',
|
|
108
|
+
},
|
|
109
|
+
},
|
|
110
|
+
},
|
|
111
|
+
slotToElicit: 'query',
|
|
112
|
+
},
|
|
113
|
+
];
|
|
114
|
+
}
|
|
115
|
+
return response;
|
|
116
|
+
}
|
|
117
|
+
setLanguage(_lang) {
|
|
118
|
+
this.lang = _lang || 'de';
|
|
119
|
+
}
|
|
120
|
+
setResponse(resp, shouldEndSession) {
|
|
121
|
+
let response = null;
|
|
122
|
+
if (resp.startsWith('{') && resp.endsWith('}')) {
|
|
123
|
+
try {
|
|
124
|
+
response = JSON.parse(resp);
|
|
125
|
+
}
|
|
126
|
+
catch {
|
|
127
|
+
// ignore
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
let session;
|
|
131
|
+
let sessionId;
|
|
132
|
+
if (response !== null && typeof response === 'object') {
|
|
133
|
+
if (response.sessionId) {
|
|
134
|
+
sessionId = response.sessionId;
|
|
135
|
+
session = this.openSessions[sessionId];
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
// We got a state response without session reference
|
|
139
|
+
if (!session) {
|
|
140
|
+
const sessions = Object.keys(this.openSessions).filter(sessionId => !!(this.openSessions[sessionId].responseTimer && this.openSessions[sessionId].callback));
|
|
141
|
+
if (sessions.length > 0) {
|
|
142
|
+
sessionId = sessions[0];
|
|
143
|
+
session = this.openSessions[sessionId];
|
|
144
|
+
if (sessions.length > 1) {
|
|
145
|
+
this.adapter.log.warn('[CUSTOM] More than one session with expected responses ... consider the first one as the relevant one');
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
const obj = {
|
|
150
|
+
responseText: '',
|
|
151
|
+
shouldEndSession: shouldEndSession === undefined ? !sessionId : shouldEndSession,
|
|
152
|
+
};
|
|
153
|
+
if (response !== null && typeof response === 'object') {
|
|
154
|
+
if (response.responseText) {
|
|
155
|
+
obj.responseText = response.responseText;
|
|
156
|
+
}
|
|
157
|
+
if (response.shouldEndSession !== undefined) {
|
|
158
|
+
obj.shouldEndSession = response.shouldEndSession;
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
else {
|
|
162
|
+
obj.responseText = resp;
|
|
163
|
+
}
|
|
164
|
+
if (session?.responseTimer && session.callback) {
|
|
165
|
+
this.processAfter(session.request, obj.responseText, obj.shouldEndSession, session.callback);
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
processAfter(request, text, shouldEndSession, callback) {
|
|
169
|
+
void this.adapter.setState('smart.lastResponse', text, true);
|
|
170
|
+
const sessionId = request.session && request.session.sessionId ? request.session.sessionId : '';
|
|
171
|
+
if (this.openSessions[sessionId].responseTimer) {
|
|
172
|
+
clearTimeout(this.openSessions[sessionId].responseTimer);
|
|
173
|
+
this.openSessions[sessionId].responseTimer = null;
|
|
174
|
+
}
|
|
175
|
+
this.openSessions[sessionId].callback = null;
|
|
176
|
+
this.openSessions[sessionId].request = null;
|
|
177
|
+
const isV2Skill = this.openSessions[sessionId].isV2Skill !== undefined
|
|
178
|
+
? this.openSessions[sessionId].isV2Skill
|
|
179
|
+
: !!request.customSkillV2;
|
|
180
|
+
if (isV2Skill) {
|
|
181
|
+
callback(this.#getResponseV2(text, null, shouldEndSession));
|
|
182
|
+
}
|
|
183
|
+
else {
|
|
184
|
+
callback(this.#getResponseV1(text, null, shouldEndSession));
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
touchSession(sessionId, isV2Skill) {
|
|
188
|
+
if (this.openSessions[sessionId] && this.openSessions[sessionId].expiryTimer) {
|
|
189
|
+
clearTimeout(this.openSessions[sessionId].expiryTimer);
|
|
190
|
+
this.openSessions[sessionId].expiryTimer = null;
|
|
191
|
+
}
|
|
192
|
+
this.openSessions[sessionId] = this.openSessions[sessionId] || {
|
|
193
|
+
expiryTimer: null,
|
|
194
|
+
responseTimer: null,
|
|
195
|
+
request: null,
|
|
196
|
+
callback: null,
|
|
197
|
+
isV2Skill,
|
|
198
|
+
};
|
|
199
|
+
this.openSessions[sessionId].expiryTimer = setTimeout(() => {
|
|
200
|
+
delete this.openSessions[sessionId];
|
|
201
|
+
}, 60000); // latest after 10 mins we declare a session as closed
|
|
202
|
+
}
|
|
203
|
+
deleteSession(sessionId) {
|
|
204
|
+
if (this.openSessions[sessionId] && this.openSessions[sessionId].expiryTimer) {
|
|
205
|
+
clearTimeout(this.openSessions[sessionId].expiryTimer);
|
|
206
|
+
}
|
|
207
|
+
delete this.openSessions[sessionId];
|
|
208
|
+
}
|
|
209
|
+
// let example = {
|
|
210
|
+
// "session": {
|
|
211
|
+
// "sessionId": "SessionId.74267f5d-3b58-45646-bdc7-4645645",
|
|
212
|
+
// "application": {
|
|
213
|
+
// "applicationId": "amzn1.ask.skill.6cee68cd-4356-456-9d53-45646456"
|
|
214
|
+
// },
|
|
215
|
+
// "attributes": {},
|
|
216
|
+
// "user": {
|
|
217
|
+
// "userId": "amzn1.ask.account.asdasdasdas"
|
|
218
|
+
// },
|
|
219
|
+
// "new": true
|
|
220
|
+
// },
|
|
221
|
+
// "request": {
|
|
222
|
+
// "type": "IntentRequest",
|
|
223
|
+
// "requestId": "EdwRequestId.b785ca9f-6ba9-45645-a667-4645646",
|
|
224
|
+
// "locale": "de-DE",
|
|
225
|
+
// "timestamp": "2017-07-25T15:30:51Z",
|
|
226
|
+
// "intent": {
|
|
227
|
+
// "name": "controlDevice",
|
|
228
|
+
// "slots": {
|
|
229
|
+
// "Command": {
|
|
230
|
+
// "name": "Command",
|
|
231
|
+
// "value": "an"
|
|
232
|
+
// },
|
|
233
|
+
// "Device": {
|
|
234
|
+
// "name": "Device"
|
|
235
|
+
// },
|
|
236
|
+
// "Article": {
|
|
237
|
+
// "name": "Article"
|
|
238
|
+
// },
|
|
239
|
+
// "Value": {
|
|
240
|
+
// "name": "Value"
|
|
241
|
+
// },
|
|
242
|
+
// "Place": {
|
|
243
|
+
// "name": "Place",
|
|
244
|
+
// "value": "licht"
|
|
245
|
+
// }
|
|
246
|
+
// }
|
|
247
|
+
// }
|
|
248
|
+
// },
|
|
249
|
+
// "version": "1.0"
|
|
250
|
+
// }
|
|
251
|
+
async process(request, isEnabled) {
|
|
252
|
+
if (!request?.request) {
|
|
253
|
+
this.adapter.log.error('Invalid request: no intent!');
|
|
254
|
+
return { error: 'Invalid request: no intent!' };
|
|
255
|
+
}
|
|
256
|
+
const isV2Skill = !!request.customSkillV2;
|
|
257
|
+
this.lastSkillRequestWasV2 = isV2Skill;
|
|
258
|
+
const getResponse = isV2Skill ? this.#getResponseV2 : this.#getResponseV1;
|
|
259
|
+
if (!isEnabled) {
|
|
260
|
+
if (this.lang === 'en') {
|
|
261
|
+
return getResponse('The service is not activated. Please enable Alexa integration in the iot Adapter.', null, true);
|
|
262
|
+
}
|
|
263
|
+
if (this.lang === 'ru') {
|
|
264
|
+
return getResponse('Услуга не активирована. Включите интеграцию Alexa в адаптере Интернета вещей.', null, true);
|
|
265
|
+
}
|
|
266
|
+
return getResponse('Der Service ist nicht aktiviert. Bitte aktiviere die Alex-Integration im iot-Adapter um Ihn zu aktivieren.', null, true);
|
|
267
|
+
}
|
|
268
|
+
const sessionId = request.session && request.session.sessionId ? request.session.sessionId : '';
|
|
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}`);
|
|
270
|
+
if (request.request.type === 'LaunchRequest') {
|
|
271
|
+
this.adapter.log.debug(request.request.type);
|
|
272
|
+
this.touchSession(sessionId, isV2Skill);
|
|
273
|
+
if (this.lang === 'en') {
|
|
274
|
+
return getResponse('Hello, what do you want to know or control?', 'What do you want to know or control?');
|
|
275
|
+
}
|
|
276
|
+
if (this.lang === 'ru') {
|
|
277
|
+
return getResponse('Привет. Что вы хотите знать или контролировать?', 'Что вы хотите знать или контролировать?');
|
|
278
|
+
}
|
|
279
|
+
return getResponse('Hallo, was möchtest Du wissen oder steuern?', 'Was möchtest Du wissen oder steuern?');
|
|
280
|
+
}
|
|
281
|
+
if (request.request.type === 'IntentRequest') {
|
|
282
|
+
if (request.request.intent) {
|
|
283
|
+
this.touchSession(sessionId, isV2Skill);
|
|
284
|
+
if (request.request.intent.name === 'AMAZON.HelpIntent') {
|
|
285
|
+
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?');
|
|
287
|
+
}
|
|
288
|
+
if (this.lang === 'ru') {
|
|
289
|
+
return getResponse('Этот навык передаст все распознанные слова в вашу установку ioBroker, и вы сможете настроить действия и ответы там! Что вы хотите знать или контролировать?', 'Что вы хотите знать или контролировать?');
|
|
290
|
+
}
|
|
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?');
|
|
292
|
+
}
|
|
293
|
+
else if (request.request.intent.name === 'AMAZON.CancelIntent' ||
|
|
294
|
+
request.request.intent.name === 'AMAZON.StopIntent') {
|
|
295
|
+
this.adapter.log.debug(request.request.intent.name);
|
|
296
|
+
this.deleteSession(sessionId);
|
|
297
|
+
if (this.lang === 'en') {
|
|
298
|
+
return getResponse('Goodbye!', null, true);
|
|
299
|
+
}
|
|
300
|
+
if (this.lang === 'ru') {
|
|
301
|
+
return getResponse('До скорого!', null, true);
|
|
302
|
+
}
|
|
303
|
+
return getResponse('Bis bald!', null, true);
|
|
304
|
+
}
|
|
305
|
+
const textsLog = [];
|
|
306
|
+
const texts = [];
|
|
307
|
+
const originalIntentName = request.request.intent.name;
|
|
308
|
+
if (request.request.intent.name === 'AMAZON.YesIntent') {
|
|
309
|
+
// Only relevant for v2 Skill. Convert an initial YesIntent to Words
|
|
310
|
+
if (this.lang === 'en') {
|
|
311
|
+
textsLog.push('AMAZON.YesIntent = Yes');
|
|
312
|
+
texts.push('Yes');
|
|
313
|
+
}
|
|
314
|
+
else if (this.lang === 'ru') {
|
|
315
|
+
textsLog.push('AMAZON.YesIntent = Да');
|
|
316
|
+
texts.push('Да');
|
|
317
|
+
}
|
|
318
|
+
else if (this.lang === 'de') {
|
|
319
|
+
textsLog.push('AMAZON.YesIntent = Ja');
|
|
320
|
+
texts.push('Ja');
|
|
321
|
+
}
|
|
322
|
+
}
|
|
323
|
+
else if (request.request.intent.name === 'AMAZON.NoIntent') {
|
|
324
|
+
// Only relevant for v2 Skill. Convert an initial NoIntent to Words
|
|
325
|
+
if (this.lang === 'en') {
|
|
326
|
+
textsLog.push('AMAZON.NoIntent = No');
|
|
327
|
+
texts.push('No');
|
|
328
|
+
}
|
|
329
|
+
else if (this.lang === 'ru') {
|
|
330
|
+
textsLog.push('AMAZON.NoIntent = Нет');
|
|
331
|
+
texts.push('Нет');
|
|
332
|
+
}
|
|
333
|
+
else if (this.lang === 'de') {
|
|
334
|
+
textsLog.push('AMAZON.NoIntent = Nein');
|
|
335
|
+
texts.push('Nein');
|
|
336
|
+
}
|
|
337
|
+
}
|
|
338
|
+
else if (request.request.intent.name.startsWith('queryIntent')) {
|
|
339
|
+
// v2 Skill
|
|
340
|
+
// Only relevant for v2 Skill, get the start words out of the intent name
|
|
341
|
+
const startWords = request.request.intent.name
|
|
342
|
+
.replace(/^queryIntent/, '')
|
|
343
|
+
.replace(/ae/, 'ä')
|
|
344
|
+
.replace(/oe/, 'ö')
|
|
345
|
+
.replace(/ue/, 'ü')
|
|
346
|
+
.replace(/Oe/, 'Ö')
|
|
347
|
+
.replace(/Ue/, 'Ü')
|
|
348
|
+
.replace(/Ae/, 'Ä')
|
|
349
|
+
.replace(/ss/, 'ß')
|
|
350
|
+
.replace(/([A-Z])/g, ' $1')
|
|
351
|
+
.trim();
|
|
352
|
+
request.request.intent.name = 'queryIntent';
|
|
353
|
+
if (startWords.length && startWords !== 'FillWords') {
|
|
354
|
+
// ignore FillWords
|
|
355
|
+
textsLog.push(`queryIntent = ${startWords}`);
|
|
356
|
+
texts.push(startWords);
|
|
357
|
+
}
|
|
358
|
+
}
|
|
359
|
+
if (!request.request.intent.slots && textsLog.length === 0) {
|
|
360
|
+
// No slots and nothing from above
|
|
361
|
+
this.adapter.log.warn(`Unexpected ALEXA Request: ${JSON.stringify(request)}`);
|
|
362
|
+
if (this.lang === 'en') {
|
|
363
|
+
return getResponse('I did not hear you. Please repeat your question!', null);
|
|
364
|
+
}
|
|
365
|
+
if (this.lang === 'ru') {
|
|
366
|
+
return getResponse('Я не слышал тебя. Пожалуйста, повторите свой вопрос!', null);
|
|
367
|
+
}
|
|
368
|
+
return getResponse('Ich habe Dich nicht verstanden. Bitte wiederhole deine Frage!', null);
|
|
369
|
+
}
|
|
370
|
+
// collect all filled slots (v1 and v2 skill)
|
|
371
|
+
if (request.request.intent.slots) {
|
|
372
|
+
const slots = Object.keys(request.request.intent.slots);
|
|
373
|
+
slots.forEach(slotId => {
|
|
374
|
+
const slot = request.request.intent.slots[slotId];
|
|
375
|
+
let value = slot.value;
|
|
376
|
+
const resolution = slot.resolutions?.resolutionsPerAuthority?.length > 0
|
|
377
|
+
? slot.resolutions.resolutionsPerAuthority[0]
|
|
378
|
+
: null;
|
|
379
|
+
if (resolution && resolution.status.code === 'ER_SUCCESS_MATCH') {
|
|
380
|
+
const resolutionValue = resolution.values[0].value;
|
|
381
|
+
value = resolutionValue.name;
|
|
382
|
+
}
|
|
383
|
+
if (value && value.length) {
|
|
384
|
+
texts.push(value);
|
|
385
|
+
textsLog.push(`${slotId} = ${value}`);
|
|
386
|
+
}
|
|
387
|
+
});
|
|
388
|
+
}
|
|
389
|
+
let text = texts.join(' ');
|
|
390
|
+
const intent = request.request.intent.name || '';
|
|
391
|
+
if (originalIntentName.startsWith('queryIntentStarteDialog')) {
|
|
392
|
+
// v2 Skill StarteDialog* intents are automatically handled without sending anywhere
|
|
393
|
+
let response = '';
|
|
394
|
+
if (originalIntentName === 'queryIntentStarteDialog') {
|
|
395
|
+
// Intent to directly redirect to the dialog state without further processing
|
|
396
|
+
response = text.replace(/^Starte Dialog /, '').trim();
|
|
397
|
+
}
|
|
398
|
+
else if (originalIntentName === 'queryIntentStarteDialogMitFrage') {
|
|
399
|
+
// Intent to directly redirect to the dialog state with asking a question without further processing
|
|
400
|
+
response = text.replace(/^Starte Dialog Mit Frage /, '').trim();
|
|
401
|
+
if (response.length) {
|
|
402
|
+
response += '?';
|
|
403
|
+
}
|
|
404
|
+
}
|
|
405
|
+
if (!response.length) {
|
|
406
|
+
// We need to send an answer, else it is an error
|
|
407
|
+
if (this.lang === 'en') {
|
|
408
|
+
response = 'Yes?';
|
|
409
|
+
}
|
|
410
|
+
else if (this.lang === 'ru') {
|
|
411
|
+
response = 'Да?';
|
|
412
|
+
}
|
|
413
|
+
else {
|
|
414
|
+
response = 'Ja?';
|
|
415
|
+
}
|
|
416
|
+
}
|
|
417
|
+
return getResponse(response, response);
|
|
418
|
+
}
|
|
419
|
+
if (intent === 'queryIntent' && stopPhrases[this.lang].includes(text.toLowerCase())) {
|
|
420
|
+
// v2 Skill when in dialog mode, we need to take care of the exit criteria ourselves
|
|
421
|
+
this.deleteSession(sessionId);
|
|
422
|
+
if (this.lang === 'en') {
|
|
423
|
+
return getResponse('Goodbye!', null, true);
|
|
424
|
+
}
|
|
425
|
+
if (this.lang === 'ru') {
|
|
426
|
+
return getResponse('До скорого!', null, true);
|
|
427
|
+
}
|
|
428
|
+
return getResponse('Bis bald!', null, true);
|
|
429
|
+
}
|
|
430
|
+
// v1 and v2 Skill
|
|
431
|
+
const deviceId = request?.context?.System?.device?.deviceId
|
|
432
|
+
? request.context.System.device.deviceId
|
|
433
|
+
: '';
|
|
434
|
+
const deviceRoom = this.knownDevices[deviceId] ? this.knownDevices[deviceId].room : undefined;
|
|
435
|
+
const userId = request?.session?.user?.userId ? request.session.user.userId : '';
|
|
436
|
+
const userName = this.knownUsers[userId] ? this.knownUsers[userId].name : undefined;
|
|
437
|
+
const commandObj = {
|
|
438
|
+
words: texts,
|
|
439
|
+
intent: intent,
|
|
440
|
+
deviceId,
|
|
441
|
+
deviceRoom,
|
|
442
|
+
sessionId,
|
|
443
|
+
userId,
|
|
444
|
+
userName,
|
|
445
|
+
};
|
|
446
|
+
// Add room and username to the text if configured
|
|
447
|
+
if (deviceRoom && this.config.addCustomKnownAlexaDeviceRoomToText) {
|
|
448
|
+
text += ` ${deviceRoom}`;
|
|
449
|
+
}
|
|
450
|
+
if (userName && this.config.addCustomKnownAlexaUserNameToText) {
|
|
451
|
+
text += ` ${userName}`;
|
|
452
|
+
}
|
|
453
|
+
// Add intent in front of the text to stay compatible with v1 Skill
|
|
454
|
+
text = `${intent} ${text}`;
|
|
455
|
+
text = text.trim();
|
|
456
|
+
await this.adapter.setStateAsync('smart.lastCommand', text, true);
|
|
457
|
+
await this.adapter.setStateAsync('smart.lastCommandObj', JSON.stringify(commandObj), true);
|
|
458
|
+
this.adapter.log.debug(`${intent}: ${textsLog.join(', ')}`);
|
|
459
|
+
if (intent) {
|
|
460
|
+
let text_timeout;
|
|
461
|
+
if (this.lang === 'en') {
|
|
462
|
+
text_timeout = `Processing of ${text} is not possible!`;
|
|
463
|
+
}
|
|
464
|
+
else if (this.lang === 'ru') {
|
|
465
|
+
text_timeout = `Обработка ${text} не возможна!`;
|
|
466
|
+
}
|
|
467
|
+
else {
|
|
468
|
+
text_timeout = `Die Verarbeitung von ${text} ist nicht möglich!`;
|
|
469
|
+
}
|
|
470
|
+
if (this.config.text2command !== null &&
|
|
471
|
+
this.config.text2command !== undefined &&
|
|
472
|
+
this.config.text2command !== '') {
|
|
473
|
+
const state = await this.adapter.getForeignStateAsync(`system.adapter.text2command.${this.config.text2command}.alive`);
|
|
474
|
+
if (state?.val) {
|
|
475
|
+
return new Promise((resolve) => {
|
|
476
|
+
this.openSessions[sessionId].responseTimer = setTimeout(() => {
|
|
477
|
+
this.openSessions[sessionId].responseTimer = null;
|
|
478
|
+
if (resolve) {
|
|
479
|
+
this.processAfter(request, text_timeout, true, resolve);
|
|
480
|
+
resolve = null;
|
|
481
|
+
}
|
|
482
|
+
}, 1000);
|
|
483
|
+
if (this.config.language) {
|
|
484
|
+
text = `${this.config.language};${text}`;
|
|
485
|
+
}
|
|
486
|
+
this.adapter.sendTo(`text2command.${this.config.text2command}`, text, result => {
|
|
487
|
+
const typedResult = result;
|
|
488
|
+
if (this.openSessions[sessionId].responseTimer) {
|
|
489
|
+
clearTimeout(this.openSessions[sessionId].responseTimer);
|
|
490
|
+
this.openSessions[sessionId].responseTimer = null;
|
|
491
|
+
}
|
|
492
|
+
const regExp = new RegExp(`"${intent.toLowerCase()}\\s`);
|
|
493
|
+
typedResult.response = typedResult.response
|
|
494
|
+
.replace(/^\w\w;/, '')
|
|
495
|
+
.replace(regExp, '"');
|
|
496
|
+
this.adapter.log.debug(`Response from text2command: ${typedResult.response}`);
|
|
497
|
+
void this.adapter.setState('smart.lastResponse', typedResult.response, true);
|
|
498
|
+
if (resolve) {
|
|
499
|
+
resolve(getResponse(typedResult.response, null, true));
|
|
500
|
+
resolve = null;
|
|
501
|
+
}
|
|
502
|
+
});
|
|
503
|
+
});
|
|
504
|
+
}
|
|
505
|
+
}
|
|
506
|
+
return new Promise(resolve => {
|
|
507
|
+
this.openSessions[sessionId].responseTimer &&
|
|
508
|
+
clearTimeout(this.openSessions[sessionId].responseTimer);
|
|
509
|
+
this.openSessions[sessionId].callback = resolve;
|
|
510
|
+
this.openSessions[sessionId].request = request;
|
|
511
|
+
this.openSessions[sessionId].responseTimer = setTimeout(() => this.processAfter(request, text_timeout, true, resolve), 200);
|
|
512
|
+
});
|
|
513
|
+
}
|
|
514
|
+
if (this.lang === 'en') {
|
|
515
|
+
return getResponse('I did not understand the question!', null);
|
|
516
|
+
}
|
|
517
|
+
if (this.lang === 'ru') {
|
|
518
|
+
return getResponse('Я не поняла ваш вопрос!', null);
|
|
519
|
+
}
|
|
520
|
+
return getResponse('Ich habe Deine Frage nicht verstanden!', null);
|
|
521
|
+
}
|
|
522
|
+
this.adapter.log.warn(`Unexpected ALEXA Request: ${JSON.stringify(request)}`);
|
|
523
|
+
if (this.lang === 'en') {
|
|
524
|
+
return getResponse('Please repeat your question!', null);
|
|
525
|
+
}
|
|
526
|
+
if (this.lang === 'ru') {
|
|
527
|
+
return getResponse('Пожалуйста, повторите вопрос!', null);
|
|
528
|
+
}
|
|
529
|
+
return getResponse('Bitte wiederhole die Frage!', null);
|
|
530
|
+
}
|
|
531
|
+
if (request.request.type === 'SessionEndedRequest') {
|
|
532
|
+
this.adapter.log.debug(`SessionEndedRequest: ${request.request.reason}`);
|
|
533
|
+
this.deleteSession(sessionId);
|
|
534
|
+
// Should not be called
|
|
535
|
+
return { error: 'Unexpected Session Ended' };
|
|
536
|
+
}
|
|
537
|
+
this.adapter.log.debug(`Unknown Request type: ${JSON.stringify(request)}`);
|
|
538
|
+
return { error: 'Unknown Request type' };
|
|
539
|
+
}
|
|
540
|
+
}
|
|
541
|
+
exports.default = AlexaCustom;
|
|
542
|
+
//# sourceMappingURL=alexaCustom.js.map
|