iobroker.iot 3.5.2 → 4.0.1

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.
Files changed (111) hide show
  1. package/README.md +24 -9
  2. package/admin/assets/index-Y479CE6x.js +681 -0
  3. package/admin/index_m.html +1 -1
  4. package/admin/rules/assets/{ActionVisu-D9x2f6zu.js → ActionVisu-DE8dgNVF.js} +1 -1
  5. package/admin/rules/assets/{ActionVisu__loadShare__react__loadShare__-Cg21Ef1U.js → ActionVisu__loadShare__react__loadShare__-BKaC-p5K.js} +1 -1
  6. package/admin/rules/assets/{ActionVisu__loadShare__react_mf_2_dom__loadShare__-B1zRWn0u.js → ActionVisu__loadShare__react_mf_2_dom__loadShare__-Bs1o8DtQ.js} +2 -2
  7. package/admin/rules/assets/ActionVisu__mf_v__runtimeInit__mf_v__-DtUoI3FU.js +5 -0
  8. package/admin/rules/assets/bootstrap-Ba57tu25.js +1 -0
  9. package/admin/rules/assets/hostInit-hos3Txsy.js +1 -1
  10. package/admin/rules/assets/{index-Duo7mFlZ.js → index-CbxmbJvB.js} +2 -2
  11. package/admin/rules/assets/{index-CAAeiKCc.js → index-DjPMvPni.js} +2 -2
  12. package/admin/rules/assets/index-_Y2FN5EZ.js +1152 -0
  13. package/admin/rules/assets/{virtualExposes-BqVak7rX.js → virtualExposes-BNZJTatg.js} +2 -2
  14. package/admin/rules/customRuleBlocks.js +2 -2
  15. package/io-package.json +27 -27
  16. package/package.json +17 -14
  17. package/admin/assets/index-Df2NS929.js +0 -681
  18. package/admin/rules/assets/ActionVisu__mf_v__runtimeInit__mf_v__-Cz053nO7.js +0 -10
  19. package/admin/rules/assets/bootstrap-BCFKIiwZ.js +0 -1
  20. package/admin/rules/assets/index-BwcOGyWI.js +0 -1152
  21. package/lib/AlexaSmartHomeV3/Alexa/AlexaResponse.js +0 -262
  22. package/lib/AlexaSmartHomeV3/Alexa/Capabilities/Base.js +0 -124
  23. package/lib/AlexaSmartHomeV3/Alexa/Capabilities/BrightnessController.js +0 -15
  24. package/lib/AlexaSmartHomeV3/Alexa/Capabilities/ColorController.js +0 -10
  25. package/lib/AlexaSmartHomeV3/Alexa/Capabilities/ColorTemperatureController.js +0 -15
  26. package/lib/AlexaSmartHomeV3/Alexa/Capabilities/ContactSensor.js +0 -10
  27. package/lib/AlexaSmartHomeV3/Alexa/Capabilities/LockController.js +0 -10
  28. package/lib/AlexaSmartHomeV3/Alexa/Capabilities/ModeController.js +0 -69
  29. package/lib/AlexaSmartHomeV3/Alexa/Capabilities/MotionSensor.js +0 -10
  30. package/lib/AlexaSmartHomeV3/Alexa/Capabilities/PercentageController.js +0 -10
  31. package/lib/AlexaSmartHomeV3/Alexa/Capabilities/PowerController.js +0 -15
  32. package/lib/AlexaSmartHomeV3/Alexa/Capabilities/Speaker.js +0 -20
  33. package/lib/AlexaSmartHomeV3/Alexa/Capabilities/TemperatureSensor.js +0 -10
  34. package/lib/AlexaSmartHomeV3/Alexa/Capabilities/ThermostatController.js +0 -34
  35. package/lib/AlexaSmartHomeV3/Alexa/Capabilities/index.js +0 -14
  36. package/lib/AlexaSmartHomeV3/Alexa/Directives/Base.js +0 -27
  37. package/lib/AlexaSmartHomeV3/Alexa/Directives/ChangeReport.js +0 -75
  38. package/lib/AlexaSmartHomeV3/Alexa/Directives/Discovery.js +0 -39
  39. package/lib/AlexaSmartHomeV3/Alexa/Directives/ReportState.js +0 -50
  40. package/lib/AlexaSmartHomeV3/Alexa/Directives/index.js +0 -13
  41. package/lib/AlexaSmartHomeV3/Alexa/ModeValues/Base.js +0 -38
  42. package/lib/AlexaSmartHomeV3/Alexa/ModeValues/Closed.js +0 -55
  43. package/lib/AlexaSmartHomeV3/Alexa/ModeValues/Open.js +0 -56
  44. package/lib/AlexaSmartHomeV3/Alexa/ModeValues/index.js +0 -14
  45. package/lib/AlexaSmartHomeV3/Alexa/Properties/AdjustableProperty.js +0 -11
  46. package/lib/AlexaSmartHomeV3/Alexa/Properties/Base.js +0 -108
  47. package/lib/AlexaSmartHomeV3/Alexa/Properties/Brightness.js +0 -14
  48. package/lib/AlexaSmartHomeV3/Alexa/Properties/Color.js +0 -40
  49. package/lib/AlexaSmartHomeV3/Alexa/Properties/ColorTemperatureInKelvin.js +0 -62
  50. package/lib/AlexaSmartHomeV3/Alexa/Properties/DetectionState.js +0 -22
  51. package/lib/AlexaSmartHomeV3/Alexa/Properties/LockState.js +0 -40
  52. package/lib/AlexaSmartHomeV3/Alexa/Properties/Mode.js +0 -32
  53. package/lib/AlexaSmartHomeV3/Alexa/Properties/Muted.js +0 -17
  54. package/lib/AlexaSmartHomeV3/Alexa/Properties/Percentage.js +0 -14
  55. package/lib/AlexaSmartHomeV3/Alexa/Properties/PowerState.js +0 -25
  56. package/lib/AlexaSmartHomeV3/Alexa/Properties/TargetSetpoint.js +0 -28
  57. package/lib/AlexaSmartHomeV3/Alexa/Properties/Temperature.js +0 -20
  58. package/lib/AlexaSmartHomeV3/Alexa/Properties/ThermostatMode.js +0 -52
  59. package/lib/AlexaSmartHomeV3/Alexa/Properties/Volume.js +0 -19
  60. package/lib/AlexaSmartHomeV3/Alexa/Properties/index.js +0 -14
  61. package/lib/AlexaSmartHomeV3/Controls/AdjustableControl.js +0 -22
  62. package/lib/AlexaSmartHomeV3/Controls/AdjustablePercentageControl.js +0 -28
  63. package/lib/AlexaSmartHomeV3/Controls/AirCondition.js +0 -144
  64. package/lib/AlexaSmartHomeV3/Controls/Blind.js +0 -12
  65. package/lib/AlexaSmartHomeV3/Controls/ContactSensor.js +0 -17
  66. package/lib/AlexaSmartHomeV3/Controls/Control.js +0 -352
  67. package/lib/AlexaSmartHomeV3/Controls/Ct.js +0 -172
  68. package/lib/AlexaSmartHomeV3/Controls/Dimmer.js +0 -124
  69. package/lib/AlexaSmartHomeV3/Controls/Door.js +0 -9
  70. package/lib/AlexaSmartHomeV3/Controls/Gate.js +0 -42
  71. package/lib/AlexaSmartHomeV3/Controls/Hue.js +0 -207
  72. package/lib/AlexaSmartHomeV3/Controls/Light.js +0 -54
  73. package/lib/AlexaSmartHomeV3/Controls/Lock.js +0 -36
  74. package/lib/AlexaSmartHomeV3/Controls/Motion.js +0 -17
  75. package/lib/AlexaSmartHomeV3/Controls/ReadOnlyDetector.js +0 -25
  76. package/lib/AlexaSmartHomeV3/Controls/Slider.js +0 -10
  77. package/lib/AlexaSmartHomeV3/Controls/Socket.js +0 -21
  78. package/lib/AlexaSmartHomeV3/Controls/Temperature.js +0 -22
  79. package/lib/AlexaSmartHomeV3/Controls/Thermostat.js +0 -86
  80. package/lib/AlexaSmartHomeV3/Controls/VacuumCleaner.js +0 -28
  81. package/lib/AlexaSmartHomeV3/Controls/Volume.js +0 -109
  82. package/lib/AlexaSmartHomeV3/Controls/VolumeGroup.js +0 -9
  83. package/lib/AlexaSmartHomeV3/Controls/Window.js +0 -9
  84. package/lib/AlexaSmartHomeV3/Controls/index.js +0 -14
  85. package/lib/AlexaSmartHomeV3/Device.js +0 -84
  86. package/lib/AlexaSmartHomeV3/DeviceManager.js +0 -415
  87. package/lib/AlexaSmartHomeV3/Exceptions/AlexaV3Exception.js +0 -8
  88. package/lib/AlexaSmartHomeV3/Exceptions/HourlyDeviceRateLimitExceeded.js +0 -5
  89. package/lib/AlexaSmartHomeV3/Exceptions/OverallDailyRateLimitExceeded.js +0 -5
  90. package/lib/AlexaSmartHomeV3/Helpers/AdapterProvider.js +0 -46
  91. package/lib/AlexaSmartHomeV3/Helpers/FileHelper.js +0 -70
  92. package/lib/AlexaSmartHomeV3/Helpers/IotProxy.js +0 -44
  93. package/lib/AlexaSmartHomeV3/Helpers/Logger.js +0 -95
  94. package/lib/AlexaSmartHomeV3/Helpers/RateLimiter.js +0 -82
  95. package/lib/AlexaSmartHomeV3/Helpers/Utils.js +0 -583
  96. package/lib/Utils.js +0 -608
  97. package/lib/adminCommonSocket.js +0 -781
  98. package/lib/alexaCustom.js +0 -622
  99. package/lib/alexaSmartHomeV2.js +0 -2792
  100. package/lib/alexaSmartHomeV3.js +0 -117
  101. package/lib/alisa.js +0 -2412
  102. package/lib/devices.js +0 -20
  103. package/lib/functions.js +0 -21
  104. package/lib/googleHome.js +0 -3323
  105. package/lib/notifications.js +0 -37
  106. package/lib/remote.js +0 -1363
  107. package/lib/rooms.js +0 -45
  108. package/lib/texts.js +0 -79
  109. package/lib/translate.js +0 -19
  110. package/lib/visuApp.js +0 -157
  111. package/main.js +0 -1444
