hoffmation-base 3.2.0 → 3.2.1-alpha.0

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 (82) hide show
  1. package/lib/action/baseAction.d.ts +1 -0
  2. package/lib/action/baseAction.js +3 -0
  3. package/lib/command/ShutterSetLevelCommand.d.ts +2 -1
  4. package/lib/command/WindowRestoreDesiredPositionCommand.d.ts +2 -1
  5. package/lib/command/WindowSetDesiredPositionCommand.d.ts +2 -1
  6. package/lib/command/WindowSetRolloByWeatherStatusCommand.d.ts +2 -1
  7. package/lib/command/actuatorSetStateCommand.d.ts +2 -1
  8. package/lib/command/actuatorToggleCommand.d.ts +2 -1
  9. package/lib/command/actuatorWriteStateToDeviceCommand.d.ts +2 -1
  10. package/lib/command/baseCommand.d.ts +10 -3
  11. package/lib/command/baseCommand.js +20 -1
  12. package/lib/command/blockAutomaticCommand.d.ts +2 -1
  13. package/lib/command/blockAutomaticLiftBlockCommand.d.ts +2 -1
  14. package/lib/command/blockAutomaticUntilCommand.d.ts +2 -1
  15. package/lib/command/dimmerSetLightCommand.d.ts +2 -2
  16. package/lib/command/floorSetAllShuttersCommand.d.ts +2 -1
  17. package/lib/command/iBaseCommand.d.ts +58 -0
  18. package/lib/command/iBaseCommand.js +2 -0
  19. package/lib/command/index.d.ts +1 -0
  20. package/lib/command/lampSetLightCommand.d.ts +2 -2
  21. package/lib/command/lampSetTimeBasedCommand.d.ts +2 -1
  22. package/lib/command/lampToggleLightCommand.d.ts +2 -2
  23. package/lib/command/ledSetLightCommand.d.ts +2 -2
  24. package/lib/command/lightGroupSwitchTimeConditionalCommand.d.ts +2 -1
  25. package/lib/command/restoreTargetAutomaticValueCommand.d.ts +2 -1
  26. package/lib/command/roomRestoreLightCommand.d.ts +2 -1
  27. package/lib/command/roomRestoreShutterPositionCommand.d.ts +2 -1
  28. package/lib/command/roomSetLightTimeBasedCommand.d.ts +2 -1
  29. package/lib/command/shutterSunriseUpCommand.d.ts +2 -1
  30. package/lib/command/shutterSunsetDownCommand.d.ts +2 -1
  31. package/lib/command/wledSetLightCommand.d.ts +2 -2
  32. package/lib/command/wledSetLightCommand.js +1 -1
  33. package/lib/devices/BaseDevice.d.ts +43 -0
  34. package/lib/devices/BaseDevice.js +92 -0
  35. package/lib/devices/CameraDevice.d.ts +6 -15
  36. package/lib/devices/CameraDevice.js +33 -51
  37. package/lib/devices/IoBrokerBaseDevice.d.ts +6 -34
  38. package/lib/devices/IoBrokerBaseDevice.js +5 -68
  39. package/lib/devices/RoomBaseDevice.d.ts +9 -0
  40. package/lib/devices/RoomBaseDevice.js +21 -0
  41. package/lib/devices/dachs/dachs.d.ts +4 -17
  42. package/lib/devices/dachs/dachs.js +12 -43
  43. package/lib/devices/dachs/dachsTemperatureSensor.d.ts +4 -19
  44. package/lib/devices/dachs/dachsTemperatureSensor.js +11 -37
  45. package/lib/devices/espresense/detectedBluetoothDevice.d.ts +5 -11
  46. package/lib/devices/espresense/detectedBluetoothDevice.js +15 -17
  47. package/lib/devices/espresense/espresenseDevice.d.ts +3 -19
  48. package/lib/devices/espresense/espresenseDevice.js +11 -45
  49. package/lib/devices/govee/own-govee-device.d.ts +5 -18
  50. package/lib/devices/govee/own-govee-device.js +30 -69
  51. package/lib/devices/groups/heatGroup.js +1 -1
  52. package/lib/devices/groups/lightGroup.js +1 -1
  53. package/lib/devices/hmIPDevices/hmIpLampe.js +1 -1
  54. package/lib/devices/hmIPDevices/hmIpRoll.js +2 -2
  55. package/lib/devices/index.d.ts +1 -0
  56. package/lib/devices/index.js +3 -1
  57. package/lib/devices/scene/room-scene.d.ts +2 -23
  58. package/lib/devices/scene/room-scene.js +12 -57
  59. package/lib/devices/sharedFunctions/lampUtils.js +4 -3
  60. package/lib/devices/shelly/shellyActuator.js +1 -1
  61. package/lib/devices/tv/tvDevice.d.ts +4 -16
  62. package/lib/devices/tv/tvDevice.js +12 -36
  63. package/lib/devices/velux/veluxShutter.js +1 -1
  64. package/lib/devices/victron/victron-device.d.ts +2 -15
  65. package/lib/devices/victron/victron-device.js +11 -43
  66. package/lib/devices/wledDevice.js +2 -2
  67. package/lib/devices/zigbee/BaseDevices/ZigbeeActuator.js +1 -1
  68. package/lib/devices/zigbee/BaseDevices/zigbeeShutter.d.ts +0 -3
  69. package/lib/devices/zigbee/BaseDevices/zigbeeShutter.js +4 -11
  70. package/lib/index.d.ts +2 -2
  71. package/lib/index.js +2 -2
  72. package/lib/interfaces/baseDevices/iAcDevice.d.ts +4 -0
  73. package/lib/interfaces/baseDevices/iBaseDevice.d.ts +11 -1
  74. package/lib/services/Sonos/own-sonos-device.d.ts +4 -14
  75. package/lib/services/Sonos/own-sonos-device.js +8 -46
  76. package/lib/services/ac/ac-device.d.ts +6 -22
  77. package/lib/services/ac/ac-device.js +23 -53
  78. package/lib/services/ac/own-daikin-device.js +2 -2
  79. package/lib/tsconfig.tsbuildinfo +1 -1
  80. package/lib/utils/utils.d.ts +2 -1
  81. package/lib/utils/utils.js +15 -2
  82. package/package.json +1 -1
