hoffmation-base 3.0.0-alpha.3 → 3.0.0-alpha.5

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.
@@ -11,7 +11,7 @@ class ShutterSetLevelCommand extends baseCommand_1.BaseCommand {
11
11
  this._commandType = commandType_1.CommandType.ShutterSetLevelCommand;
12
12
  }
13
13
  get logMessage() {
14
- return `Shutter setLevel to ${this.level} from ${this.source} for reason: ${this.reasonTrace}`;
14
+ return `Shutter setLevel to ${this.level} for reason: ${this.reasonTrace}`;
15
15
  }
16
16
  }
17
17
  exports.ShutterSetLevelCommand = ShutterSetLevelCommand;
@@ -11,7 +11,7 @@ class ActuatorSetStateCommand extends baseCommand_1.BaseCommand {
11
11
  this._commandType = commandType_1.CommandType.ShutterSetLevelCommand;
12
12
  }
13
13
  get logMessage() {
14
- return `Actuator setState to ${this.on} from ${this.source} for reason: ${this.reasonTrace}`;
14
+ return `Actuator setState to ${this.on} for reason: ${this.reasonTrace}`;
15
15
  }
16
16
  static byActuatorAndToggleCommand(device, c) {
17
17
  const newVal = device.queuedValue !== null ? !device.queuedValue : !device.actuatorOn;
@@ -9,7 +9,7 @@ class ActuatorToggleCommand extends baseCommand_1.BaseCommand {
9
9
  this._commandType = commandType_1.CommandType.ActuatorToggleCommand;
10
10
  }
11
11
  get logMessage() {
12
- return `Actuator toggle due to ${this.source} for reason: ${this.reasonTrace}`;
12
+ return `Actuator toggle for reason: ${this.reasonTrace}`;
13
13
  }
14
14
  }
15
15
  exports.ActuatorToggleCommand = ActuatorToggleCommand;
@@ -4,6 +4,6 @@ import { CommandSource } from './commandSource';
4
4
  export declare class ActuatorWriteStateToDeviceCommand extends BaseCommand {
5
5
  readonly stateValue: boolean;
6
6
  _commandType: CommandType;
7
- constructor(stateValue: boolean, source: CommandSource | BaseCommand, reason?: string);
7
+ constructor(source: CommandSource | BaseCommand, stateValue: boolean, reason?: string);
8
8
  get logMessage(): string;
9
9
  }
@@ -4,13 +4,13 @@ exports.ActuatorWriteStateToDeviceCommand = void 0;
4
4
  const baseCommand_1 = require("./baseCommand");
5
5
  const commandType_1 = require("./commandType");
6
6
  class ActuatorWriteStateToDeviceCommand extends baseCommand_1.BaseCommand {
7
- constructor(stateValue, source, reason = '') {
7
+ constructor(source, stateValue, reason = '') {
8
8
  super(source, reason);
9
9
  this.stateValue = stateValue;
10
10
  this._commandType = commandType_1.CommandType.ActuatorWriteStateToDeviceCommand;
11
11
  }
12
12
  get logMessage() {
13
- return `Actuator writeStateToDevice(${this.stateValue}) due to ${this.source} for reason: ${this.reasonTrace}`;
13
+ return `Actuator writeStateToDevice(${this.stateValue}) for reason: ${this.reasonTrace}`;
14
14
  }
15
15
  }
16
16
  exports.ActuatorWriteStateToDeviceCommand = ActuatorWriteStateToDeviceCommand;
@@ -21,17 +21,11 @@ class BaseCommand {
21
21
  return this.source === commandSource_1.CommandSource.Initial;
22
22
  }
23
23
  get reasonTrace() {
24
- let reason = '';
25
- if (this.source instanceof BaseCommand) {
26
- reason = this.source.reasonTrace;
27
- }
28
- if (this.reason === '') {
29
- if (reason === '') {
30
- return `${this._commandType}`;
31
- }
32
- return `${reason} -> ${this._commandType}`;
24
+ const ownPart = this.reason !== '' ? `${this._commandType}("${this.reason}")` : `${this._commandType}`;
25
+ if (typeof this.source === 'object') {
26
+ return `${this.source.reasonTrace} -> ${ownPart}`;
33
27
  }
34
- return `${reason} -> ${this._commandType}(${this.reason})`;
28
+ return `CommandType("${commandSource_1.CommandSource[this.source]}") stack => ${ownPart}`;
35
29
  }
36
30
  }
37
31
  exports.BaseCommand = BaseCommand;
@@ -9,7 +9,7 @@ class LampSetLightCommand extends actuatorSetStateCommand_1.ActuatorSetStateComm
9
9
  this._commandType = commandType_1.CommandType.LampSetLightCommand;
10
10
  }