@@ -1,44 +0,0 @@
1
- class IotProxy {
2
- /**
3
- * @type {Object}
4
- */
5
- static device;
6
- /**
7
- * @type {string}
8
- */
9
- static stateChangedTopic;
10
-
11
- /**
12
- * @param {Object} device
13
- * @param {string} clientId
14
- * @param {string} login
15
- */
16
- static init(device, clientId, login) {
17
- IotProxy.device = device;
18
- IotProxy.stateChangedTopic = `response/${clientId}/changeReport`;
19
- this.login = login;
20
- }
21
-
22
- /**
23
- * @param {Object} stateChange
24
- */
25
- static publishStateChange(stateChange) {
26
- // replace INVALID token with the client id
27
- stateChange.event.endpoint.scope.token = this.login;
28
- return IotProxy.publish(IotProxy.stateChangedTopic, stateChange);
29
- }
30
-
31
- /**
32
- * @param {string} topic
33
- * @param {string} message
34
- */
35
- static publish(topic, message) {
36
- if (typeof message !== 'string') {
37
- message = JSON.stringify(message);
38
- }
39
- setTimeout(() =>
40
- IotProxy.device?.publish(topic, message, { qos: 0 }, (error, result) => { }), 100);
41
- }
42
- }
43
-
44
- module.exports = IotProxy;
@@ -1,95 +0,0 @@
1
- const AdapterProvider = require("./AdapterProvider");
2
-
3
- class Logger {
4
- constructor(instance) {
5
- this.component = instance.constructor.name;
6
- this.logged = new Map();
7
- this.maxLoggedEntries = 500;
8
- this.ttl = 30;
9
- }
10
-
11
- get component() {
12
- return this._component;
13
- }
14
-
15
- set component(value) {
16
- this._component = value;
17
- }
18
-
19
- hashCode(str) {
20
- let hash = 0;
21
- let i;
22
- let chr;
23
- if (str.length === 0) {
24
- return hash;
25
- }
26
- for (i = 0; i < str.length; i++) {
27
- chr = str.charCodeAt(i);
28
- hash = ((hash << 5) - hash) + chr;
29
- hash |= 0; // Convert to 32bit integer
30
- }
31
- return hash;
32
- }
33
-
34
- toSkip(hash) {
35
- // clear old entries
36
- let keys = Array.from(this.logged.keys());
37
- const now = (new Date()).getTime();
38
- for (const key of keys) {
39
- // @ts-ignore
40
- const expired = ((now - key) / 1000) > this.ttl;
41
- if (expired) {
42
- this.logged.delete(key);
43
- }
44
- }
45
-
46
- keys = Array.from(this.logged.keys());
47
- if (keys.length > this.maxLoggedEntries) {
48
- const toRemove = keys.length - this.maxLoggedEntries;
49
- keys.sort();
50
- for (let i = 0; i < toRemove; i++) {
51
- this.logged.delete(keys[i]);
52
- }
53
- }
54
-
55
- return Array.from(this.logged.values()).includes(hash);
56
- }
57
-
58
- compose(message) {
59
- return `[AlexaV3::${this.component}]: ${message}`;
60
- }
61
-
62
- print(logger, message) {
63
- if (typeof message === 'string' && message.length > 0) {
64
- const hash = this.hashCode(message);
65
- if (this.toSkip(hash)) {
66
- return;
67
- }
68
-
69
- this.logged.set((new Date()).getTime(), hash);
70
- return logger(message);
71
- }
72
- }
73
-
74
- silly(message) {
75
- return this.print(AdapterProvider.get().log.silly, this.compose(message));
76
- }
77
-
78
- debug(message) {
79
- return this.print(AdapterProvider.get().log.debug, this.compose(message));
80
- }
81
-
82
- info(message) {
83
- return this.print(AdapterProvider.get().log.info, this.compose(message));
84
- }
85
-
86
- warn(message) {
87
- return this.print(AdapterProvider.get().log.warn, this.compose(message));
88
- }
89
-
90
- error(message) {
91
- return this.print(AdapterProvider.get().log.error, this.compose(message));
92
- };
93
- }
94
-
95
- module.exports = Logger;
@@ -1,82 +0,0 @@
1
- const path = require('path');
2
- const HourlyDeviceRateLimitExceeded = require('../Exceptions/HourlyDeviceRateLimitExceeded');
3
- const OverallDailyRateLimitExceeded = require('../Exceptions/OverallDailyRateLimitExceeded');
4
- const FileHelper = require('./FileHelper');
5
- const Utils = require('./Utils');
6
-
7
- class RateLimiter {
8
- static MAX_DEVICE_STATE_CHANGES_PER_HOUR = 60;
9
- static MAX_CHANGES_PER_DAY = 1000;
10
- static USAGE_STORAGE_FOLDER = 'usage';
11
- static USAGE_STORAGE_FILE_NAME = 'usage.json';
12
-
13
- static usage = new Map();
14
-
15
- static async init() {
16
- try {
17
- await FileHelper.createFolder(FileHelper.absolutePath(this.USAGE_STORAGE_FOLDER));
18
- const raw = await FileHelper.read(this.storageFileName);
19
- this.usage = new Map(JSON.parse(raw));
20
- } catch (error) {
21
- this.usage = new Map();
22
- }
23
- }
24
-
25
- static get storageFileName() {
26
- return FileHelper.absolutePath(path.join(this.USAGE_STORAGE_FOLDER, this.USAGE_STORAGE_FILE_NAME));
27
- }
28
-
29
- static async store() {
30
- try {
31
- await FileHelper.write(this.storageFileName, JSON.stringify(Array.from(this.usage.entries())));
32
- } catch (error) {
33
- // nop
34
- }
35
- }
36
-
37
- static get(endpointId) {
38
- let item = this.usage.get(endpointId);
39
- if (!item) {
40
- item = {
41
- changeCounter: 0,
42
- timestamp: Utils.currentHour().toISOString()
43
- }
44
- this.usage.set(endpointId, item);
45
- }
46
- return item;
47
- }
48
-
49
- static async incrementAndGet(endpointId) {
50
- let item = this.get(endpointId);
51
-
52
- if (!Utils.isCurrentHour(Utils.parseISOString(item.timestamp))) {
53
- item.changeCounter = 1;
54
- item.timestamp = Utils.currentHour().toISOString();
55
- } else {
56
- item.changeCounter += 1;
57
- }
58
-
59
- this.usage.set(endpointId, item);
60
-
61
- try {
62
- await this.store();
63
- } catch (error) {
64
- // nop
65
- }
66
-
67
- if (item.changeCounter > this.MAX_DEVICE_STATE_CHANGES_PER_HOUR) {
68
- throw new HourlyDeviceRateLimitExceeded(`Hourly state change limit for ${endpointId} exceeded`)
69
- }
70
-
71
- const changesToday = Array.from(this.usage.values()).filter(item => Utils.isToday(Utils.parseISOString(item.timestamp))).reduce((sum, { changeCounter }) => sum + changeCounter, 0);
72
-
73
- if (changesToday > this.MAX_CHANGES_PER_DAY) {
74
- throw new OverallDailyRateLimitExceeded(`Overall daily state change limit exceeded`);
75
- }
76
-
77
- return item;
78
- }
79
-
80
- }
81
-
82
- module.exports = RateLimiter;