@@ -5,11 +5,12 @@ export declare const DAYMS: number;
5
5
  export declare class Utils {
6
6
  static get timeTilMidnight(): number;
7
7
  static catchEm<T>(promise: Promise<T>): Promise<CatchEmResult<T>>;
8
- static guardedFunction(func: (...args: unknown[]) => void, thisContext: unknown | undefined, additionalErrorMsg?: string): void;
8
+ static guardedFunction<T>(func: (...args: unknown[]) => T, thisContext: unknown | undefined, additionalErrorMsg?: string): T | void;
9
9
  static nowMS(): number;
10
10
  static delay(ms: number): Promise<void>;
11
11
  static guardedNewThread(func: (...args: unknown[]) => void, thisContext?: unknown | undefined): void;
12
12
  static guardedTimeout(func: (...args: unknown[]) => void, time: number, thisContext?: unknown | undefined): NodeJS.Timeout;
13
+ static retryAction(func: (...args: unknown[]) => boolean, thisContext?: unknown | undefined, retriesLeft?: number, intervalBetweenRetries?: number, successCB?: () => void, failureCB?: () => void): void;
13
14
  static guardedInterval(func: (...args: unknown[]) => void, time: number, thisContext?: unknown | undefined, fireImmediate?: boolean): NodeJS.Timeout;
14
15
  static nowString(): string;
15
16
  static guard<T>(object: T | undefined | null): T & {};
@@ -28,10 +28,10 @@ class Utils {
28
28
  static guardedFunction(func, thisContext, additionalErrorMsg) {
29
29
  try {
30
30
  if (thisContext) {
31
- func.bind(thisContext)();
31
+ return func.bind(thisContext)();
32
32
  }
33
33
  else {
34
- func();
34
+ return func();
35
35
  }
36
36
  }
37
37
  catch (e) {
@@ -59,6 +59,19 @@ class Utils {
59
59
  Utils.guardedFunction(func, thisContext);
60
60
  }, time);
61
61
  }
62
+ static retryAction(func, thisContext, retriesLeft = 5, intervalBetweenRetries = 1000, successCB, failureCB) {
63
+ if (Utils.guardedFunction(func, thisContext)) {
64
+ successCB === null || successCB === void 0 ? void 0 : successCB();
65
+ return;
66
+ }
67
+ if (retriesLeft === 0) {
68
+ failureCB === null || failureCB === void 0 ? void 0 : failureCB();
69
+ return;
70
+ }
71
+ Utils.guardedTimeout(() => {
72
+ Utils.retryAction(func, thisContext, retriesLeft - 1, intervalBetweenRetries, successCB, failureCB);
73
+ }, intervalBetweenRetries, thisContext);
74
+ }
62
75
  static guardedInterval(func, time, thisContext, fireImmediate = false) {
63
76
  if (fireImmediate) {
64
77
  Utils.guardedFunction(func, thisContext);
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "hoffmation-base",
3
3
  "description": "Base Libraries and functions for own Hoffmation projects",
4
- "version": "3.2.0",
4
+ "version": "3.2.1-alpha.0",
5
5
  "files": [
6
6
  "lib/**/*"
7
7
  ],