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
|
@@ -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__-Cz053nO7.js";import s from"./assets/virtualExposes-BqVak7rX.js";import{_ as n}from"./assets/preload-helper-Dp1pzeXC.js";const i={"@iobroker/adapter-react-v5":async()=>await n(()=>import("./assets/index-
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./assets/index-DwYdaT5M.js","./assets/ActionVisu__loadShare__react__loadShare__-Cg21Ef1U.js","./assets/_commonjsHelpers-Cpj98o6Y.js","./assets/ActionVisu__mf_v__runtimeInit__mf_v__-Cz053nO7.js","./assets/ActionVisu__loadShare__react_mf_2_dom__loadShare__-B1zRWn0u.js","./assets/index-Do-nCdWy.js","./assets/index-CAAeiKCc.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{i as m,A as p}from"./assets/ActionVisu__mf_v__runtimeInit__mf_v__-Cz053nO7.js";import s from"./assets/virtualExposes-BqVak7rX.js";import{_ as n}from"./assets/preload-helper-Dp1pzeXC.js";const i={"@iobroker/adapter-react-v5":async()=>await n(()=>import("./assets/index-DwYdaT5M.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-CAAeiKCc.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.6.18",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.init({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};
|
|
@@ -1,94 +1,110 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
const uuid_1 = require("uuid");
|
|
37
|
+
const Utils = __importStar(require("../Helpers/Utils"));
|
|
7
38
|
/**
|
|
8
39
|
* Helper class to generate an AlexaResponse.
|
|
9
|
-
* @class
|
|
10
40
|
*/
|
|
11
41
|
class AlexaResponse {
|
|
42
|
+
context;
|
|
43
|
+
iobVersion = '1';
|
|
44
|
+
event;
|
|
12
45
|
static ErrorResponseName = 'ErrorResponse';
|
|
13
|
-
|
|
14
46
|
static isErrorResponse(response) {
|
|
15
47
|
return response?.event?.header?.name === AlexaResponse.ErrorResponseName;
|
|
16
48
|
}
|
|
17
|
-
|
|
18
|
-
static errorResponse(payload) {
|
|
49
|
+
static errorResponse(messageId, payload) {
|
|
19
50
|
return new AlexaResponse({
|
|
20
51
|
name: AlexaResponse.ErrorResponseName,
|
|
21
52
|
payload,
|
|
53
|
+
messageId,
|
|
22
54
|
});
|
|
23
55
|
}
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
return AlexaResponse.errorResponse({
|
|
56
|
+
static endpointUnreachable(messageId) {
|
|
57
|
+
return AlexaResponse.errorResponse(messageId, {
|
|
27
58
|
type: 'ENDPOINT_UNREACHABLE',
|
|
28
59
|
message: 'Unable to reach endpoint.',
|
|
29
60
|
});
|
|
30
61
|
}
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
return AlexaResponse.errorResponse({
|
|
62
|
+
static directiveNotSupportedByControl(controlName, namespace, messageId, payloadVersion) {
|
|
63
|
+
return AlexaResponse.errorResponse(messageId, {
|
|
34
64
|
type: 'INTERNAL_ERROR',
|
|
35
65
|
message: `Control ${controlName} doesn't support the ${namespace} with payloadVersion ${payloadVersion}`,
|
|
36
66
|
});
|
|
37
67
|
}
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
return AlexaResponse.errorResponse({
|
|
68
|
+
static directiveNotSupportedByDevice(deviceName, namespace, messageId, payloadVersion) {
|
|
69
|
+
return AlexaResponse.errorResponse(messageId, {
|
|
41
70
|
type: 'INTERNAL_ERROR',
|
|
42
71
|
message: `Device ${deviceName} doesn't support the ${namespace} with payloadVersion ${payloadVersion}`,
|
|
43
72
|
});
|
|
44
73
|
}
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
static nonExistingEndpoint(endpointId) {
|
|
48
|
-
return AlexaResponse.errorResponse({
|
|
74
|
+
static nonExistingEndpoint(messageId, endpointId) {
|
|
75
|
+
return AlexaResponse.errorResponse(messageId, {
|
|
49
76
|
type: 'INTERNAL_ERROR',
|
|
50
77
|
message: `No endpoint with id ${endpointId} found`,
|
|
51
78
|
});
|
|
52
79
|
}
|
|
53
|
-
|
|
54
80
|
/**
|
|
55
|
-
* Composes Alexa respond on a successfully processed Alexa directive to change
|
|
56
|
-
* @param {*} event
|
|
57
|
-
* @param {string} propertyName
|
|
58
|
-
* @param {*} value
|
|
59
|
-
* @returns
|
|
81
|
+
* Composes Alexa respond on a successfully processed Alexa directive to change the capability's value of a device
|
|
60
82
|
*/
|
|
61
83
|
static handled(event, propertyName, value, propertyInstance) {
|
|
62
84
|
const response = new AlexaResponse({
|
|
63
85
|
correlationToken: event?.directive?.header?.correlationToken,
|
|
64
86
|
token: event?.directive?.endpoint?.scope?.token,
|
|
65
87
|
endpointId: event?.directive?.endpoint?.endpointId,
|
|
88
|
+
messageId: event?.directive?.header?.messageId,
|
|
66
89
|
});
|
|
67
|
-
|
|
68
90
|
response.addContextProperty({
|
|
69
91
|
namespace: event?.directive?.header?.namespace,
|
|
70
92
|
name: propertyName,
|
|
71
93
|
instance: propertyInstance,
|
|
72
94
|
value,
|
|
73
95
|
});
|
|
74
|
-
|
|
75
96
|
return response;
|
|
76
97
|
}
|
|
77
|
-
|
|
78
|
-
|
|
79
98
|
/**
|
|
80
99
|
* Constructor for an Alexa Response.
|
|
81
|
-
*
|
|
100
|
+
*
|
|
82
101
|
* @param opts Contains initialization options for the response
|
|
83
102
|
*/
|
|
84
103
|
constructor(opts) {
|
|
85
|
-
|
|
86
|
-
opts = {};
|
|
87
|
-
|
|
104
|
+
opts ||= {};
|
|
88
105
|
if (opts.context !== undefined) {
|
|
89
106
|
this.context = Utils.defaultIfNullOrEmpty(opts.context, undefined);
|
|
90
107
|
}
|
|
91
|
-
|
|
92
108
|
if (opts.event !== undefined) {
|
|
93
109
|
this.event = Utils.defaultIfNullOrEmpty(opts.event, undefined);
|
|
94
110
|
}
|
|
@@ -97,7 +113,7 @@ class AlexaResponse {
|
|
|
97
113
|
header: {
|
|
98
114
|
namespace: Utils.defaultIfNullOrEmpty(opts.namespace, 'Alexa'),
|
|
99
115
|
name: Utils.defaultIfNullOrEmpty(opts.name, 'Response'),
|
|
100
|
-
messageId: Utils.defaultIfNullOrEmpty(opts.messageId,
|
|
116
|
+
messageId: Utils.defaultIfNullOrEmpty(opts.messageId, (0, uuid_1.v4)()),
|
|
101
117
|
correlationToken: Utils.defaultIfNullOrEmpty(opts.correlationToken, undefined),
|
|
102
118
|
payloadVersion: Utils.defaultIfNullOrEmpty(opts.payloadVersion, '3'),
|
|
103
119
|
},
|
|
@@ -110,7 +126,6 @@ class AlexaResponse {
|
|
|
110
126
|
},
|
|
111
127
|
payload: Utils.defaultIfNullOrEmpty(opts.payload, {}),
|
|
112
128
|
};
|
|
113
|
-
|
|
114
129
|
if (opts.changeCauseType) {
|
|
115
130
|
this.event.payload.change = {
|
|
116
131
|
cause: {
|
|
@@ -120,27 +135,24 @@ class AlexaResponse {
|
|
|
120
135
|
};
|
|
121
136
|
}
|
|
122
137
|
}
|
|
123
|
-
|
|
138
|
+
if (!this.event) {
|
|
139
|
+
throw new Error('Event is not defined');
|
|
140
|
+
}
|
|
124
141
|
// No endpoint in an AcceptGrant or Discover request
|
|
125
142
|
if (this.event.header.name === 'AcceptGrant.Response' || this.event.header.name === 'Discover.Response') {
|
|
126
143
|
delete this.event.endpoint;
|
|
127
144
|
}
|
|
128
|
-
|
|
129
145
|
}
|
|
130
|
-
|
|
131
146
|
addContext() {
|
|
132
|
-
|
|
133
|
-
this.context = { properties: [] };
|
|
134
|
-
}
|
|
147
|
+
this.context ||= { properties: [] };
|
|
135
148
|
}
|
|
136
|
-
|
|
137
149
|
/**
|
|
138
150
|
* Add a property to the context.
|
|
151
|
+
*
|
|
139
152
|
* @param opts Contains options for the property.
|
|
140
153
|
*/
|
|
141
154
|
addContextProperty(opts) {
|
|
142
155
|
this.addContext();
|
|
143
|
-
|
|
144
156
|
const property = {
|
|
145
157
|
namespace: Utils.defaultIfNullOrEmpty(opts.namespace, 'Alexa.EndpointHealth'),
|
|
146
158
|
instance: Utils.defaultIfNullOrEmpty(opts.instance, undefined),
|
|
@@ -148,24 +160,19 @@ class AlexaResponse {
|
|
|
148
160
|
value: Utils.defaultIfNullOrEmpty(opts.value, { value: 'OK' }),
|
|
149
161
|
timeOfSample: Utils.defaultIfNullOrEmpty(opts.timeOfSample, new Date().toISOString()),
|
|
150
162
|
uncertaintyInMilliseconds: Utils.defaultIfNullOrEmpty(opts.uncertaintyInMilliseconds, 0),
|
|
151
|
-
}
|
|
152
|
-
|
|
163
|
+
};
|
|
153
164
|
if (!property.instance) {
|
|
154
165
|
delete property.instance;
|
|
155
166
|
}
|
|
156
|
-
|
|
157
167
|
this.context.properties.push(property);
|
|
158
168
|
}
|
|
159
|
-
|
|
160
169
|
/**
|
|
161
170
|
* Add a property to the payload.
|
|
171
|
+
*
|
|
162
172
|
* @param opts Contains options for the property.
|
|
163
173
|
*/
|
|
164
174
|
addPayloadChangeProperty(opts) {
|
|
165
|
-
|
|
166
|
-
opts = {};
|
|
167
|
-
}
|
|
168
|
-
|
|
175
|
+
opts ||= {};
|
|
169
176
|
const property = {
|
|
170
177
|
namespace: Utils.defaultIfNullOrEmpty(opts.namespace, 'Alexa.EndpointHealth'),
|
|
171
178
|
instance: Utils.defaultIfNullOrEmpty(opts.instance, undefined),
|
|
@@ -174,62 +181,58 @@ class AlexaResponse {
|
|
|
174
181
|
timeOfSample: Utils.defaultIfNullOrEmpty(opts.timeOfSample, new Date().toISOString()),
|
|
175
182
|
uncertaintyInMilliseconds: Utils.defaultIfNullOrEmpty(opts.uncertaintyInMilliseconds, 0),
|
|
176
183
|
};
|
|
177
|
-
|
|
178
184
|
if (!property.instance) {
|
|
179
185
|
delete property.instance;
|
|
180
186
|
}
|
|
181
|
-
|
|
187
|
+
if (!this.event) {
|
|
188
|
+
throw new Error('Event is not defined');
|
|
189
|
+
}
|
|
190
|
+
this.event.payload.change ||= { properties: [], cause: { type: 'APP_INTERACTION' } };
|
|
182
191
|
this.event.payload.change.properties.push(property);
|
|
183
192
|
}
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
193
|
+
static alexaCapability() {
|
|
194
|
+
return [
|
|
195
|
+
{
|
|
196
|
+
type: 'AlexaInterface',
|
|
197
|
+
interface: 'Alexa',
|
|
198
|
+
version: '3',
|
|
199
|
+
},
|
|
200
|
+
];
|
|
191
201
|
}
|
|
192
|
-
|
|
193
202
|
/**
|
|
194
203
|
* Adds an endpoint to the payload.
|
|
204
|
+
*
|
|
195
205
|
* @param opts Contains options for the endpoint.
|
|
196
206
|
*/
|
|
197
207
|
addPayloadEndpoint(opts) {
|
|
198
|
-
if (this.event
|
|
199
|
-
|
|
200
|
-
}
|
|
201
|
-
|
|
202
|
-
if (opts === undefined) {
|
|
203
|
-
opts = {};
|
|
208
|
+
if (!this.event) {
|
|
209
|
+
throw new Error('Event is not defined');
|
|
204
210
|
}
|
|
205
|
-
|
|
211
|
+
this.event.payload.endpoints ||= [];
|
|
212
|
+
opts ||= {};
|
|
206
213
|
// construct the proper structure expected for the endpoint
|
|
207
|
-
|
|
214
|
+
const endpoint = {
|
|
208
215
|
endpointId: Utils.defaultIfNullOrEmpty(opts.endpointId, 'dummy-endpoint-001'),
|
|
209
216
|
manufacturerName: Utils.defaultIfNullOrEmpty(opts.manufacturerName, 'ioBroker Group'),
|
|
210
217
|
description: Utils.defaultIfNullOrEmpty(opts.description, 'Device controlled by ioBroker'),
|
|
211
218
|
friendlyName: Utils.defaultIfNullOrEmpty(opts.friendlyName, 'ioBroker Stub Endpoint'),
|
|
212
219
|
displayCategories: Utils.defaultIfNullOrEmpty(opts.displayCategories, ['OTHER']),
|
|
213
|
-
capabilities:
|
|
220
|
+
capabilities: AlexaResponse.alexaCapability().concat(Utils.defaultIfNullOrEmpty(opts.capabilities, [])),
|
|
221
|
+
cookie: undefined,
|
|
214
222
|
};
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
endpoint.cookie = Utils.defaultIfNullOrEmpty('cookie', {});
|
|
223
|
+
if (Object.prototype.hasOwnProperty.call(opts, 'cookie')) {
|
|
224
|
+
endpoint.cookie = Utils.defaultIfNullOrEmpty(opts.cookie, {});
|
|
218
225
|
}
|
|
219
|
-
|
|
220
226
|
this.event.payload.endpoints.push(endpoint);
|
|
221
227
|
}
|
|
222
|
-
|
|
223
228
|
/**
|
|
224
229
|
* Creates a capability for an endpoint within the payload.
|
|
230
|
+
*
|
|
225
231
|
* @param opts Contains options for the endpoint capability.
|
|
226
232
|
*/
|
|
227
233
|
asEndpointCapability(opts) {
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
}
|
|
231
|
-
|
|
232
|
-
let response = {
|
|
234
|
+
opts ||= {};
|
|
235
|
+
const response = {
|
|
233
236
|
type: Utils.defaultIfNullOrEmpty(opts.type, 'AlexaInterface'),
|
|
234
237
|
interface: Utils.defaultIfNullOrEmpty(opts.interface, 'Alexa'),
|
|
235
238
|
version: Utils.defaultIfNullOrEmpty(opts.version, '3'),
|
|
@@ -240,23 +243,26 @@ class AlexaResponse {
|
|
|
240
243
|
semantics: Utils.defaultIfNullOrEmpty(opts.semantics, undefined),
|
|
241
244
|
capabilityResources: Utils.defaultIfNullOrEmpty(opts.capabilityResources, undefined),
|
|
242
245
|
};
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
246
|
+
if (!response.instance) {
|
|
247
|
+
delete response.instance;
|
|
248
|
+
}
|
|
249
|
+
if (!response.configuration) {
|
|
250
|
+
delete response.configuration;
|
|
251
|
+
}
|
|
252
|
+
if (!response.semantics) {
|
|
253
|
+
delete response.semantics;
|
|
254
|
+
}
|
|
255
|
+
if (!response.capabilityResources) {
|
|
256
|
+
delete response.capabilityResources;
|
|
248
257
|
}
|
|
249
|
-
|
|
250
258
|
return response;
|
|
251
259
|
}
|
|
252
|
-
|
|
253
260
|
/**
|
|
254
261
|
* Get the composed Alexa Response.
|
|
255
|
-
* @returns {AlexaResponse}
|
|
256
262
|
*/
|
|
257
263
|
get() {
|
|
258
264
|
return this;
|
|
259
265
|
}
|
|
260
266
|
}
|
|
261
|
-
|
|
262
|
-
|
|
267
|
+
exports.default = AlexaResponse;
|
|
268
|
+
//# sourceMappingURL=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AAI,CAAC;IAChB,CAAC;;AAvTL,gCAwTC","sourcesContent":["import { v4 as uuidv4 } from 'uuid';\nimport * as Utils from '../Helpers/Utils';\nimport type {\n AlexaV3Capability,\n AlexaV3ContextProperty,\n AlexaV3Directive,\n AlexaV3DirectiveType,\n AlexaV3DiscoverAppliance,\n AlexaV3EndpointID,\n AlexaV3Namespace,\n AlexaV3Payload,\n AlexaV3ReportedState,\n AlexaV3Request,\n} from '../types';\n\n/**\n * Helper class to generate an AlexaResponse.\n */\nexport default class AlexaResponse {\n public context?: {\n properties: AlexaV3ReportedState[];\n };\n\n public iobVersion = '1';\n\n public readonly event?: AlexaV3Directive;\n\n static ErrorResponseName: AlexaV3DirectiveType = 'ErrorResponse';\n\n static isErrorResponse(response: AlexaResponse): boolean {\n return response?.event?.header?.name === AlexaResponse.ErrorResponseName;\n }\n\n static errorResponse(messageId: string, payload: any): AlexaResponse {\n return new AlexaResponse({\n name: AlexaResponse.ErrorResponseName,\n payload,\n messageId,\n });\n }\n\n static endpointUnreachable(messageId: string): AlexaResponse {\n return AlexaResponse.errorResponse(messageId, {\n type: 'ENDPOINT_UNREACHABLE',\n message: 'Unable to reach endpoint.',\n });\n }\n\n static directiveNotSupportedByControl(\n controlName: string,\n namespace: AlexaV3Namespace,\n messageId: string,\n payloadVersion: string,\n ): AlexaResponse {\n return AlexaResponse.errorResponse(messageId, {\n type: 'INTERNAL_ERROR',\n message: `Control ${controlName} doesn't support the ${namespace} with payloadVersion ${payloadVersion}`,\n });\n }\n\n static directiveNotSupportedByDevice(\n deviceName: string,\n namespace: AlexaV3Namespace,\n messageId: string,\n payloadVersion: string,\n ): AlexaResponse {\n return AlexaResponse.errorResponse(messageId, {\n type: 'INTERNAL_ERROR',\n message: `Device ${deviceName} doesn't support the ${namespace} with payloadVersion ${payloadVersion}`,\n });\n }\n\n static nonExistingEndpoint(messageId: string, endpointId: AlexaV3EndpointID | undefined): AlexaResponse {\n return AlexaResponse.errorResponse(messageId, {\n type: 'INTERNAL_ERROR',\n message: `No endpoint with id ${endpointId} found`,\n });\n }\n\n /**\n * Composes Alexa respond on a successfully processed Alexa directive to change the capability's value of a device\n */\n static handled(event: AlexaV3Request, propertyName: string, value: any, propertyInstance?: string): AlexaResponse {\n const response = new AlexaResponse({\n correlationToken: event?.directive?.header?.correlationToken,\n token: event?.directive?.endpoint?.scope?.token,\n endpointId: event?.directive?.endpoint?.endpointId,\n messageId: event?.directive?.header?.messageId,\n });\n\n response.addContextProperty({\n namespace: event?.directive?.header?.namespace,\n name: propertyName,\n instance: propertyInstance,\n value,\n });\n\n return response;\n }\n\n /**\n * Constructor for an Alexa Response.\n *\n * @param opts Contains initialization options for the response\n */\n constructor(opts?: {\n context?: {\n properties: AlexaV3ReportedState[];\n };\n namespace?: AlexaV3Namespace;\n name?: AlexaV3DirectiveType;\n messageId?: string;\n correlationToken?: string;\n payloadVersion?: '3';\n token?: string;\n endpointId?: string;\n payload?: AlexaV3Payload;\n changeCauseType?: 'APP_INTERACTION' | 'PHYSICAL_INTERACTION' | 'VOICE_INTERACTION';\n event?: AlexaV3Directive;\n }) {\n opts ||= {};\n\n if (opts.context !== undefined) {\n this.context = Utils.defaultIfNullOrEmpty(opts.context, undefined);\n }\n\n if (opts.event !== undefined) {\n this.event = Utils.defaultIfNullOrEmpty(opts.event, undefined);\n } else {\n this.event = {\n header: {\n namespace: Utils.defaultIfNullOrEmpty<AlexaV3Namespace>(opts.namespace, 'Alexa'),\n name: Utils.defaultIfNullOrEmpty<AlexaV3DirectiveType>(opts.name, 'Response'),\n messageId: Utils.defaultIfNullOrEmpty(opts.messageId, uuidv4()),\n correlationToken: Utils.defaultIfNullOrEmpty(opts.correlationToken, undefined),\n payloadVersion: Utils.defaultIfNullOrEmpty<'3'>(opts.payloadVersion, '3'),\n },\n endpoint: {\n scope: {\n type: 'BearerToken',\n token: Utils.defaultIfNullOrEmpty(opts.token, 'INVALID'),\n },\n endpointId: Utils.defaultIfNullOrEmpty(opts.endpointId, 'INVALID'),\n },\n payload: Utils.defaultIfNullOrEmpty(opts.payload, {}),\n };\n\n if (opts.changeCauseType) {\n this.event.payload.change = {\n cause: {\n type: opts.changeCauseType,\n },\n properties: [],\n };\n }\n }\n\n if (!this.event) {\n throw new Error('Event is not defined');\n }\n\n // No endpoint in an AcceptGrant or Discover request\n if (this.event.header.name === 'AcceptGrant.Response' || this.event.header.name === 'Discover.Response') {\n delete this.event.endpoint;\n }\n }\n\n addContext(): void {\n this.context ||= { properties: [] };\n }\n\n /**\n * Add a property to the context.\n *\n * @param opts Contains options for the property.\n */\n addContextProperty(opts: {\n namespace?: AlexaV3Namespace;\n instance?: string;\n name?: string;\n value?: any;\n timeOfSample?: string;\n uncertaintyInMilliseconds?: number;\n }): void {\n this.addContext();\n\n const property = {\n namespace: Utils.defaultIfNullOrEmpty(opts.namespace, 'Alexa.EndpointHealth'),\n instance: Utils.defaultIfNullOrEmpty(opts.instance, undefined),\n name: Utils.defaultIfNullOrEmpty(opts.name, 'connectivity'),\n value: Utils.defaultIfNullOrEmpty(opts.value, { value: 'OK' }),\n timeOfSample: Utils.defaultIfNullOrEmpty(opts.timeOfSample, new Date().toISOString()),\n uncertaintyInMilliseconds: Utils.defaultIfNullOrEmpty(opts.uncertaintyInMilliseconds, 0),\n };\n\n if (!property.instance) {\n delete property.instance;\n }\n\n this.context!.properties.push(property);\n }\n\n /**\n * Add a property to the payload.\n *\n * @param opts Contains options for the property.\n */\n addPayloadChangeProperty(opts: AlexaV3ContextProperty): void {\n opts ||= {} as AlexaV3ContextProperty;\n\n const property = {\n namespace: Utils.defaultIfNullOrEmpty(opts.namespace, 'Alexa.EndpointHealth'),\n instance: Utils.defaultIfNullOrEmpty(opts.instance, undefined),\n name: Utils.defaultIfNullOrEmpty(opts.name, 'connectivity'),\n value: Utils.defaultIfNullOrEmpty(opts.value, { value: 'OK' }),\n timeOfSample: Utils.defaultIfNullOrEmpty(opts.timeOfSample, new Date().toISOString()),\n uncertaintyInMilliseconds: Utils.defaultIfNullOrEmpty(opts.uncertaintyInMilliseconds, 0),\n };\n\n if (!property.instance) {\n delete property.instance;\n }\n\n if (!this.event) {\n throw new Error('Event is not defined');\n }\n this.event.payload.change ||= { properties: [], cause: { type: 'APP_INTERACTION' } };\n\n this.event.payload.change.properties.push(property);\n }\n\n static alexaCapability(): AlexaV3Capability[] {\n return [\n {\n type: 'AlexaInterface',\n interface: 'Alexa',\n version: '3',\n },\n ];\n }\n\n /**\n * Adds an endpoint to the payload.\n *\n * @param opts Contains options for the endpoint.\n */\n addPayloadEndpoint(opts: AlexaV3DiscoverAppliance): void {\n if (!this.event) {\n throw new Error('Event is not defined');\n }\n\n this.event.payload.endpoints ||= [];\n\n opts ||= {} as AlexaV3DiscoverAppliance;\n\n // construct the proper structure expected for the endpoint\n const endpoint: AlexaV3DiscoverAppliance = {\n endpointId: Utils.defaultIfNullOrEmpty(opts.endpointId, 'dummy-endpoint-001'),\n manufacturerName: Utils.defaultIfNullOrEmpty(opts.manufacturerName, 'ioBroker Group'),\n description: Utils.defaultIfNullOrEmpty(opts.description, 'Device controlled by ioBroker'),\n friendlyName: Utils.defaultIfNullOrEmpty(opts.friendlyName, 'ioBroker Stub Endpoint'),\n displayCategories: Utils.defaultIfNullOrEmpty(opts.displayCategories, ['OTHER']),\n capabilities: AlexaResponse.alexaCapability().concat(\n Utils.defaultIfNullOrEmpty<AlexaV3Capability[]>(opts.capabilities, []),\n ),\n cookie: undefined,\n };\n\n if (Object.prototype.hasOwnProperty.call(opts, 'cookie')) {\n endpoint.cookie = Utils.defaultIfNullOrEmpty<Record<string, string>>(opts.cookie, {});\n }\n\n this.event.payload.endpoints.push(endpoint);\n }\n\n /**\n * Creates a capability for an endpoint within the payload.\n *\n * @param opts Contains options for the endpoint capability.\n */\n asEndpointCapability(opts?: AlexaV3Capability): AlexaV3Capability {\n opts ||= {} as AlexaV3Capability;\n\n const response = {\n type: Utils.defaultIfNullOrEmpty(opts.type, 'AlexaInterface'),\n interface: Utils.defaultIfNullOrEmpty(opts.interface, 'Alexa'),\n version: Utils.defaultIfNullOrEmpty(opts.version, '3'),\n properties: Utils.defaultIfNullOrEmpty<{\n supported: { name: string }[];\n proactivelyReported?: boolean;\n retrievable?: boolean;\n nonControllable?: boolean;\n }>(\n opts.properties,\n {} as {\n supported: { name: string }[];\n proactivelyReported?: boolean;\n retrievable?: boolean;\n nonControllable?: boolean;\n },\n ),\n // not all capabilities have the following ones\n instance: Utils.defaultIfNullOrEmpty(opts.instance, undefined),\n configuration: Utils.defaultIfNullOrEmpty(opts.configuration, undefined),\n semantics: Utils.defaultIfNullOrEmpty(opts.semantics, undefined),\n capabilityResources: Utils.defaultIfNullOrEmpty(opts.capabilityResources, undefined),\n };\n\n if (!response.instance) {\n delete response.instance;\n }\n if (!response.configuration) {\n delete response.configuration;\n }\n if (!response.semantics) {\n delete response.semantics;\n }\n if (!response.capabilityResources) {\n delete response.capabilityResources;\n }\n\n return response;\n }\n\n /**\n * Get the composed Alexa Response.\n */\n get(): AlexaResponse {\n return this;\n }\n}\n"]}
|
|
@@ -1,96 +1,84 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Base = void 0;
|
|
4
|
+
const Utils_1 = require("../../Helpers/Utils");
|
|
3
5
|
class Base {
|
|
6
|
+
_properties;
|
|
4
7
|
constructor() {
|
|
5
8
|
this._properties = this.initProperties();
|
|
6
9
|
}
|
|
7
|
-
|
|
8
10
|
get name() {
|
|
9
11
|
return `${this.constructor.name}`;
|
|
10
12
|
}
|
|
11
|
-
|
|
12
13
|
get namespace() {
|
|
13
14
|
return `Alexa.${this.constructor.name}`;
|
|
14
15
|
}
|
|
15
|
-
|
|
16
16
|
reportValue(value) {
|
|
17
17
|
return value;
|
|
18
18
|
}
|
|
19
|
-
|
|
20
19
|
initProperties() {
|
|
21
20
|
return [];
|
|
22
21
|
}
|
|
23
|
-
|
|
24
22
|
/**
|
|
25
23
|
* Checks whether the capability instance matches, i.e. can handle the event Alexa sends to the skill
|
|
24
|
+
*
|
|
26
25
|
* @param event Contains the Alexa event.
|
|
27
|
-
* @returns {boolean}
|
|
28
26
|
*/
|
|
29
27
|
matches(event) {
|
|
30
|
-
return event?.directive?.header?.namespace === this.namespace &&
|
|
28
|
+
return (event?.directive?.header?.namespace === this.namespace &&
|
|
29
|
+
event?.directive?.header?.payloadVersion === this.version);
|
|
31
30
|
}
|
|
32
|
-
|
|
33
31
|
static get namespace() {
|
|
34
|
-
return `Alexa.${
|
|
32
|
+
return `Alexa.${(0, Utils_1.className)(this.toString())}`;
|
|
35
33
|
}
|
|
36
|
-
|
|
37
34
|
/**
|
|
38
35
|
* Checks whether the capability object matches, i.e., can handle the event Alexa sends to the skill
|
|
36
|
+
*
|
|
39
37
|
* @param event Contains the Alexa event.
|
|
40
|
-
* @returns {boolean}
|
|
41
38
|
*/
|
|
42
39
|
static matches(event) {
|
|
43
40
|
return event?.directive?.header?.namespace === this.namespace;
|
|
44
41
|
}
|
|
45
|
-
|
|
46
42
|
get properties() {
|
|
47
43
|
return this._properties;
|
|
48
44
|
}
|
|
49
|
-
|
|
50
45
|
/**
|
|
51
46
|
*
|
|
52
|
-
* @param
|
|
47
|
+
* @param event Contains the Alexa event.
|
|
53
48
|
* @returns Property to handle on Alexa directive
|
|
54
49
|
*/
|
|
55
50
|
property(event) {
|
|
56
51
|
return this.properties.find(p => p.matches(event));
|
|
57
52
|
}
|
|
58
|
-
|
|
59
53
|
/**
|
|
60
54
|
* Returns object containing all the properties of the smart device capability as it expected by Alexa during discovery
|
|
61
|
-
* @returns {object}
|
|
62
55
|
*/
|
|
63
56
|
get discoverableProperties() {
|
|
64
57
|
return {
|
|
65
|
-
supported: this.properties.map(p => {
|
|
58
|
+
supported: this.properties.map(p => {
|
|
59
|
+
return { name: p.propertyName };
|
|
60
|
+
}),
|
|
66
61
|
proactivelyReported: this.proactivelyReported,
|
|
67
62
|
retrievable: this.retrievable,
|
|
68
63
|
};
|
|
69
64
|
}
|
|
70
|
-
|
|
71
65
|
/**
|
|
72
66
|
* Returns whether the smart device proactively reports state changes
|
|
73
|
-
* @returns {boolean}
|
|
74
67
|
*/
|
|
75
68
|
get proactivelyReported() {
|
|
76
69
|
return true;
|
|
77
70
|
}
|
|
78
|
-
|
|
79
71
|
/**
|
|
80
72
|
* Returns whether the smart device handles Alexa ReportState directives
|
|
81
|
-
* @returns {boolean}
|
|
82
73
|
*/
|
|
83
74
|
get retrievable() {
|
|
84
75
|
return true;
|
|
85
76
|
}
|
|
86
|
-
|
|
87
77
|
get version() {
|
|
88
78
|
return '3';
|
|
89
79
|
}
|
|
90
|
-
|
|
91
80
|
/**
|
|
92
81
|
* Returns response to Alexa Discovery directive
|
|
93
|
-
* @returns {object}
|
|
94
82
|
*/
|
|
95
83
|
get alexaResponse() {
|
|
96
84
|
return {
|
|
@@ -99,26 +87,24 @@ class Base {
|
|
|
99
87
|
properties: this.discoverableProperties,
|
|
100
88
|
};
|
|
101
89
|
}
|
|
102
|
-
|
|
103
90
|
propertyName(event) {
|
|
104
|
-
return this.property(event)
|
|
91
|
+
return this.property(event)?.propertyName;
|
|
105
92
|
}
|
|
106
|
-
|
|
107
93
|
/**
|
|
108
94
|
* Extracts value to be set on the smart device sent in an Alexa directive
|
|
109
|
-
* @returns {object}
|
|
110
95
|
*/
|
|
111
96
|
alexaValue(event) {
|
|
112
|
-
|
|
97
|
+
throw new Error(`Method alexaValue is not implemented in ${this.name} capability`);
|
|
98
|
+
// @ts-expect-error fix later!!!!
|
|
99
|
+
return this.property(event)?.alexaValue(event);
|
|
113
100
|
}
|
|
114
|
-
|
|
115
101
|
/**
|
|
116
102
|
* Extracts endpoint id sent in an Alexa directive
|
|
117
|
-
* @returns {string}
|
|
118
103
|
*/
|
|
119
104
|
static endpointId(event) {
|
|
120
|
-
return event.directive.endpoint
|
|
105
|
+
return event.directive.endpoint?.endpointId;
|
|
121
106
|
}
|
|
122
107
|
}
|
|
123
|
-
|
|
124
|
-
|
|
108
|
+
exports.Base = Base;
|
|
109
|
+
exports.default = Base;
|
|
110
|
+
//# sourceMappingURL=Base.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Base.js","sourceRoot":"","sources":["../../../../../src/lib/AlexaSmartHomeV3/Alexa/Capabilities/Base.ts"],"names":[],"mappings":";;;AAAA,+CAAgD;AAIhD,MAAa,IAAI;IACG,WAAW,CAAmB;IAE9C;QACI,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC,cAAc,EAAE,CAAC;IAC7C,CAAC;IAED,IAAI,IAAI;QACJ,OAAO,GAAG,IAAI,CAAC,WAAW,CAAC,IAAI,EAAE,CAAC;IACtC,CAAC;IAED,IAAI,SAAS;QACT,OAAO,SAAS,IAAI,CAAC,WAAW,CAAC,IAAI,EAAsB,CAAC;IAChE,CAAC;IAED,WAAW,CAAC,KAAuB;QAC/B,OAAO,KAAK,CAAC;IACjB,CAAC;IAED,cAAc;QACV,OAAO,EAAE,CAAC;IACd,CAAC;IAED;;;;OAIG;IACH,OAAO,CAAC,KAAqB;QACzB,OAAO,CACH,KAAK,EAAE,SAAS,EAAE,MAAM,EAAE,SAAS,KAAK,IAAI,CAAC,SAAS;YACtD,KAAK,EAAE,SAAS,EAAE,MAAM,EAAE,cAAc,KAAK,IAAI,CAAC,OAAO,CAC5D,CAAC;IACN,CAAC;IAED,MAAM,KAAK,SAAS;QAChB,OAAO,SAAS,IAAA,iBAAS,EAAC,IAAI,CAAC,QAAQ,EAAE,CAAC,EAAsB,CAAC;IACrE,CAAC;IAED;;;;OAIG;IACH,MAAM,CAAC,OAAO,CAAC,KAAqB;QAChC,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,EAAE,SAAS,KAAK,IAAI,CAAC,SAAS,CAAC;IAClE,CAAC;IAED,IAAI,UAAU;QACV,OAAO,IAAI,CAAC,WAAW,CAAC;IAC5B,CAAC;IAED;;;;OAIG;IACH,QAAQ,CAAC,KAAqB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AAC;CACJ;AA9HD,oBA8HC;AAED,kBAAe,IAAI,CAAC","sourcesContent":["import { className } from '../../Helpers/Utils';\nimport type { AlexaV3Capability, AlexaV3EndpointID, AlexaV3Namespace, AlexaV3Request } from '../../types';\nimport type { Base as PropertiesBase } from '../Properties/Base';\n\nexport class Base {\n public readonly _properties: PropertiesBase[];\n\n constructor() {\n this._properties = this.initProperties();\n }\n\n get name(): string {\n return `${this.constructor.name}`;\n }\n\n get namespace(): AlexaV3Namespace {\n return `Alexa.${this.constructor.name}` as AlexaV3Namespace;\n }\n\n reportValue(value: number | boolean): any {\n return value;\n }\n\n initProperties(): PropertiesBase[] {\n return [];\n }\n\n /**\n * Checks whether the capability instance matches, i.e. can handle the event Alexa sends to the skill\n *\n * @param event Contains the Alexa event.\n */\n matches(event: AlexaV3Request): boolean {\n return (\n event?.directive?.header?.namespace === this.namespace &&\n event?.directive?.header?.payloadVersion === this.version\n );\n }\n\n static get namespace(): AlexaV3Namespace {\n return `Alexa.${className(this.toString())}` as AlexaV3Namespace;\n }\n\n /**\n * Checks whether the capability object matches, i.e., can handle the event Alexa sends to the skill\n *\n * @param event Contains the Alexa event.\n */\n static matches(event: AlexaV3Request): boolean {\n return event?.directive?.header?.namespace === this.namespace;\n }\n\n get properties(): PropertiesBase[] {\n return this._properties;\n }\n\n /**\n *\n * @param event Contains the Alexa event.\n * @returns Property to handle on Alexa directive\n */\n property(event: AlexaV3Request): PropertiesBase | undefined {\n return this.properties.find(p => p.matches(event));\n }\n\n /**\n * Returns object containing all the properties of the smart device capability as it expected by Alexa during discovery\n */\n get discoverableProperties(): {\n supported: { name: string }[];\n proactivelyReported: boolean;\n retrievable: boolean;\n } {\n return {\n supported: this.properties.map(p => {\n return { name: p.propertyName };\n }),\n proactivelyReported: this.proactivelyReported,\n retrievable: this.retrievable,\n };\n }\n\n /**\n * Returns whether the smart device proactively reports state changes\n */\n get proactivelyReported(): boolean {\n return true;\n }\n\n /**\n * Returns whether the smart device handles Alexa ReportState directives\n */\n get retrievable(): boolean {\n return true;\n }\n\n get version(): string {\n return '3';\n }\n\n /**\n * Returns response to Alexa Discovery directive\n */\n get alexaResponse(): AlexaV3Capability {\n return {\n interface: this.namespace,\n version: this.version,\n properties: this.discoverableProperties,\n };\n }\n\n propertyName(event: AlexaV3Request): string | undefined {\n return this.property(event)?.propertyName;\n }\n\n /**\n * Extracts value to be set on the smart device sent in an Alexa directive\n */\n alexaValue(event: AlexaV3Request): number | boolean | undefined {\n throw new Error(`Method alexaValue is not implemented in ${this.name} capability`);\n // @ts-expect-error fix later!!!!\n return this.property(event)?.alexaValue(event);\n }\n\n /**\n * Extracts endpoint id sent in an Alexa directive\n */\n static endpointId(event: AlexaV3Request): AlexaV3EndpointID | undefined {\n return event.directive.endpoint?.endpointId;\n }\n}\n\nexport default Base;\n"]}
|
|
@@ -0,0 +1,19 @@
|
|
|
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 Base_1 = __importDefault(require("./Base"));
|
|
7
|
+
const Brightness_1 = __importDefault(require("../Properties/Brightness"));
|
|
8
|
+
class BrightnessController extends Base_1.default {
|
|
9
|
+
_brightness;
|
|
10
|
+
initProperties() {
|
|
11
|
+
this._brightness = new Brightness_1.default();
|
|
12
|
+
return [this._brightness];
|
|
13
|
+
}
|
|
14
|
+
get brightness() {
|
|
15
|
+
return this._brightness;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
exports.default = BrightnessController;
|
|
19
|
+
//# sourceMappingURL=BrightnessController.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"BrightnessController.js","sourceRoot":"","sources":["../../../../../src/lib/AlexaSmartHomeV3/Alexa/Capabilities/BrightnessController.ts"],"names":[],"mappings":";;;;;AAAA,kDAA0B;AAE1B,0EAAkD;AAElD,MAAqB,oBAAqB,SAAQ,cAAI;IAC1C,WAAW,CAAyB;IAE5C,cAAc;QACV,IAAI,CAAC,WAAW,GAAG,IAAI,oBAAU,EAAE,CAAC;QACpC,OAAO,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;IAC9B,CAAC;IAED,IAAI,UAAU;QACV,OAAO,IAAI,CAAC,WAAY,CAAC;IAC7B,CAAC;CACJ;AAXD,uCAWC","sourcesContent":["import Base from './Base';\nimport type { Base as PropertiesBase } from '../Properties/Base';\nimport Brightness from '../Properties/Brightness';\n\nexport default class BrightnessController extends Base {\n private _brightness: Brightness | undefined;\n\n initProperties(): PropertiesBase[] {\n this._brightness = new Brightness();\n return [this._brightness];\n }\n\n get brightness(): PropertiesBase {\n return this._brightness!;\n }\n}\n"]}
|
|
@@ -0,0 +1,14 @@
|
|
|
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 Properties_1 = __importDefault(require("../Properties"));
|
|
7
|
+
const Base_1 = __importDefault(require("./Base"));
|
|
8
|
+
class ColorController extends Base_1.default {
|
|
9
|
+
initProperties() {
|
|
10
|
+
return [new Properties_1.default.Color()];
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
exports.default = ColorController;
|
|
14
|
+
//# sourceMappingURL=ColorController.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ColorController.js","sourceRoot":"","sources":["../../../../../src/lib/AlexaSmartHomeV3/Alexa/Capabilities/ColorController.ts"],"names":[],"mappings":";;;;;AAAA,+DAAuC;AACvC,kDAA0B;AAG1B,MAAqB,eAAgB,SAAQ,cAAI;IAC7C,cAAc;QACV,OAAO,CAAC,IAAI,oBAAU,CAAC,KAAK,EAAE,CAAC,CAAC;IACpC,CAAC;CACJ;AAJD,kCAIC","sourcesContent":["import Properties from '../Properties';\nimport Base from './Base';\nimport type { Base as PropertiesBase } from '../Properties/Base';\n\nexport default class ColorController extends Base {\n initProperties(): PropertiesBase[] {\n return [new Properties.Color()];\n }\n}\n"]}
|
|
@@ -0,0 +1,19 @@
|
|
|
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 Base_1 = __importDefault(require("./Base"));
|
|
7
|
+
const ColorTemperatureInKelvin_1 = __importDefault(require("../Properties/ColorTemperatureInKelvin"));
|
|
8
|
+
class ColorTemperatureController extends Base_1.default {
|
|
9
|
+
_colorTemperatureInKelvin;
|
|
10
|
+
initProperties() {
|
|
11
|
+
this._colorTemperatureInKelvin = new ColorTemperatureInKelvin_1.default();
|
|
12
|
+
return [this._colorTemperatureInKelvin];
|
|
13
|
+
}
|
|
14
|
+
get colorTemperatureInKelvin() {
|
|
15
|
+
return this._colorTemperatureInKelvin;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
exports.default = ColorTemperatureController;
|
|
19
|
+
//# sourceMappingURL=ColorTemperatureController.js.map
|
package/build-backend/lib/AlexaSmartHomeV3/Alexa/Capabilities/ColorTemperatureController.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ColorTemperatureController.js","sourceRoot":"","sources":["../../../../../src/lib/AlexaSmartHomeV3/Alexa/Capabilities/ColorTemperatureController.ts"],"names":[],"mappings":";;;;;AAAA,kDAA0B;AAE1B,sGAA8E;AAE9E,MAAqB,0BAA2B,SAAQ,cAAI;IAChD,yBAAyB,CAAuC;IAExE,cAAc;QACV,IAAI,CAAC,yBAAyB,GAAG,IAAI,kCAAwB,EAAE,CAAC;QAChE,OAAO,CAAC,IAAI,CAAC,yBAAyB,CAAC,CAAC;IAC5C,CAAC;IAED,IAAI,wBAAwB;QACxB,OAAO,IAAI,CAAC,yBAA0B,CAAC;IAC3C,CAAC;CACJ;AAXD,6CAWC","sourcesContent":["import Base from './Base';\nimport type { Base as PropertiesBase } from '../Properties/Base';\nimport ColorTemperatureInKelvin from '../Properties/ColorTemperatureInKelvin';\n\nexport default class ColorTemperatureController extends Base {\n private _colorTemperatureInKelvin: ColorTemperatureInKelvin | undefined;\n\n initProperties(): PropertiesBase[] {\n this._colorTemperatureInKelvin = new ColorTemperatureInKelvin();\n return [this._colorTemperatureInKelvin];\n }\n\n get colorTemperatureInKelvin(): PropertiesBase {\n return this._colorTemperatureInKelvin!;\n }\n}\n"]}
|