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,109 +0,0 @@
|
|
|
1
|
-
const Capabilities = require('../Alexa/Capabilities');
|
|
2
|
-
const Properties = require('../Alexa/Properties');
|
|
3
|
-
const AdapterProvider = require('../Helpers/AdapterProvider');
|
|
4
|
-
const Utils = require('../Helpers/Utils');
|
|
5
|
-
const AdjustableControl = require('./AdjustableControl');
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
* @class
|
|
9
|
-
*/
|
|
10
|
-
class Volume extends AdjustableControl {
|
|
11
|
-
get categories() {
|
|
12
|
-
return ['SPEAKER'];
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
adjustableProperties() {
|
|
16
|
-
return [Properties.Volume];
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
initCapabilities() {
|
|
20
|
-
this._speaker = new Capabilities.Speaker();
|
|
21
|
-
let result = [this._speaker];
|
|
22
|
-
for (const property of result.flatMap(item => item.properties)) {
|
|
23
|
-
property.init(this.composeInitObject(property))
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
return result;
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
async setState(property, value) {
|
|
30
|
-
// set the property itself
|
|
31
|
-
await AdapterProvider.setState(property.setId, value);
|
|
32
|
-
property.currentValue = value;
|
|
33
|
-
|
|
34
|
-
if (property.propertyName === Properties.Muted.propertyName) {
|
|
35
|
-
// set volume
|
|
36
|
-
if (value) { // set volume to 0 on MUTED true
|
|
37
|
-
await AdapterProvider.setState(this._speaker.volume.setId, 0);
|
|
38
|
-
this._lastVolume = this._speaker.volume.currentValue
|
|
39
|
-
this._speaker.volume.currentValue = 0;
|
|
40
|
-
} else { // set volume to the last known, configured or 20 otherwise on MUTED false
|
|
41
|
-
if (!this._lastVolume) {
|
|
42
|
-
this._lastVolume = this.states[this.statesMap.set].smartName?.byON;
|
|
43
|
-
this._lastVolume = isNaN(this._lastVolume) ?
|
|
44
|
-
Utils.denormalize_0_100(20, this._speaker.volume.valuesRangeMin, this._speaker.volume.valuesRangeMax) : parseInt(this._lastVolume);
|
|
45
|
-
}
|
|
46
|
-
await AdapterProvider.setState(this._speaker.volume.setId, this._lastVolume);
|
|
47
|
-
this._speaker.volume.currentValue = this._lastVolume;
|
|
48
|
-
}
|
|
49
|
-
} else { // set muted
|
|
50
|
-
const muted = value === 0;
|
|
51
|
-
// only on different IDs for volume and muted
|
|
52
|
-
if (this._speaker.volume.setId !== this._speaker.muted.setId) {
|
|
53
|
-
await AdapterProvider.setState(this._speaker.muted.setId, muted);
|
|
54
|
-
}
|
|
55
|
-
this._speaker.muted.currentValue = muted;
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
async getOrRetrieveCurrentValue(property) {
|
|
60
|
-
if (property.currentValue === undefined) {
|
|
61
|
-
property.currentValue = await AdapterProvider.getState(property.getId);
|
|
62
|
-
|
|
63
|
-
// convert non zero volumes to muted = false
|
|
64
|
-
if (property.propertyName === this._speaker.muted.propertyName && property.getId === this._speaker.volume.getId) {
|
|
65
|
-
property.currentValue = property.currentValue === 0;
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
if (property.currentValue === undefined) {
|
|
70
|
-
throw new Error(`unable to retrieve ${property.getId}`);
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
return property.currentValue;
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
composeInitObject(property) {
|
|
77
|
-
|
|
78
|
-
const map = this.statesMap;
|
|
79
|
-
|
|
80
|
-
if (property.propertyName === Properties.Volume.propertyName) {
|
|
81
|
-
return {
|
|
82
|
-
setState: this.states[map.set],
|
|
83
|
-
getState: this.states[map.actual] || this.states[map.set],
|
|
84
|
-
alexaSetter: function (alexaValue) {
|
|
85
|
-
return Utils.denormalize_0_100(alexaValue, this.valuesRangeMin, this.valuesRangeMax);
|
|
86
|
-
},
|
|
87
|
-
alexaGetter: function (value) {
|
|
88
|
-
return Utils.normalize_0_100(value, this.valuesRangeMin, this.valuesRangeMax);
|
|
89
|
-
}
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
if (property.propertyName === Properties.Muted.propertyName) {
|
|
94
|
-
return {
|
|
95
|
-
setState: this.states[map.mute] || this.states[map.set],
|
|
96
|
-
getState: this.states[map.mute] || this.states[map.set],
|
|
97
|
-
alexaSetter: function (alexaValue) {
|
|
98
|
-
return alexaValue;
|
|
99
|
-
},
|
|
100
|
-
alexaGetter: function (value) {
|
|
101
|
-
return value;
|
|
102
|
-
},
|
|
103
|
-
};
|
|
104
|
-
}
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
module.exports = Volume;
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
const controls = {};
|
|
2
|
-
const controlsPath = require('path').join(__dirname);
|
|
3
|
-
const excludedNames = ['index', 'Control'];
|
|
4
|
-
|
|
5
|
-
require('fs')
|
|
6
|
-
.readdirSync(controlsPath)
|
|
7
|
-
.forEach((file) => {
|
|
8
|
-
const name = file.replace(/\.js$/, '');
|
|
9
|
-
if (!excludedNames.includes(name)) {
|
|
10
|
-
controls[name] = require(`./${file}`);
|
|
11
|
-
}
|
|
12
|
-
});
|
|
13
|
-
|
|
14
|
-
module.exports = controls;
|
|
@@ -1,415 +0,0 @@
|
|
|
1
|
-
const Device = require('./Device');
|
|
2
|
-
const Utils = require('./Helpers/Utils');
|
|
3
|
-
const Directives = require('./Alexa/Directives');
|
|
4
|
-
const Controls = require('./Controls');
|
|
5
|
-
const Logger = require('./Helpers/Logger');
|
|
6
|
-
const AdapterProvider = require('./Helpers/AdapterProvider');
|
|
7
|
-
const AlexaResponse = require('./Alexa/AlexaResponse');
|
|
8
|
-
const IotProxy = require('./Helpers/IotProxy');
|
|
9
|
-
const RateLimiter = require('./Helpers/RateLimiter');
|
|
10
|
-
const OverallDailyRateLimitExceeded = require('./Exceptions/OverallDailyRateLimitExceeded');
|
|
11
|
-
const HourlyDeviceRateLimitExceeded = require('./Exceptions/HourlyDeviceRateLimitExceeded');
|
|
12
|
-
|
|
13
|
-
/**
|
|
14
|
-
* @class
|
|
15
|
-
* */
|
|
16
|
-
class DeviceManager {
|
|
17
|
-
/**
|
|
18
|
-
* Creates a Device Manager.
|
|
19
|
-
* @constructor
|
|
20
|
-
*/
|
|
21
|
-
constructor() {
|
|
22
|
-
this.lang = 'en';
|
|
23
|
-
this.devices = [];
|
|
24
|
-
this.subscribed = [];
|
|
25
|
-
this.log = new Logger(this);
|
|
26
|
-
this.eventsPausedTill = 0; // timestamp
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
informAboutStatesChange() {
|
|
30
|
-
AdapterProvider.get().setState('smart.updates3', true, true);
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
get language() {
|
|
34
|
-
return this.lang;
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
set language(value) {
|
|
38
|
-
this.lang = value;
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
matchDirective(event) {
|
|
42
|
-
let name = Object.keys(Directives).find(key => Directives[key].matches(event));
|
|
43
|
-
|
|
44
|
-
return name ? new Directives[name]() : null;
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
get endpoints() {
|
|
48
|
-
return this.devices;
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
endpointById(id) {
|
|
52
|
-
return this.devices.find(device => device.id === id);
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
addDevice(device) {
|
|
56
|
-
this.devices.push(device);
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
toDevice(detectedControls, friendlyName, autoDetected, roomName, funcName, toggle) {
|
|
60
|
-
let controls = [];
|
|
61
|
-
|
|
62
|
-
this.log.debug(`merging controls to a device with name ${friendlyName}`);
|
|
63
|
-
|
|
64
|
-
detectedControls.forEach(item => {
|
|
65
|
-
this.log.silly(`processing control: ${JSON.stringify(item)}`);
|
|
66
|
-
const controlName = Object.keys(Controls).find(key => Controls[key].type === item.type);
|
|
67
|
-
if (controlName) {
|
|
68
|
-
controls.push(new Controls[controlName](item));
|
|
69
|
-
this.log.debug(`${controlName} added to ${friendlyName}`);
|
|
70
|
-
} else {
|
|
71
|
-
this.log.debug(`control of type ${item.type} not supported yet. Skipped.`);
|
|
72
|
-
}
|
|
73
|
-
});
|
|
74
|
-
|
|
75
|
-
if (controls.length === 0) {
|
|
76
|
-
// the controls are not supported yet...
|
|
77
|
-
return;
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
// create and add a new device to the collected devices
|
|
81
|
-
this.addDevice(
|
|
82
|
-
new Device({
|
|
83
|
-
id: friendlyName,
|
|
84
|
-
friendlyName,
|
|
85
|
-
controls,
|
|
86
|
-
autoDetected,
|
|
87
|
-
roomName,
|
|
88
|
-
funcName,
|
|
89
|
-
toggle,
|
|
90
|
-
}),
|
|
91
|
-
);
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
async collectEndpoints() {
|
|
95
|
-
if (this.collecting) {
|
|
96
|
-
this.log.debug(`collecting devices already in progress. Skipping...`);
|
|
97
|
-
this.recollect = true;
|
|
98
|
-
return;
|
|
99
|
-
}
|
|
100
|
-
this.collecting = true;
|
|
101
|
-
this.log.debug(`(re)collecting devices...`);
|
|
102
|
-
try {
|
|
103
|
-
// const discoveryNeeded = this.devices.length > 0;
|
|
104
|
-
|
|
105
|
-
this.devices = [];
|
|
106
|
-
const defaultToggle = AdapterProvider.get().config.defaultToggle || false;
|
|
107
|
-
|
|
108
|
-
// collect all iobroker controls in terms of iobroker type detector (https://github.com/ioBroker/ioBroker.type-detector)
|
|
109
|
-
let detectedControls = await Utils.controls(AdapterProvider.get(), this.lang);
|
|
110
|
-
|
|
111
|
-
this.log.debug(`type detector found ${detectedControls.length} controls`);
|
|
112
|
-
|
|
113
|
-
// Normally, every control is a smart device. But due to the iobroker concept of 'rooms and functions'
|
|
114
|
-
// multiple controls might be merged to a single device.
|
|
115
|
-
|
|
116
|
-
// as long as not all controls mapped to a device...
|
|
117
|
-
|
|
118
|
-
// detectedControls = detectedControls.filter(c => ['light', 'dimmer'].includes(c.type));
|
|
119
|
-
const createdGroups = [];
|
|
120
|
-
|
|
121
|
-
while (detectedControls.length) {
|
|
122
|
-
// take the next control
|
|
123
|
-
let control = detectedControls[0];
|
|
124
|
-
let processedControls = [];
|
|
125
|
-
|
|
126
|
-
if (control.room?.common?.name) {
|
|
127
|
-
if (control.functionality?.common?.name) {
|
|
128
|
-
// controls in the same room with the same functionality
|
|
129
|
-
processedControls = detectedControls.filter(
|
|
130
|
-
item =>
|
|
131
|
-
item.room?.id === control.room.id &&
|
|
132
|
-
item.functionality?.id === control.functionality.id,
|
|
133
|
-
);
|
|
134
|
-
this.toDevice(
|
|
135
|
-
processedControls,
|
|
136
|
-
Utils.friendlyNameByRoomAndFunctionName(control, this.lang),
|
|
137
|
-
true,
|
|
138
|
-
control.room?.common?.name,
|
|
139
|
-
control.functionality?.common?.name,
|
|
140
|
-
processedControls[0].toggle === true || processedControls[0].toggle === false
|
|
141
|
-
? processedControls[0].toggle
|
|
142
|
-
: defaultToggle,
|
|
143
|
-
);
|
|
144
|
-
} else {
|
|
145
|
-
this.log.debug(
|
|
146
|
-
`Control of type [${control.type}] assigned to room [${control.room.common.name.en}] has no function. Skipped.`,
|
|
147
|
-
);
|
|
148
|
-
}
|
|
149
|
-
} else if (control.groupNames) {
|
|
150
|
-
// no room, but smart name (not only one)
|
|
151
|
-
control.groupNames.forEach(groupName => {
|
|
152
|
-
if (!createdGroups.includes(groupName)) {
|
|
153
|
-
createdGroups.push(groupName);
|
|
154
|
-
processedControls = detectedControls.filter(item => item.groupNames?.includes(groupName));
|
|
155
|
-
this.toDevice(
|
|
156
|
-
processedControls,
|
|
157
|
-
Utils.stringify(groupName),
|
|
158
|
-
false,
|
|
159
|
-
null,
|
|
160
|
-
null,
|
|
161
|
-
processedControls[0].toggle === true || processedControls[0].toggle === false
|
|
162
|
-
? processedControls[0].toggle
|
|
163
|
-
: defaultToggle,
|
|
164
|
-
);
|
|
165
|
-
}
|
|
166
|
-
});
|
|
167
|
-
} else {
|
|
168
|
-
// neither room nor smart name
|
|
169
|
-
this.log.debug(`Control of type [${control.type}] has neither room no smart name. Skipped.`);
|
|
170
|
-
}
|
|
171
|
-
|
|
172
|
-
if (processedControls.length === 0) {
|
|
173
|
-
processedControls = [control];
|
|
174
|
-
}
|
|
175
|
-
|
|
176
|
-
// remove processed controls
|
|
177
|
-
let objectIds = processedControls.map(item => item.object.id);
|
|
178
|
-
detectedControls = detectedControls.filter(item => !objectIds.includes(item.object.id));
|
|
179
|
-
}
|
|
180
|
-
|
|
181
|
-
// done
|
|
182
|
-
this.log.debug(`finished collecting devices. there is/are ${this.devices.length} device(s) in total`);
|
|
183
|
-
for (const device of this.devices) {
|
|
184
|
-
this.log.debug(`${device.toString()}`);
|
|
185
|
-
}
|
|
186
|
-
|
|
187
|
-
// a new discovery process is needed in case we had already devices and device collection was
|
|
188
|
-
// triggered again by, e.g., a change in room/function enums
|
|
189
|
-
// if (discoveryNeeded) {
|
|
190
|
-
// this.log.info(`Please delete all managed by ioBroker devices in your Alexa app and then start discovery`);
|
|
191
|
-
// }
|
|
192
|
-
|
|
193
|
-
// collect all relevant states to subscribe to updates
|
|
194
|
-
const stateIds = new Set(
|
|
195
|
-
this.devices
|
|
196
|
-
.flatMap(d => d.controls)
|
|
197
|
-
.flatMap(item => item.supported)
|
|
198
|
-
.flatMap(item => item.properties)
|
|
199
|
-
.map(item => item.getId)
|
|
200
|
-
.filter(id => id),
|
|
201
|
-
);
|
|
202
|
-
this.log.debug(`registering for updates of total ${stateIds.size} states`);
|
|
203
|
-
const promises = [];
|
|
204
|
-
const newSubscribed = Array.from(stateIds);
|
|
205
|
-
// subscribe to updates
|
|
206
|
-
for (const id of newSubscribed) {
|
|
207
|
-
this.log.silly(`subscribing to updates of ${id}`);
|
|
208
|
-
if (!this.subscribed.includes(id)) {
|
|
209
|
-
this.subscribed.push(id);
|
|
210
|
-
promises.push(AdapterProvider.subscribe(id));
|
|
211
|
-
}
|
|
212
|
-
}
|
|
213
|
-
|
|
214
|
-
this.subscribed.sort();
|
|
215
|
-
|
|
216
|
-
// wait till all promises are settled
|
|
217
|
-
const results = await Promise.allSettled(promises);
|
|
218
|
-
|
|
219
|
-
// unsubscribe from unused states
|
|
220
|
-
for (let i = this.subscribed.length - 1; i >= 0; i--) {
|
|
221
|
-
const id = this.subscribed[i];
|
|
222
|
-
if (!newSubscribed.includes(id)) {
|
|
223
|
-
this.log.silly(`unsubscribing from updates of ${id}`);
|
|
224
|
-
this.subscribed.splice(i, 1);
|
|
225
|
-
await AdapterProvider.unsubscribe(id);
|
|
226
|
-
}
|
|
227
|
-
}
|
|
228
|
-
|
|
229
|
-
// @ts-ignore
|
|
230
|
-
const failedReasons = results.filter(item => item.status !== 'fulfilled').flatMap(item => item.reason);
|
|
231
|
-
if (failedReasons.length) {
|
|
232
|
-
this.log.debug(`failed to subscribe for updates of ${failedReasons.length} states`);
|
|
233
|
-
try {
|
|
234
|
-
for (const reason of failedReasons) {
|
|
235
|
-
this.log.silly(
|
|
236
|
-
`failed subscribing: ${typeof reason === 'string' ? reason : JSON.stringify(reason)}`,
|
|
237
|
-
);
|
|
238
|
-
}
|
|
239
|
-
} catch {
|
|
240
|
-
// nop
|
|
241
|
-
}
|
|
242
|
-
}
|
|
243
|
-
} catch (e) {
|
|
244
|
-
this.log.error(`failed to collect devices: ${e}`);
|
|
245
|
-
}
|
|
246
|
-
|
|
247
|
-
this.collecting = false;
|
|
248
|
-
|
|
249
|
-
// if during the collection a new collection was triggered, start collecting again
|
|
250
|
-
if (this.recollect) {
|
|
251
|
-
this.recollect = false;
|
|
252
|
-
setTimeout(() => this.collectEndpoints(), 1000);
|
|
253
|
-
}
|
|
254
|
-
}
|
|
255
|
-
|
|
256
|
-
async destroy() {
|
|
257
|
-
const promises = [];
|
|
258
|
-
for (const id of this.subscribed) {
|
|
259
|
-
this.log.silly(`unsubscribing from updates of ${id}`);
|
|
260
|
-
promises.push(AdapterProvider.subscribe(id));
|
|
261
|
-
}
|
|
262
|
-
await Promise.allSettled(promises);
|
|
263
|
-
|
|
264
|
-
this.subscribed = [];
|
|
265
|
-
}
|
|
266
|
-
|
|
267
|
-
publishStateChange(stateChange) {
|
|
268
|
-
if (this.eventsPausedTill < Date.now()) {
|
|
269
|
-
this.log.silly(`publishing ${JSON.stringify(stateChange)}`);
|
|
270
|
-
IotProxy.publishStateChange(stateChange);
|
|
271
|
-
}
|
|
272
|
-
}
|
|
273
|
-
|
|
274
|
-
pauseEvents() {
|
|
275
|
-
this.eventsPausedTill = Date.now() + 30 * 60 * 1000; // 30 minutes
|
|
276
|
-
}
|
|
277
|
-
|
|
278
|
-
/**
|
|
279
|
-
* @param {string} endpointId
|
|
280
|
-
* @param {{ (): Promise<any>; }} awaitable
|
|
281
|
-
* @param {AlexaResponse} errorResponse
|
|
282
|
-
*/
|
|
283
|
-
async executeWithinRateLimits(endpointId, awaitable, errorResponse) {
|
|
284
|
-
try {
|
|
285
|
-
await RateLimiter.incrementAndGet(endpointId);
|
|
286
|
-
return await awaitable();
|
|
287
|
-
} catch (error) {
|
|
288
|
-
if (error instanceof OverallDailyRateLimitExceeded || error instanceof HourlyDeviceRateLimitExceeded) {
|
|
289
|
-
this.log.warn(error.message);
|
|
290
|
-
} else {
|
|
291
|
-
this.log.error(error.message);
|
|
292
|
-
}
|
|
293
|
-
|
|
294
|
-
return errorResponse;
|
|
295
|
-
}
|
|
296
|
-
}
|
|
297
|
-
|
|
298
|
-
async handleAlexaEvent(event) {
|
|
299
|
-
this.log.debug(`incoming Alexa event`);
|
|
300
|
-
this.log.silly(`${JSON.stringify(event)}`);
|
|
301
|
-
let response;
|
|
302
|
-
let directive = this.matchDirective(event);
|
|
303
|
-
if (directive) {
|
|
304
|
-
response = await directive.handle(event, this);
|
|
305
|
-
} else {
|
|
306
|
-
const endpointId = event?.directive?.endpoint?.endpointId;
|
|
307
|
-
let device = this.endpointById(endpointId);
|
|
308
|
-
|
|
309
|
-
if (device) {
|
|
310
|
-
if (device.supports(event)) {
|
|
311
|
-
response = await this.executeWithinRateLimits(
|
|
312
|
-
endpointId,
|
|
313
|
-
async () => {
|
|
314
|
-
response = await device.handle(event);
|
|
315
|
-
if (!AlexaResponse.isErrorResponse(response)) {
|
|
316
|
-
// report state change via voice interaction
|
|
317
|
-
const propertyName = response.context.properties[0].name;
|
|
318
|
-
const event = Directives.ChangeReport.get(device.id, propertyName, false);
|
|
319
|
-
const directive = this.matchDirective(event);
|
|
320
|
-
if (directive) {
|
|
321
|
-
const stateChange = await directive.handle(event, this);
|
|
322
|
-
// get device state (not just one control)
|
|
323
|
-
const deviceState = await device.reportState();
|
|
324
|
-
if (JSON.stringify(device.lastReportedState) !== JSON.stringify(deviceState)) {
|
|
325
|
-
device.lastReportedState = deviceState;
|
|
326
|
-
// fire state change report to Alexa
|
|
327
|
-
// BF[2024.02.04]: temporarily disabled as produced a huge number of events
|
|
328
|
-
// this.publishStateChange(stateChange);
|
|
329
|
-
this.informAboutStatesChange();
|
|
330
|
-
} else {
|
|
331
|
-
this.log.debug(
|
|
332
|
-
`ignoring state change event for ${endpointId} due to the same_ value [${JSON.stringify(deviceState)}]`,
|
|
333
|
-
);
|
|
334
|
-
}
|
|
335
|
-
}
|
|
336
|
-
}
|
|
337
|
-
return response;
|
|
338
|
-
},
|
|
339
|
-
AlexaResponse.endpointUnreachable().get(),
|
|
340
|
-
);
|
|
341
|
-
} else {
|
|
342
|
-
response = AlexaResponse.directiveNotSupportedByDevice(
|
|
343
|
-
device.friendlyName,
|
|
344
|
-
event?.directive?.header?.namespace,
|
|
345
|
-
event?.directive?.header?.payloadVersion,
|
|
346
|
-
).get();
|
|
347
|
-
}
|
|
348
|
-
} else {
|
|
349
|
-
response = AlexaResponse.endpointUnreachable().get();
|
|
350
|
-
}
|
|
351
|
-
}
|
|
352
|
-
|
|
353
|
-
this.log.silly(`response: ${JSON.stringify(response)}`);
|
|
354
|
-
return response;
|
|
355
|
-
}
|
|
356
|
-
|
|
357
|
-
async handleStateUpdate(id, state) {
|
|
358
|
-
// ignore updates not confirmed by a corresponding device
|
|
359
|
-
if (!state.ack) {
|
|
360
|
-
this.log.silly(`ignoring state change event for ${id} due to state.ack == ${state.ack}`);
|
|
361
|
-
return;
|
|
362
|
-
}
|
|
363
|
-
|
|
364
|
-
let notFound = true;
|
|
365
|
-
|
|
366
|
-
for (const device of this.devices) {
|
|
367
|
-
const property = device.controls
|
|
368
|
-
.flatMap(item => item.supported)
|
|
369
|
-
.flatMap(item => item.properties)
|
|
370
|
-
.find(item => item.getId === id);
|
|
371
|
-
|
|
372
|
-
if (property) {
|
|
373
|
-
notFound = false;
|
|
374
|
-
if (property.currentValue === state.val) {
|
|
375
|
-
this.log.debug(`ignoring state change event for ${id} due to the same value [${state.val}]`);
|
|
376
|
-
} else {
|
|
377
|
-
property.currentValue = state.val;
|
|
378
|
-
|
|
379
|
-
const event = Directives.ChangeReport.get(device.id, property.propertyName, true);
|
|
380
|
-
const directive = this.matchDirective(event);
|
|
381
|
-
if (directive) {
|
|
382
|
-
const stateChange = await directive.handle(event, this);
|
|
383
|
-
|
|
384
|
-
// get device state (not just one control)
|
|
385
|
-
const deviceState = await device.reportState();
|
|
386
|
-
|
|
387
|
-
if (JSON.stringify(device.lastReportedState) !== JSON.stringify(deviceState)) {
|
|
388
|
-
device.lastReportedState = deviceState;
|
|
389
|
-
this.informAboutStatesChange();
|
|
390
|
-
// fire state change report to Alexa
|
|
391
|
-
|
|
392
|
-
// BF[2024.02.04]: temporarily disabled as produced a huge number of events
|
|
393
|
-
// await this.executeWithinRateLimits(device.id, async () =>
|
|
394
|
-
// this.publishStateChange(stateChange), undefined);
|
|
395
|
-
} else {
|
|
396
|
-
this.log.debug(
|
|
397
|
-
`ignoring state change event for ${id} due to the same_ value [${JSON.stringify(deviceState)}]`,
|
|
398
|
-
);
|
|
399
|
-
}
|
|
400
|
-
}
|
|
401
|
-
}
|
|
402
|
-
|
|
403
|
-
// should be the only device having the id => stop processing here
|
|
404
|
-
break;
|
|
405
|
-
}
|
|
406
|
-
}
|
|
407
|
-
|
|
408
|
-
// this should never happen
|
|
409
|
-
if (notFound) {
|
|
410
|
-
this.log.debug(`state id ${id} doesn't belong to any device`);
|
|
411
|
-
}
|
|
412
|
-
}
|
|
413
|
-
}
|
|
414
|
-
|
|
415
|
-
module.exports = DeviceManager;
|
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
const fs = require('fs');
|
|
2
|
-
const path = require('path');
|
|
3
|
-
const utils = require('@iobroker/adapter-core');
|
|
4
|
-
const AdapterProvider = require('./AdapterProvider');
|
|
5
|
-
|
|
6
|
-
class FileHelper {
|
|
7
|
-
/**
|
|
8
|
-
* @type {string}
|
|
9
|
-
*/
|
|
10
|
-
static _rootFolder;
|
|
11
|
-
static get rootFolder() {
|
|
12
|
-
if (!this._rootFolder) {
|
|
13
|
-
this._rootFolder = utils.getAbsoluteInstanceDataDir(AdapterProvider.get());
|
|
14
|
-
}
|
|
15
|
-
return this._rootFolder;
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
static async createFolder(folderPath) {
|
|
19
|
-
return new Promise((resolve, reject) => {
|
|
20
|
-
fs.access(folderPath, (error) => {
|
|
21
|
-
if (error) {
|
|
22
|
-
// If the directory does not exist, then create it
|
|
23
|
-
fs.mkdir(folderPath, { recursive: true }, (error) => {
|
|
24
|
-
if (error) {
|
|
25
|
-
reject(error);
|
|
26
|
-
} else {
|
|
27
|
-
resolve(0);
|
|
28
|
-
}
|
|
29
|
-
});
|
|
30
|
-
} else {
|
|
31
|
-
resolve(0);
|
|
32
|
-
}
|
|
33
|
-
});
|
|
34
|
-
})
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
/**
|
|
38
|
-
* @param {string} relativePath
|
|
39
|
-
*/
|
|
40
|
-
static absolutePath(relativePath) {
|
|
41
|
-
return path.join(this.rootFolder, relativePath);
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
/**
|
|
45
|
-
* @param {fs.PathLike} fileName
|
|
46
|
-
*/
|
|
47
|
-
static exists(fileName) {
|
|
48
|
-
return fs.existsSync(fileName);
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
/**
|
|
52
|
-
* @param {string} fileName
|
|
53
|
-
*/
|
|
54
|
-
static async read(fileName) {
|
|
55
|
-
return fs.promises.readFile(fileName, 'utf-8');
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
/**
|
|
59
|
-
* @param {string} fileName
|
|
60
|
-
* @param {string | Object} content
|
|
61
|
-
*/
|
|
62
|
-
static async write(fileName, content) {
|
|
63
|
-
if (typeof content !== 'string') {
|
|
64
|
-
content = JSON.stringify(content);
|
|
65
|
-
}
|
|
66
|
-
return fs.promises.writeFile(fileName, content);
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
module.exports = FileHelper;
|