hoffmation-base 3.1.4 → 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.
- package/lib/action/baseAction.d.ts +1 -0
- package/lib/action/baseAction.js +3 -0
- package/lib/command/ShutterSetLevelCommand.d.ts +2 -1
- package/lib/command/WindowRestoreDesiredPositionCommand.d.ts +2 -1
- package/lib/command/WindowSetDesiredPositionCommand.d.ts +2 -1
- package/lib/command/WindowSetRolloByWeatherStatusCommand.d.ts +2 -1
- package/lib/command/actuatorSetStateCommand.d.ts +2 -1
- package/lib/command/actuatorToggleCommand.d.ts +2 -1
- package/lib/command/actuatorWriteStateToDeviceCommand.d.ts +2 -1
- package/lib/command/baseCommand.d.ts +10 -3
- package/lib/command/baseCommand.js +20 -1
- package/lib/command/blockAutomaticCommand.d.ts +2 -1
- package/lib/command/blockAutomaticLiftBlockCommand.d.ts +2 -1
- package/lib/command/blockAutomaticUntilCommand.d.ts +2 -1
- package/lib/command/dimmerSetLightCommand.d.ts +2 -2
- package/lib/command/floorSetAllShuttersCommand.d.ts +2 -1
- package/lib/command/iBaseCommand.d.ts +58 -0
- package/lib/command/iBaseCommand.js +2 -0
- package/lib/command/index.d.ts +1 -0
- package/lib/command/lampSetLightCommand.d.ts +2 -2
- package/lib/command/lampSetTimeBasedCommand.d.ts +2 -1
- package/lib/command/lampToggleLightCommand.d.ts +2 -2
- package/lib/command/ledSetLightCommand.d.ts +2 -2
- package/lib/command/lightGroupSwitchTimeConditionalCommand.d.ts +2 -1
- package/lib/command/restoreTargetAutomaticValueCommand.d.ts +2 -1
- package/lib/command/roomRestoreLightCommand.d.ts +2 -1
- package/lib/command/roomRestoreShutterPositionCommand.d.ts +2 -1
- package/lib/command/roomSetLightTimeBasedCommand.d.ts +2 -1
- package/lib/command/shutterSunriseUpCommand.d.ts +2 -1
- package/lib/command/shutterSunsetDownCommand.d.ts +2 -1
- package/lib/command/wledSetLightCommand.d.ts +2 -2
- package/lib/command/wledSetLightCommand.js +1 -1
- package/lib/devices/BaseDevice.d.ts +43 -0
- package/lib/devices/BaseDevice.js +92 -0
- package/lib/devices/CameraDevice.d.ts +6 -15
- package/lib/devices/CameraDevice.js +33 -51
- package/lib/devices/IoBrokerBaseDevice.d.ts +6 -34
- package/lib/devices/IoBrokerBaseDevice.js +5 -68
- package/lib/devices/RoomBaseDevice.d.ts +9 -0
- package/lib/devices/RoomBaseDevice.js +21 -0
- package/lib/devices/dachs/dachs.d.ts +4 -17
- package/lib/devices/dachs/dachs.js +12 -43
- package/lib/devices/dachs/dachsTemperatureSensor.d.ts +4 -19
- package/lib/devices/dachs/dachsTemperatureSensor.js +11 -37
- package/lib/devices/espresense/detectedBluetoothDevice.d.ts +5 -11
- package/lib/devices/espresense/detectedBluetoothDevice.js +15 -17
- package/lib/devices/espresense/espresenseDevice.d.ts +3 -19
- package/lib/devices/espresense/espresenseDevice.js +11 -45
- package/lib/devices/govee/own-govee-device.d.ts +5 -18
- package/lib/devices/govee/own-govee-device.js +30 -69
- package/lib/devices/groups/heatGroup.js +1 -1
- package/lib/devices/groups/lightGroup.js +1 -1
- package/lib/devices/hmIPDevices/hmIpLampe.js +1 -1
- package/lib/devices/hmIPDevices/hmIpRoll.js +2 -2
- package/lib/devices/index.d.ts +1 -0
- package/lib/devices/index.js +3 -1
- package/lib/devices/scene/room-scene.d.ts +2 -23
- package/lib/devices/scene/room-scene.js +12 -57
- package/lib/devices/sharedFunctions/lampUtils.js +4 -3
- package/lib/devices/shelly/shellyActuator.js +1 -1
- package/lib/devices/tv/tvDevice.d.ts +4 -16
- package/lib/devices/tv/tvDevice.js +12 -36
- package/lib/devices/velux/veluxShutter.js +1 -1
- package/lib/devices/victron/victron-device.d.ts +2 -15
- package/lib/devices/victron/victron-device.js +11 -43
- package/lib/devices/wledDevice.js +2 -2
- package/lib/devices/zigbee/BaseDevices/ZigbeeActuator.js +1 -1
- package/lib/devices/zigbee/BaseDevices/zigbeeShutter.d.ts +0 -3
- package/lib/devices/zigbee/BaseDevices/zigbeeShutter.js +4 -11
- package/lib/index.d.ts +2 -2
- package/lib/index.js +2 -2
- package/lib/interfaces/baseDevices/iAcDevice.d.ts +4 -0
- package/lib/interfaces/baseDevices/iBaseDevice.d.ts +11 -1
- package/lib/services/Sonos/own-sonos-device.d.ts +4 -14
- package/lib/services/Sonos/own-sonos-device.js +8 -46
- package/lib/services/ac/ac-device.d.ts +6 -22
- package/lib/services/ac/ac-device.js +23 -53
- package/lib/services/ac/own-daikin-device.js +2 -2
- package/lib/tsconfig.tsbuildinfo +1 -1
- package/lib/utils/utils.d.ts +2 -1
- package/lib/utils/utils.js +15 -2
- package/package.json +1 -1
package/lib/utils/utils.d.ts
CHANGED
|
@@ -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[]) =>
|
|
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 & {};
|
package/lib/utils/utils.js
CHANGED
|
@@ -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);
|