11
11
  get logMessage() {
12
- return `Lamp setLight to ${this.on} from ${this.source} for reason: ${this.reasonTrace}`;
12
+ return `Lamp setLight to ${this.on} for reason: ${this.reasonTrace}`;
13
13
  }
14
14
  }
15
15
  exports.LampSetLightCommand = LampSetLightCommand;
@@ -19,7 +19,7 @@ class LampSetTimeBasedCommand extends baseCommand_1.BaseCommand {
19
19
  this._commandType = commandType_1.CommandType.LampSetTimeBasedCommand;
20
20
  }
21
21
  get logMessage() {
22
- return `Lamp setTimeBased to ${timeCallback_1.TimeOfDay[this.time]} from ${this.source}`;
22
+ return `Lamp setTimeBased to ${timeCallback_1.TimeOfDay[this.time]} for reason: ${this.reasonTrace}`;
23
23
  }
24
24
  }
25
25
  exports.LampSetTimeBasedCommand = LampSetTimeBasedCommand;
@@ -18,7 +18,7 @@ class LampToggleLightCommand extends actuatorToggleCommand_1.ActuatorToggleComma
18
18
  this._commandType = commandType_1.CommandType.LampToggleLightCommand;
19
19
  }
20
20
  get logMessage() {
21
- return `Lamp toggleLight from ${this.source} for reason: ${this.reasonTrace}`;
21
+ return `Lamp toggleLight for reason: ${this.reasonTrace}`;
22
22
  }
23
23
  }
24
24
  exports.LampToggleLightCommand = LampToggleLightCommand;
@@ -23,7 +23,7 @@ class LedSetLightCommand extends dimmerSetLightCommand_1.DimmerSetLightCommand {
23
23
  this._commandType = commandType_1.CommandType.LedSetLightCommand;
24
24
  }
25
25
  get logMessage() {
26
- return `Led setLight to ${this.on} from ${this.source} for reason: ${this.reasonTrace}`;
26
+ return `Led setLight to state: ${this.on}, timeout: ${this.timeout}, brightness: ${this.brightness}, color: ${this.color}, colorTemp: ${this.colorTemp} for reason: ${this.reasonTrace}`;
27
27
  }
28
28
  static byTimeBased(settings, c) {
29
29
  switch (c.time) {
@@ -9,7 +9,7 @@ class RestoreTargetAutomaticValueCommand extends baseCommand_1.BaseCommand {
9
9
  this._commandType = commandType_1.CommandType.ActuatorRestoreTargetAutomaticValueCommand;
10
10
  }
11
11
  get logMessage() {
12
- return `Actuator restore target automatic value from ${this.source} for reason: ${this.reasonTrace}`;
12
+ return `Actuator restore target automatic value due to reason: ${this.reasonTrace}`;
13
13
  }
14
14
  }
15
15
  exports.RestoreTargetAutomaticValueCommand = RestoreTargetAutomaticValueCommand;
@@ -132,7 +132,7 @@ class RoomBase {
132
132
  })))) {
133
133
  timeOfDay = server_1.Utils.nowTime().hours > 16 ? timeCallback_1.TimeOfDay.AfterSunset : timeCallback_1.TimeOfDay.BeforeSunrise;
134
134
  }
135
- this.LightGroup.switchTimeConditional(new command_1.LightGroupSwitchTimeConditionalCommand(c, timeOfDay, 'Roombase.setLightTimeBased'));
135
+ this.LightGroup.switchTimeConditional(new command_1.LightGroupSwitchTimeConditionalCommand(c, timeOfDay));
136
136
  }
