iobroker.iot 4.0.1 → 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 +1 -1
- package/admin/assets/index-5zouxn2w.js +680 -0
- package/admin/index_m.html +1 -1
- package/admin/rules/assets/{ActionVisu-DE8dgNVF.js → ActionVisu-D9x2f6zu.js} +1 -1
- package/admin/rules/assets/{ActionVisu__loadShare__react__loadShare__-BKaC-p5K.js → ActionVisu__loadShare__react__loadShare__-Cg21Ef1U.js} +1 -1
- package/admin/rules/assets/{ActionVisu__loadShare__react_mf_2_dom__loadShare__-Bs1o8DtQ.js → ActionVisu__loadShare__react_mf_2_dom__loadShare__-B1zRWn0u.js} +2 -2
- package/admin/rules/assets/ActionVisu__mf_v__runtimeInit__mf_v__-Cz053nO7.js +10 -0
- package/admin/rules/assets/bootstrap-BCFKIiwZ.js +1 -0
- package/admin/rules/assets/hostInit-hos3Txsy.js +1 -1
- package/admin/rules/assets/{index-DjPMvPni.js → index-CAAeiKCc.js} +2 -2
- package/admin/rules/assets/{index-CbxmbJvB.js → index-Duo7mFlZ.js} +2 -2
- package/admin/rules/assets/index-DwYdaT5M.js +1151 -0
- package/admin/rules/assets/{virtualExposes-BNZJTatg.js → virtualExposes-BqVak7rX.js} +2 -2
- package/admin/rules/customRuleBlocks.js +2 -2
- package/build-backend/lib/AlexaSmartHomeV3/Alexa/AlexaResponse.js +268 -0
- package/build-backend/lib/AlexaSmartHomeV3/Alexa/AlexaResponse.js.map +1 -0
- package/build-backend/lib/AlexaSmartHomeV3/Alexa/Capabilities/Base.js +110 -0
- 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/build-backend/lib/AlexaSmartHomeV3/Alexa/Capabilities/ModeController.js +68 -0
- 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/build-backend/lib/AlexaSmartHomeV3/Alexa/Directives/ChangeReport.js +82 -0
- 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/build-backend/lib/AlexaSmartHomeV3/Alexa/Directives/ReportState.js +47 -0
- 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/build-backend/lib/AlexaSmartHomeV3/Alexa/Properties/ColorTemperatureInKelvin.js +53 -0
- 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/build-backend/lib/AlexaSmartHomeV3/Alexa/Properties/LockState.js +37 -0
- 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/build-backend/lib/AlexaSmartHomeV3/Alexa/Properties/PowerState.js +25 -0
- 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/build-backend/lib/AlexaSmartHomeV3/Controls/Control.js +321 -0
- 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/build-backend/lib/AlexaSmartHomeV3/Controls/Light.js +47 -0
- 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/build-backend/lib/AlexaSmartHomeV3/Device.js +83 -0
- 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/build-backend/lib/AlexaSmartHomeV3/Helpers/AdapterProvider.js +37 -0
- 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/build-backend/lib/AlexaSmartHomeV3/Helpers/IotProxy.js +27 -0
- 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/build-backend/lib/alexaSmartHomeV2.js +2788 -0
- package/build-backend/lib/alexaSmartHomeV3.js +97 -0
- package/build-backend/lib/alexaSmartHomeV3.js.map +1 -0
- package/build-backend/lib/alisa.js +2409 -0
- package/build-backend/lib/devices.js +23 -0
- package/build-backend/lib/devices.js.map +1 -0
- package/build-backend/lib/functions.js +24 -0
- package/build-backend/lib/functions.js.map +1 -0
- package/build-backend/lib/googleHome.js +3322 -0
- package/build-backend/lib/notifications.js +30 -0
- package/build-backend/lib/notifications.js.map +1 -0
- package/build-backend/lib/remote.js +1342 -0
- package/build-backend/lib/remote.js.map +1 -0
- package/build-backend/lib/rooms.js +48 -0
- package/build-backend/lib/rooms.js.map +1 -0
- package/build-backend/lib/texts.js +81 -0
- 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/build-backend/lib/visuApp.js +147 -0
- 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 +2 -2
- package/package.json +2 -2
- package/admin/assets/index-Y479CE6x.js +0 -681
- package/admin/rules/assets/ActionVisu__mf_v__runtimeInit__mf_v__-DtUoI3FU.js +0 -5
- package/admin/rules/assets/bootstrap-Ba57tu25.js +0 -1
- package/admin/rules/assets/index-_Y2FN5EZ.js +0 -1152
|
@@ -0,0 +1,97 @@
|
|
|
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 DeviceManager_1 = __importDefault(require("./AlexaSmartHomeV3/DeviceManager"));
|
|
7
|
+
const AdapterProvider_1 = __importDefault(require("./AlexaSmartHomeV3/Helpers/AdapterProvider"));
|
|
8
|
+
const IotProxy_1 = __importDefault(require("./AlexaSmartHomeV3/Helpers/IotProxy"));
|
|
9
|
+
const RateLimiter_1 = __importDefault(require("./AlexaSmartHomeV3/Helpers/RateLimiter"));
|
|
10
|
+
class AlexaSH3 {
|
|
11
|
+
deviceManager;
|
|
12
|
+
constructor(options) {
|
|
13
|
+
this.deviceManager = new DeviceManager_1.default();
|
|
14
|
+
AdapterProvider_1.default.init(options.adapter);
|
|
15
|
+
IotProxy_1.default.init(options.iotDevice, options.iotClientId, options.adapter.config.login);
|
|
16
|
+
RateLimiter_1.default.init().catch((err) => options.adapter.log.error(err.message));
|
|
17
|
+
// Subscribe on enum changes
|
|
18
|
+
options.adapter.subscribeForeignObjects('enum.functions.*');
|
|
19
|
+
options.adapter.subscribeForeignObjects('enum.rooms.*');
|
|
20
|
+
}
|
|
21
|
+
setLanguage(lang) {
|
|
22
|
+
this.deviceManager.language = lang;
|
|
23
|
+
}
|
|
24
|
+
async process(event) {
|
|
25
|
+
return await this.deviceManager.handleAlexaEvent(event);
|
|
26
|
+
}
|
|
27
|
+
async updateDevices() {
|
|
28
|
+
await this.deviceManager.collectEndpoints();
|
|
29
|
+
}
|
|
30
|
+
async getDevices() {
|
|
31
|
+
const endpoints = this.deviceManager ? this.deviceManager.endpoints : [];
|
|
32
|
+
const result = [];
|
|
33
|
+
for (let p = 0; p < endpoints.length; p++) {
|
|
34
|
+
const endpoint = endpoints[p];
|
|
35
|
+
const controls = [];
|
|
36
|
+
for (let c = 0; c < endpoint.controls.length; c++) {
|
|
37
|
+
const control = endpoint.controls[c];
|
|
38
|
+
let supported = [];
|
|
39
|
+
let enforced = [];
|
|
40
|
+
control._supported.forEach(item => item._properties.forEach(prop => !supported.includes(prop.constructor.name) && supported.push(prop.constructor.name)));
|
|
41
|
+
control._enforced.forEach(item => item._properties.forEach(prop => !enforced.includes(prop.constructor.name) && enforced.push(prop.constructor.name)));
|
|
42
|
+
supported = supported.map(prop => prop.replace(/^[A-Z]/, c => c.toLowerCase())).sort();
|
|
43
|
+
enforced = enforced.map(prop => prop.replace(/^[A-Z]/, c => c.toLowerCase())).sort();
|
|
44
|
+
controls.push({
|
|
45
|
+
type: control.log._component,
|
|
46
|
+
states: control._states,
|
|
47
|
+
// always sort by id, so the GUI can address the group by the first control
|
|
48
|
+
supported,
|
|
49
|
+
// always sort by id, so the GUI can address the group by the first control
|
|
50
|
+
enforced,
|
|
51
|
+
state: await control.reportState(),
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
// always sort by id, so the GUI can address the group by the first control
|
|
55
|
+
controls.sort((c1, c2) => (c1.type > c2.type ? -1 : c1.type < c2.type ? 1 : 0));
|
|
56
|
+
const device = {
|
|
57
|
+
controls,
|
|
58
|
+
friendlyName: endpoint.friendlyName,
|
|
59
|
+
autoDetected: endpoint.autoDetected,
|
|
60
|
+
funcName: endpoint.funcName,
|
|
61
|
+
roomName: endpoint.roomName,
|
|
62
|
+
id: endpoint.id,
|
|
63
|
+
type: endpoint.log._component,
|
|
64
|
+
state: await endpoint.reportState(),
|
|
65
|
+
};
|
|
66
|
+
result.push(device);
|
|
67
|
+
}
|
|
68
|
+
return result;
|
|
69
|
+
}
|
|
70
|
+
async handleStateUpdate(id, state) {
|
|
71
|
+
await this.deviceManager.handleStateUpdate(id, state);
|
|
72
|
+
}
|
|
73
|
+
async handleObjectChange(id, obj) {
|
|
74
|
+
// Handle enum changes
|
|
75
|
+
if (obj) {
|
|
76
|
+
// An object was changed
|
|
77
|
+
// console.log(`object ${id} changed: ${JSON.stringify(obj)}`);
|
|
78
|
+
}
|
|
79
|
+
else {
|
|
80
|
+
// An object was deleted
|
|
81
|
+
// console.log(`object ${id} deleted`);
|
|
82
|
+
}
|
|
83
|
+
// either an enum was deleted or changed => re-collect devices
|
|
84
|
+
// intentionally not waiting for the promise to resolve
|
|
85
|
+
await this.deviceManager.collectEndpoints();
|
|
86
|
+
}
|
|
87
|
+
pauseEvents() {
|
|
88
|
+
this.deviceManager.pauseEvents();
|
|
89
|
+
}
|
|
90
|
+
async destroy() {
|
|
91
|
+
await this.deviceManager.destroy();
|
|
92
|
+
await AdapterProvider_1.default.get().unsubscribeForeignObjectsAsync('enum.functions.*');
|
|
93
|
+
await AdapterProvider_1.default.get().unsubscribeForeignObjectsAsync('enum.rooms.*');
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
exports.default = AlexaSH3;
|
|
97
|
+
//# sourceMappingURL=alexaSmartHomeV3.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"alexaSmartHomeV3.js","sourceRoot":"","sources":["../../src/lib/alexaSmartHomeV3.ts"],"names":[],"mappings":";;;;;AAAA,qFAA6D;AAC7D,iGAAyE;AACzE,mFAA2D;AAC3D,yFAAiE;AAMjE,MAAqB,QAAQ;IACR,aAAa,CAAgB;IAE9C,YAAY,OAA8E;QACtF,IAAI,CAAC,aAAa,GAAG,IAAI,uBAAa,EAAE,CAAC;QACzC,yBAAe,CAAC,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;QACtC,kBAAQ,CAAC,IAAI,CAAC,OAAO,CAAC,SAAS,EAAE,OAAO,CAAC,WAAW,EAAE,OAAO,CAAC,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,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,EAAE,CAAC;IACrC,CAAC;IAED,KAAK,CAAC,OAAO;QACT,MAAM,IAAI,CAAC,aAAa,CAAC,OAAO,EAAE,CAAC;QACnC,MAAM,yBAAe,CAAC,GAAG,EAAE,CAAC,8BAA8B,CAAC,kBAAkB,CAAC,CAAC;QAC/E,MAAM,yBAAe,CAAC,GAAG,EAAE,CAAC,8BAA8B,CAAC,cAAc,CAAC,CAAC;IAC/E,CAAC;CACJ;AA/GD,2BA+GC","sourcesContent":["import DeviceManager from './AlexaSmartHomeV3/DeviceManager';\nimport AdapterProvider from './AlexaSmartHomeV3/Helpers/AdapterProvider';\nimport IotProxy from './AlexaSmartHomeV3/Helpers/IotProxy';\nimport RateLimiter from './AlexaSmartHomeV3/Helpers/RateLimiter';\nimport type { device as DeviceModule } from 'aws-iot-device-sdk';\nimport type { AlexaSH3ControlDescription, AlexaSH3DeviceDescription, AlexaV3Request } from './AlexaSmartHomeV3/types';\nimport type AlexaResponse from './AlexaSmartHomeV3/Alexa/AlexaResponse';\nimport type { IotAdapter } from '../main';\n\nexport default class AlexaSH3 {\n private readonly deviceManager: DeviceManager;\n\n constructor(options: { adapter: IotAdapter; iotDevice: DeviceModule; iotClientId: string }) {\n this.deviceManager = new DeviceManager();\n AdapterProvider.init(options.adapter);\n IotProxy.init(options.iotDevice, options.iotClientId, options.adapter.config.login);\n RateLimiter.init().catch((err: Error) => options.adapter.log.error(err.message));\n // Subscribe on enum changes\n options.adapter.subscribeForeignObjects('enum.functions.*');\n options.adapter.subscribeForeignObjects('enum.rooms.*');\n }\n\n setLanguage(lang: ioBroker.Languages): void {\n this.deviceManager.language = lang;\n }\n\n async process(event: AlexaV3Request): Promise<AlexaResponse> {\n return await this.deviceManager.handleAlexaEvent(event);\n }\n\n async updateDevices(): Promise<void> {\n await this.deviceManager.collectEndpoints();\n }\n\n async getDevices(): Promise<AlexaSH3DeviceDescription[]> {\n const endpoints = this.deviceManager ? this.deviceManager.endpoints : [];\n\n const result: AlexaSH3DeviceDescription[] = [];\n\n for (let p = 0; p < endpoints.length; p++) {\n const endpoint = endpoints[p];\n const controls: AlexaSH3ControlDescription[] = [];\n\n for (let c = 0; c < endpoint.controls.length; c++) {\n const control = endpoint.controls[c];\n let supported: string[] = [];\n let enforced: string[] = [];\n control._supported.forEach(item =>\n item._properties.forEach(\n prop => !supported.includes(prop.constructor.name) && supported.push(prop.constructor.name),\n ),\n );\n control._enforced.forEach(item =>\n item._properties.forEach(\n prop => !enforced.includes(prop.constructor.name) && enforced.push(prop.constructor.name),\n ),\n );\n\n supported = supported.map(prop => prop.replace(/^[A-Z]/, c => c.toLowerCase())).sort();\n\n enforced = enforced.map(prop => prop.replace(/^[A-Z]/, c => c.toLowerCase())).sort();\n\n controls.push({\n type: control.log._component,\n states: control._states,\n // always sort by id, so the GUI can address the group by the first control\n supported,\n // always sort by id, so the GUI can address the group by the first control\n enforced,\n state: await control.reportState(),\n });\n }\n // always sort by id, so the GUI can address the group by the first control\n controls.sort((c1, c2) => (c1.type > c2.type ? -1 : c1.type < c2.type ? 1 : 0));\n\n const device: AlexaSH3DeviceDescription = {\n controls,\n friendlyName: endpoint.friendlyName,\n autoDetected: endpoint.autoDetected,\n funcName: endpoint.funcName,\n roomName: endpoint.roomName,\n id: endpoint.id,\n type: endpoint.log._component,\n state: await endpoint.reportState(),\n };\n result.push(device);\n }\n\n return result;\n }\n\n async handleStateUpdate(id: string, state: ioBroker.State | null | undefined): Promise<void> {\n await this.deviceManager.handleStateUpdate(id, state);\n }\n\n async handleObjectChange(id: string, obj: ioBroker.Object | null | undefined): Promise<void> {\n // Handle enum changes\n if (obj) {\n // An object was changed\n // console.log(`object ${id} changed: ${JSON.stringify(obj)}`);\n } else {\n // An object was deleted\n // console.log(`object ${id} deleted`);\n }\n\n // either an enum was deleted or changed => re-collect devices\n\n // intentionally not waiting for the promise to resolve\n await this.deviceManager.collectEndpoints();\n }\n\n pauseEvents(): void {\n this.deviceManager.pauseEvents();\n }\n\n async destroy(): Promise<void> {\n await this.deviceManager.destroy();\n await AdapterProvider.get().unsubscribeForeignObjectsAsync('enum.functions.*');\n await AdapterProvider.get().unsubscribeForeignObjectsAsync('enum.rooms.*');\n }\n}\n"]}
|