hoffmation-base 3.0.0-alpha.26 → 3.0.0-alpha.28

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.
@@ -16,7 +16,7 @@ export declare class DimmerSetLightCommand extends LampSetLightCommand {
16
16
  * @param on - The desired value
17
17
  * @param reason - You can provide a reason for clarity
18
18
  * @param disableAutomatic - If provided, the device will remain in the desired state for the given disable action.
19
- * If unset the default value will be used: {@link SettingsService.settings.blockAutomaticHandlerDefaults}
19
+ * If undefined the default value will be used in case it's a non automatic action: {@link SettingsService.settings.blockAutomaticHandlerDefaults}
20
20
  * @param brightness - The desired brightness
21
21
  * @param transitionTime - The transition time during turnOn/turnOff
22
22
  */
@@ -11,7 +11,7 @@ class DimmerSetLightCommand extends lampSetLightCommand_1.LampSetLightCommand {
11
11
  * @param on - The desired value
12
12
  * @param reason - You can provide a reason for clarity
13
13
  * @param disableAutomatic - If provided, the device will remain in the desired state for the given disable action.
14
- * If unset the default value will be used: {@link SettingsService.settings.blockAutomaticHandlerDefaults}
14
+ * If undefined the default value will be used in case it's a non automatic action: {@link SettingsService.settings.blockAutomaticHandlerDefaults}
15
15
  * @param brightness - The desired brightness
16
16
  * @param transitionTime - The transition time during turnOn/turnOff
17
17
  */
@@ -12,7 +12,7 @@ export declare class LampSetLightCommand extends ActuatorSetStateCommand {
12
12
  * @param on - The new state of the light
13
13
  * @param reason - You can provide a reason for clarification
14
14
  * @param disableAutomatic - If provided, the device will remain in the desired state for the given disable action.
15
- * If unset the default value will be used: {@link SettingsService.settings.blockAutomaticHandlerDefaults}
15
+ * If undefined the default value will be used in case it's a non automatic action: {@link SettingsService.settings.blockAutomaticHandlerDefaults}
16
16
  */
17
17
  constructor(source: CommandSource | BaseCommand, on: boolean, reason?: string, disableAutomatic?: BlockAutomaticCommand | null);
18
18
  /** @inheritDoc */
@@ -10,7 +10,7 @@ class LampSetLightCommand extends actuatorSetStateCommand_1.ActuatorSetStateComm
10
10
  * @param on - The new state of the light
11
11
  * @param reason - You can provide a reason for clarification
12
12
  * @param disableAutomatic - If provided, the device will remain in the desired state for the given disable action.
13
- * If unset the default value will be used: {@link SettingsService.settings.blockAutomaticHandlerDefaults}
13
+ * If undefined the default value will be used in case it's a non automatic action: {@link SettingsService.settings.blockAutomaticHandlerDefaults}
14
14
  */
15
15
  constructor(source, on, reason = '', disableAutomatic) {
16
16
  super(source, on, reason, disableAutomatic);
@@ -19,7 +19,7 @@ export declare class LampSetTimeBasedCommand extends BaseCommand {
19
19
  * @param time - The time to use for calculation of desired state
20
20
  * @param reason - You can provide a reason for clarity
21
21
  * @param disableAutomatic - If provided, the device will remain in the desired state for the given disable action.
22
- * If unset the default value will be used: {@link SettingsService.settings.blockAutomaticHandlerDefaults}
22
+ * If undefined the default value will be used in case it's a non automatic action: {@link SettingsService.settings.blockAutomaticHandlerDefaults}
23
23
  */
24
24
  constructor(source: CommandSource | BaseCommand, time: TimeOfDay, reason?: string, disableAutomatic?: BlockAutomaticCommand | null);
25
25
  }
@@ -10,7 +10,7 @@ class LampSetTimeBasedCommand extends baseCommand_1.BaseCommand {
10
10
  * @param time - The time to use for calculation of desired state
11
11
  * @param reason - You can provide a reason for clarity
12
12
  * @param disableAutomatic - If provided, the device will remain in the desired state for the given disable action.
13
- * If unset the default value will be used: {@link SettingsService.settings.blockAutomaticHandlerDefaults}
13
+ * If undefined the default value will be used in case it's a non automatic action: {@link SettingsService.settings.blockAutomaticHandlerDefaults}
14
14
  */
15
15
  constructor(source, time, reason = '', disableAutomatic) {
16
16
  super(source, reason);
@@ -16,7 +16,7 @@ export declare class LedSetLightCommand extends DimmerSetLightCommand {
16
16
  * @param on - The desired state-value
17
17
  * @param reason - You can provide a reason for clarity
18
18
  * @param disableAutomatic - If provided, the device will remain in the desired state for the given disable action.
19
- * If unset the default value will be used: {@link SettingsService.settings.blockAutomaticHandlerDefaults}
19
+ * If undefined the default value will be used in case it's a non automatic action: {@link SettingsService.settings.blockAutomaticHandlerDefaults}
20
20
  * @param brightness - The desired brightness
21
21
  * @param transitionTime - The transition time during turnOn/turnOff
22
22
  * @param color - The desired color in 6 digit hex Code
@@ -11,7 +11,7 @@ class LedSetLightCommand extends dimmerSetLightCommand_1.DimmerSetLightCommand {
11
11
  * @param on - The desired state-value
12
12
  * @param reason - You can provide a reason for clarity
13
13
  * @param disableAutomatic - If provided, the device will remain in the desired state for the given disable action.
14
- * If unset the default value will be used: {@link SettingsService.settings.blockAutomaticHandlerDefaults}
14
+ * If undefined the default value will be used in case it's a non automatic action: {@link SettingsService.settings.blockAutomaticHandlerDefaults}
15
15
  * @param brightness - The desired brightness
16
16
  * @param transitionTime - The transition time during turnOn/turnOff
17
17
  * @param color - The desired color in 6 digit hex Code
@@ -15,7 +15,7 @@ export declare class WledSetLightCommand extends DimmerSetLightCommand {
15
15
  * @param on - The desired state of the light
16
16
  * @param reason - You can provide a reason for clarification
17
17
  * @param disableAutomatic - If provided, the device will remain in the desired state for the given disable action.
18
- * If unset the default value will be used: {@link SettingsService.settings.blockAutomaticHandlerDefaults}
18
+ * If undefined the default value will be used in case it's a non automatic action: {@link SettingsService.settings.blockAutomaticHandlerDefaults}
19
19
  * @param brightness - The brightness of the light
20
20
  * @param transitionTime - The time in milliseconds the transition should take
21
21
  * @param preset - The preset to use
@@ -11,7 +11,7 @@ class WledSetLightCommand extends dimmerSetLightCommand_1.DimmerSetLightCommand
11
11
  * @param on - The desired state of the light
12
12
  * @param reason - You can provide a reason for clarification
13
13
  * @param disableAutomatic - If provided, the device will remain in the desired state for the given disable action.
14
- * If unset the default value will be used: {@link SettingsService.settings.blockAutomaticHandlerDefaults}
14
+ * If undefined the default value will be used in case it's a non automatic action: {@link SettingsService.settings.blockAutomaticHandlerDefaults}
15
15
  * @param brightness - The brightness of the light
16
16
  * @param transitionTime - The time in milliseconds the transition should take
17
17
  * @param preset - The preset to use
@@ -96,8 +96,8 @@ class TimeCallback {
96
96
  }
97
97
  break;
98
98
  }
99
- if (nextCalculatedTime < now && this.nextToDo && this.nextToDo > now) {
100
- server_1.ServerLogService.writeLog(logLevel_1.LogLevel.Info, 'Time Callback recalc results in the past, while previous target is still in future --> fire immediately.');
99
+ if (nextCalculatedTime < now && this.nextToDo && this.nextToDo > this.lastDone) {
100
+ server_1.ServerLogService.writeLog(logLevel_1.LogLevel.Info, `Time Callback recalc results in the past, while previous target wasn't yet done --> fire immediately.`);
101
101
  this.perform(now);
102
102
  return;
103
103
  }
@@ -110,11 +110,11 @@ class TimeCallback {
110
110
  }
111
111
  perform(now = new Date()) {
112
112
  server_1.ServerLogService.writeLog(logLevel_1.LogLevel.Debug, `Timecallback '${this.name}' fired`);
113
- this.cFunction();
114
113
  this.lastDone = now;
115
114
  this.nextToDo = undefined;
116
115
  this._calculationSunrise = undefined;
117
116
  this._calculationSunset = undefined;
117
+ this.cFunction();
118
118
  }
119
119
  }
120
120
  exports.TimeCallback = TimeCallback;
@@ -79,11 +79,11 @@ class WindowGroup extends base_group_1.BaseGroup {
79
79
  });
80
80
  }
81
81
  sunriseUp(c) {
82
- this.windows.forEach((f) => {
83
- if (!this.getRoom().settings.sonnenAufgangRollos || f.getShutter().length === 0) {
82
+ this.windows.forEach((w) => {
83
+ if (!this.getRoom().settings.sonnenAufgangRollos || w.getShutter().length === 0) {
84
84
  return;
85
85
  }
86
- f.setDesiredPosition(new models_1.WindowSetDesiredPositionCommand(c, 100));
86
+ w.setDesiredPosition(new models_1.WindowSetDesiredPositionCommand(c, 100));
87
87
  });
88
88
  }
89
89
  restoreShutterPosition(c) {
@@ -164,7 +164,7 @@ class WindowGroup extends base_group_1.BaseGroup {
164
164
  }
165
165
  if (this.sunriseShutterCallback === undefined) {
166
166
  this.log(models_1.LogLevel.Debug, `Add Sunrise shutter TimeCallback for ${this.roomName}`);
167
- this.sunriseShutterCallback = new models_1.TimeCallback(`${this.roomName} Sonnenaufgang Rollos`, models_1.TimeCallbackType.Sunrise, () => {
167
+ this.sunriseShutterCallback = new models_1.TimeCallback(`${this.roomName} Sunrise Shutter`, models_1.TimeCallbackType.Sunrise, () => {
168
168
  if (room.skipNextRolloUp) {
169
169
  this.log(models_1.LogLevel.Info, `${this.roomName} skipped sunrise up due to room.skipNextRolloUp`);
170
170
  room.skipNextRolloUp = false;
@@ -69,7 +69,6 @@ class LampUtils {
69
69
  return false;
70
70
  }
71
71
  static setActuator(device, c) {
72
- var _a;
73
72
  if (device.settings.isStromStoss &&
74
73
  c.on &&
75
74
  c.containsType(models_1.CommandType.ActuatorRestoreTargetAutomaticValueCommand)) {
@@ -96,8 +95,13 @@ class LampUtils {
96
95
  if (dontBlock || c.disableAutomaticCommand === null) {
97
96
  return;
98
97
  }
99
- (_a = c.disableAutomaticCommand) !== null && _a !== void 0 ? _a : (c.disableAutomaticCommand = models_1.BlockAutomaticCommand.fromDeviceSettings(c, device.settings));
100
- if (c.disableAutomaticCommand !== null) {
98
+ if (dontBlock) {
99
+ return;
100
+ }
101
+ if (c.disableAutomaticCommand === undefined && c.isForceAction) {
102
+ c.disableAutomaticCommand = models_1.BlockAutomaticCommand.fromDeviceSettings(c, device.settings);
103
+ }
104
+ if (c.disableAutomaticCommand) {
101
105
  device.blockAutomationHandler.disableAutomatic(c.disableAutomaticCommand);
102
106
  }
103
107
  }
@@ -57,7 +57,6 @@ class WledDevice extends IoBrokerBaseDevice_1.IoBrokerBaseDevice {
57
57
  this.setWled(new models_1.WledSetLightCommand(c, c.on, 'Set Wled due to DimmerSetLightCommand', c.disableAutomaticCommand, c.brightness, c.transitionTime, undefined));
58
58
  }
59
59
  setWled(c) {
60
- var _a;
61
60
  if (this._onID === '') {
62
61
  services_1.ServerLogService.writeLog(models_1.LogLevel.Error, `Keine On ID für "${this.info.customName}" bekannt.`);
63
62
  return;
@@ -90,11 +89,14 @@ class WledDevice extends IoBrokerBaseDevice_1.IoBrokerBaseDevice {
90
89
  services_1.ServerLogService.writeLog(models_1.LogLevel.Error, `Dimmer Helligkeit schalten ergab Fehler: ${err}`);
91
90
  });
92
91
  }
93
- if (!dontBlock && c.disableAutomaticCommand !== null) {
94
- (_a = c.disableAutomaticCommand) !== null && _a !== void 0 ? _a : (c.disableAutomaticCommand = models_1.BlockAutomaticCommand.fromDeviceSettings(c, this.settings));
95
- if (c.disableAutomaticCommand !== null) {
96
- this.blockAutomationHandler.disableAutomatic(c.disableAutomaticCommand);
97
- }
92
+ if (dontBlock || c.disableAutomaticCommand === null) {
93
+ return;
94
+ }
95
+ if (c.disableAutomaticCommand === undefined && c.isForceAction) {
96
+ c.disableAutomaticCommand = models_1.BlockAutomaticCommand.fromDeviceSettings(c, this.settings);
97
+ }
98
+ if (c.disableAutomaticCommand) {
99
+ this.blockAutomationHandler.disableAutomatic(c.disableAutomaticCommand);
98
100
  }
99
101
  }
100
102
  setTimeBased(c) {
@@ -79,7 +79,7 @@ class ZigbeeDimmer extends index_1.ZigbeeDevice {
79
79
  }
80
80
  /** @inheritDoc */
81
81
  setLight(c) {
82
- var _a, _b;
82
+ var _a;
83
83
  if (this._stateIdState === '') {
84
84
  this.log(models_1.LogLevel.Error, 'Keine State ID bekannt.');
85
85
  return;
@@ -99,12 +99,14 @@ class ZigbeeDimmer extends index_1.ZigbeeDevice {
99
99
  c.brightness = 10;
100
100
  }
101
101
  if (!dontBlock && c.disableAutomaticCommand !== null) {
102
- (_a = c.disableAutomaticCommand) !== null && _a !== void 0 ? _a : (c.disableAutomaticCommand = models_1.BlockAutomaticCommand.fromDeviceSettings(c, this.settings));
103
- if (c.disableAutomaticCommand !== null) {
102
+ if (c.disableAutomaticCommand === undefined && c.isForceAction) {
103
+ c.disableAutomaticCommand = models_1.BlockAutomaticCommand.fromDeviceSettings(c, this.settings);
104
+ }
105
+ if (c.disableAutomaticCommand) {
104
106
  this.blockAutomationHandler.disableAutomatic(c.disableAutomaticCommand);
105
107
  }
106
108
  }
107
- if (((_b = services_1.SettingsService.settings.ioBroker) === null || _b === void 0 ? void 0 : _b.useZigbee2mqtt) && !c.on) {
109
+ if (((_a = services_1.SettingsService.settings.ioBroker) === null || _a === void 0 ? void 0 : _a.useZigbee2mqtt) && !c.on) {
108
110
  // With zigbee2mqtt to turn on only setting brighness>0 is needed, so we need state only for turning off
109
111
  this.writeActuatorStateToDevice(new models_1.ActuatorWriteStateToDeviceCommand(c, c.on));
110
112
  this.queuedValue = c.on;
@@ -89,11 +89,11 @@ class ZigbeeShutter extends zigbeeDevice_1.ZigbeeDevice {
89
89
  this._firstCommandRecieved = true;
90
90
  }
91
91
  else if (this._firstCommandRecieved && c.isInitial) {
92
- this.log(models_1.LogLevel.Debug, `Skipped initial Rollo to ${pPosition} as we recieved a command already`);
92
+ this.log(models_1.LogLevel.Debug, `Skipped initial shutter to ${pPosition} as we recieved a command already`);
93
93
  return;
94
94
  }
95
95
  if (this.currentLevel === pPosition && !c.isForceAction) {
96
- this.log(models_1.LogLevel.Debug, `Skip Rollo command to Position ${pPosition} as this is the current one, commandLog: ${c.logMessage}`, services_1.LogDebugType.SkipUnchangedRolloPosition);
96
+ this.log(models_1.LogLevel.Debug, `Skip shutter command to Position ${pPosition} as this is the current one, commandLog: ${c.logMessage}`, services_1.LogDebugType.SkipUnchangedRolloPosition);
97
97
  return;
98
98
  }
99
99
  this.log(models_1.LogLevel.Debug, c.logMessage);
@@ -38,7 +38,9 @@ class BlockAutomaticHandler {
38
38
  }
39
39
  this.automaticBlockedUntil = c.targetDate;
40
40
  if (c.revertToAutomaticAtBlockLift) {
41
- this.updateRestoreTimeout(new models_1.RestoreTargetAutomaticValueCommand(c, 'Restore to automatic state after block.'));
41
+ const revertCommand = new models_1.RestoreTargetAutomaticValueCommand(c, 'Restore to automatic state after block.');
42
+ revertCommand.overrideCommandSource = models_1.CommandSource.Automatic;
43
+ this.updateRestoreTimeout(revertCommand);
42
44
  }
43
45
  else {
44
46
  this.removeRestoreTimeout();