hoffmation-base 3.0.0-alpha.4 → 3.0.0-alpha.6

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.
@@ -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,7 +4,7 @@ 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;
@@ -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} 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) {
@@ -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;
@@ -106,16 +106,16 @@ class LightGroup extends base_group_1.BaseGroup {
106
106
  resultLampen = darkOutside;
107
107
  }
108
108
  if (resultLampen) {
109
- this.setAllLampenTimeBased(new models_1.LampSetTimeBasedCommand(models_1.CommandSource.Automatic, c.time, 'LightGroup switchTimeConditional'));
109
+ this.setAllLampenTimeBased(new models_1.LampSetTimeBasedCommand(c, c.time, 'LightGroup switchTimeConditional'));
110
110
  }
111
111
  else {
112
- this.setAllLampen(new models_1.LampSetLightCommand(models_1.CommandSource.Automatic, false, 'LightGroup switchTimeConditional --> off'));
112
+ this.setAllLampen(new models_1.LampSetLightCommand(c, false, 'LightGroup switchTimeConditional --> off'));
113
113
  }
114
114
  if (resultSteckdosen) {
115
115
  this.setAllActuatorsTimeBased(c.time);
116
116
  }
117
117
  else {
118
- this.setAllOutlets(new models_1.ActuatorSetStateCommand(models_1.CommandSource.Automatic, false, 'LightGroup switchTimeConditional --> off'));
118
+ this.setAllOutlets(new models_1.ActuatorSetStateCommand(c, false, 'LightGroup switchTimeConditional --> off'));
119
119
  }
120
120
  }
121
121
  setAllLampen(c) {
@@ -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, services_1.LogDebugType.SetActuator);
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);
@@ -109,7 +109,7 @@ class OwnGoveeDevice {
109
109
  if (c.on && c.brightness === -1 && this.brightness < 10) {
110
110
  c.brightness = 10;
111
111
  }
112
- this.log(models_1.LogLevel.Debug, c.logMessage);
112
+ this.log(models_1.LogLevel.Debug, c.logMessage, log_service_1.LogDebugType.SetActuator);
113
113
  const formattedColor = utils_1.Utils.formatHex(c.color);
114
114
  if (formattedColor !== null) {
115
115
  this.setColor(c.color);
@@ -118,10 +118,8 @@ class OwnGoveeDevice {
118
118
  if (devices_1.LampUtils.checkBlockActive(this, c)) {
119
119
  return;
120
120
  }
121
- this.log(models_1.LogLevel.Debug, `Set Light Acutator to "${c.on}" with brightness ${c.brightness}`, log_service_1.LogDebugType.SetActuator);
122
121
  if (c.brightness > -1 && c.on) {
123
122
  this.setBrightness(c.brightness, () => {
124
- this.log(models_1.LogLevel.Debug, `Brightness set to ${c.brightness}`);
125
123
  this.turnOn();
126
124
  });
127
125
  }