137
137
  isNowLightTime() {
138
138
  var _a;
@@ -77,7 +77,6 @@ class HmIpRoll extends hmIpDevice_1.HmIPDevice {
77
77
  }
78
78
  }
79
79
  setLevel(command) {
80
- this.log(models_2.LogLevel.Debug, command.logMessage);
81
80
  let targetLevel = command.level;
82
81
  if (!this._firstCommandRecieved && !command.isInitial) {
83
82
  this._firstCommandRecieved = true;
@@ -87,7 +86,7 @@ class HmIpRoll extends hmIpDevice_1.HmIPDevice {
87
86
  return;
88
87
  }
89
88
  if (this.currentLevel === targetLevel && !command.isForceAction) {
90
- this.log(models_2.LogLevel.Debug, `Skip Rollo command to Position ${targetLevel} as this is the current one`, services_1.LogDebugType.SkipUnchangedRolloPosition);
89
+ this.log(models_2.LogLevel.Debug, `Skip Rollo command to Position ${targetLevel} as this is the current one, commandLog: ${command.logMessage}`, services_1.LogDebugType.SkipUnchangedRolloPosition);
91
90
  return;
92
91
  }
93
92
  if (this._setLevelSwitchID === '') {
@@ -97,6 +96,7 @@ class HmIpRoll extends hmIpDevice_1.HmIPDevice {
97
96
  if (!this.checkIoConnection(true)) {
98
97
  return;
99
98
  }
99
+ this.log(models_2.LogLevel.Debug, command.logMessage);
100
100
  if (this._window !== undefined) {
101
101
  if (this._window.griffeInPosition(models_1.WindowPosition.offen) > 0 && command.level < 100) {
102
102
  if (!command.skipOpenWarning) {
@@ -50,7 +50,7 @@ class LampUtils {
50
50
  }
51
51
  static checkBlockActive(device, c) {
52
52
  if (!c.isForceAction && device.blockAutomationHandler.automaticBlockActive) {
53
- device.log(models_1.LogLevel.Debug, `Skip automatic command to ${c.on} as it is locked until ${new Date(device.blockAutomationHandler.automaticBlockedUntil).toLocaleTimeString()}`);
53
+ device.log(models_1.LogLevel.Debug, `Skip command to ${c.on} as it is locked until ${new Date(device.blockAutomationHandler.automaticBlockedUntil).toLocaleTimeString()}; command Log: ${c.logMessage}`);
54
54
  device.targetAutomaticState = c.on;
55
55
  return true;
56
56
  }
@@ -72,7 +72,7 @@ class LampUtils {
72
72
  return;
73
73
  }
74
74
  device.queuedValue = c.on;
75
- device.writeActuatorStateToDevice(new models_1.ActuatorWriteStateToDeviceCommand(c.on, c));
75
+ device.writeActuatorStateToDevice(new models_1.ActuatorWriteStateToDeviceCommand(c, c.on));
76
76
  if (device.settings.isStromStoss && c.on) {
77
77
  c.timeout = 3000;
78
78
  LampUtils.stromStossOn(device);
@@ -65,7 +65,7 @@ class WledDevice extends IoBrokerBaseDevice_1.IoBrokerBaseDevice {
65
65
  }
66
66
  services_1.ServerLogService.writeLog(models_1.LogLevel.Debug, `WLED Schalten: "${this.info.customName}" An: ${c.on}\tHelligkeit: ${c.brightness}%`);
67
67
  this.queuedValue = c.on;
68
- this.writeActuatorStateToDevice(new models_1.ActuatorWriteStateToDeviceCommand(c.on, c, 'WLED Schalten'));
68
+ this.writeActuatorStateToDevice(new models_1.ActuatorWriteStateToDeviceCommand(c, c.on, 'WLED Schalten'));
69
69
  if (c.preset !== undefined) {
70
70
  this.setState(this._presetID, c.preset, undefined, (err) => {
71
71
  services_1.ServerLogService.writeLog(models_1.LogLevel.Error, `WLED schalten ergab Fehler: ${err}`);
@@ -82,23 +82,23 @@ class ZigbeeDimmer extends index_1.ZigbeeDevice {
82
82
  this.log(models_1.LogLevel.Error, `Keine Connection bekannt.`);
83
83
  return;
84
84
  }
85
- if (c.transitionTime > -1) {
86
- this.setState(this._stateIdTransitionTime, c.transitionTime);
87
- }
88
85
  const dontBlock = sharedFunctions_1.LampUtils.checkUnBlock(this, c);
89
86
  if (sharedFunctions_1.LampUtils.checkBlockActive(this, c)) {
90
87
  return;
91
88
  }
89
+ if (c.transitionTime > -1) {
90
+ this.setState(this._stateIdTransitionTime, c.transitionTime);
91
+ }
92
92
  if (c.on && c.brightness <= 0 && this.brightness < 10) {
93
93
  c.brightness = 10;
94
94
  }
95
- this.log(models_1.LogLevel.Debug, `Set Light Acutator to "${c.on}" with brightness ${c.brightness}`, services_1.LogDebugType.SetActuator);
95
+ this.log(models_1.LogLevel.Debug, c.logMessage);
96
96
  if (c.timeout > -1 && !dontBlock) {
97
97
  this.blockAutomationHandler.disableAutomatic(c.timeout, models_1.CollisionSolving.overrideIfGreater);
98
98
  }
99
99
  if (((_a = services_1.SettingsService.settings.ioBroker) === null || _a === void 0 ? void 0 : _a.useZigbee2mqtt) && !c.on) {
100
100
  // With zigbee2mqtt to turn on only setting brighness>0 is needed, so we need state only for turning off
101
- this.writeActuatorStateToDevice(new models_1.ActuatorWriteStateToDeviceCommand(c.on, c, 'Set dimmer due to set ActuactorCommand'));
101
+ this.writeActuatorStateToDevice(new models_1.ActuatorWriteStateToDeviceCommand(c, c.on, 'Set dimmer due to set ActuactorCommand'));
102
102
  this.queuedValue = c.on;
103
103
  return;
104
104
  }
@@ -56,7 +56,6 @@ class ZigbeeLedRGBCCT extends zigbeeDimmer_1.ZigbeeDimmer {
56
56
  if (c.on && c.brightness === -1 && this.brightness < 10) {
57
57
  c.brightness = 10;
58
58
  }
59
- this.log(models_1.LogLevel.Debug, `LED Schalten An: ${c.on}\tHelligkeit: ${c.brightness}%\tFarbe: "${c.color}"\tColorTemperatur: ${c.colorTemp}\tTransition Time: ${c.transitionTime}`);
60
59
  const formattedColor = services_1.Utils.formatHex(c.color);
61
60
  if (formattedColor !== null && c.on) {
62
61
  this.setState(this._stateIdColor, formattedColor);
@@ -75,19 +75,19 @@ class ZigbeeShutter extends zigbeeDevice_1.ZigbeeDevice {
75
75
  super.update(idSplit, state, initial, pOverride);
76
76
  }
77
77
  setLevel(c) {
78
- this.log(models_1.LogLevel.Debug, c.logMessage);
79
78
  let pPosition = c.level;
80
79
  if (!this._firstCommandRecieved && !c.isInitial) {
81
80
  this._firstCommandRecieved = true;
82
81
  }
83
82
  else if (this._firstCommandRecieved && c.isInitial) {
84
- this.log(models_1.LogLevel.Debug, `Skipped initial Rollo to ${pPosition} as we recieved a command already`);
83
+ this.log(models_1.LogLevel.Debug, `Skipped initial Rollo to ${pPosition} as we recieved a command already`);
85
84
  return;
86
85
  }
87
86
  if (this.currentLevel === pPosition && !c.isForceAction) {
88
- this.log(models_1.LogLevel.Debug, `Skip Rollo command to Position ${pPosition} as this is the current one`, services_1.LogDebugType.SkipUnchangedRolloPosition);
87
+ 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);
89
88
  return;
90
89
  }
90
+ this.log(models_1.LogLevel.Debug, c.logMessage);
91
91
  if (this._window !== undefined) {
92
92
  if (this._window.griffeInPosition(models_2.WindowPosition.offen) > 0 && pPosition < 100) {
93
93
  if (!c.skipOpenWarning) {