hoffmation-base 2.18.0 → 2.18.1

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.
@@ -32,5 +32,4 @@ export declare class HeatGroup extends BaseGroup {
32
32
  deleteAutomaticPoint(name: string): void;
33
33
  setAutomaticPoint(setting: TemperatureSettings): void;
34
34
  private recalcRoomTemperatur;
35
- getTargetTemperature(): number;
36
35
  }
@@ -76,14 +76,14 @@ class HeatGroup extends base_group_1.BaseGroup {
76
76
  return temp;
77
77
  }
78
78
  get desiredTemp() {
79
- if (this.getHeater().length === 0) {
80
- return -99;
79
+ if (!this.settings.automaticMode) {
80
+ return this.settings.manualTemperature;
81
81
  }
82
- let value = 0;
83
- for (const h of this.getHeater()) {
84
- value += h.desiredTemperature;
82
+ const activeSetting = models_1.TemperatureSettings.getActiveSetting(this.settings.automaticPoints, new Date());
83
+ if (!activeSetting) {
84
+ return this.settings.automaticFallBackTemperatur;
85
85
  }
86
- return Math.round((value / this.getHeater().length) * 10) / 10;
86
+ return activeSetting.temperature;
87
87
  }
88
88
  static getInfo() {
89
89
  var _a, _b, _c;
@@ -162,15 +162,5 @@ class HeatGroup extends base_group_1.BaseGroup {
162
162
  ac.onTemperaturChange(temp);
163
163
  });
164
164
  }
165
- getTargetTemperature() {
166
- if (!this.settings.automaticMode) {
167
- return this.settings.manualTemperature;
168
- }
169
- const activeSetting = models_1.TemperatureSettings.getActiveSetting(this.settings.automaticPoints, new Date());
170
- if (!activeSetting) {
171
- return this.settings.manualTemperature;
172
- }
173
- return activeSetting.temperature;
174
- }
175
165
  }
176
166
  exports.HeatGroup = HeatGroup;
@@ -13,6 +13,7 @@ export declare abstract class AcDevice implements iExcessEnergyConsumer, iRoomDe
13
13
  deviceCapabilities: DeviceCapability[];
14
14
  readonly blockAutomationHandler: BlockAutomaticHandler;
15
15
  protected _activatedByExcessEnergy: boolean;
16
+ protected _desiredTemperatur: number;
16
17
  protected _info: DeviceInfo;
17
18
  protected _room: RoomBase | undefined;
18
19
  protected _mode: AcMode;
@@ -43,6 +43,7 @@ class AcDevice {
43
43
  this.settings = new models_1.AcSettings();
44
44
  this.deviceCapabilities = [DeviceCapability_1.DeviceCapability.ac, DeviceCapability_1.DeviceCapability.blockAutomatic];
45
45
  this._activatedByExcessEnergy = false;
46
+ this._desiredTemperatur = devices_1.UNDEFINED_TEMP_VALUE;
46
47
  this._mode = ac_mode_1.AcMode.Off;
47
48
  this._movementCallbackAdded = false;
48
49
  this._roomTemperature = 0;
@@ -96,8 +97,9 @@ class AcDevice {
96
97
  return this.calculateDesiredMode() !== ac_mode_1.AcMode.Off;
97
98
  }
98
99
  calculateDesiredMode() {
99
- var _a, _b, _c, _d, _e, _f, _g;
100
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
100
101
  const acOn = this.on;
102
+ this._desiredTemperatur = (_c = (_b = (_a = this.room) === null || _a === void 0 ? void 0 : _a.HeatGroup) === null || _b === void 0 ? void 0 : _b.desiredTemp) !== null && _c !== void 0 ? _c : 0;
101
103
  if (this.settings.manualDisabled) {
102
104
  acOn && this.log(models_1.LogLevel.Info, `We should turn off now, as manual disable force is set.`);
103
105
  return ac_mode_1.AcMode.Off;
@@ -107,7 +109,7 @@ class AcDevice {
107
109
  acOn && this.log(models_1.LogLevel.Info, `We should turn off now, to respect night settings.`);
108
110
  return ac_mode_1.AcMode.Off;
109
111
  }
110
- const heatGroup = (_a = this.room) === null || _a === void 0 ? void 0 : _a.HeatGroup;
112
+ const heatGroup = (_d = this.room) === null || _d === void 0 ? void 0 : _d.HeatGroup;
111
113
  if (this.settings.useOwnTemperatureAndAutomatic) {
112
114
  // Device is in automatic mode so ignore energy and room temperature
113
115
  if ((heatGroup === null || heatGroup === void 0 ? void 0 : heatGroup.settings.automaticMode) === false) {
@@ -116,14 +118,11 @@ class AcDevice {
116
118
  if (settings_service_1.SettingsService.heatMode !== config_1.HeatingMode.Sommer && this.settings.heatingAllowed) {
117
119
  return ac_mode_1.AcMode.Heating;
118
120
  }
119
- if (!this.settings.noCoolingOnMovement || ((_c = (_b = this.room) === null || _b === void 0 ? void 0 : _b.PraesenzGroup) === null || _c === void 0 ? void 0 : _c.anyPresent()) !== true) {
121
+ if (!this.settings.noCoolingOnMovement || ((_f = (_e = this.room) === null || _e === void 0 ? void 0 : _e.PraesenzGroup) === null || _f === void 0 ? void 0 : _f.anyPresent()) !== true) {
120
122
  return ac_mode_1.AcMode.Cooling;
121
123
  }
122
124
  return ac_mode_1.AcMode.Off;
123
125
  }
124
- if (this.settings.noCoolingOnMovement && ((_e = (_d = this.room) === null || _d === void 0 ? void 0 : _d.PraesenzGroup) === null || _e === void 0 ? void 0 : _e.anyPresent()) === true) {
125
- return ac_mode_1.AcMode.Off;
126
- }
127
126
  const temp = this.roomTemperature;
128
127
  if (temp === undefined || temp === devices_1.UNDEFINED_TEMP_VALUE) {
129
128
  this.log(models_1.LogLevel.Warn, `Can't calculate AC Mode as we have no room temperature`);
@@ -136,17 +135,20 @@ class AcDevice {
136
135
  let threshold = acOn ? 0.5 : 1.5;
137
136
  let thresholdHeating = acOn ? 0.5 : 1.5;
138
137
  let desiredMode = ac_mode_1.AcMode.Off;
139
- const excessEnergy = (_g = (_f = devices_1.Devices.energymanager) === null || _f === void 0 ? void 0 : _f.excessEnergy) !== null && _g !== void 0 ? _g : -1;
138
+ const excessEnergy = (_h = (_g = devices_1.Devices.energymanager) === null || _g === void 0 ? void 0 : _g.excessEnergy) !== null && _h !== void 0 ? _h : -1;
140
139
  if ((acOn ? 200 : 1000) < excessEnergy) {
141
140
  // As there is plenty of energy to spare we plan to overshoot the target by 1 degree
142
141
  threshold = -0.5;
143
142
  thresholdHeating = -0.5;
144
143
  }
145
- const targetTemp = heatGroup.getTargetTemperature();
144
+ const targetTemp = heatGroup.desiredTemp;
146
145
  const coolUntil = targetTemp + threshold;
147
146
  const heatUntil = targetTemp - thresholdHeating;
148
147
  if (temp > coolUntil && settings_service_1.SettingsService.heatMode === config_1.HeatingMode.Sommer) {
149
148
  desiredMode = ac_mode_1.AcMode.Cooling;
149
+ if (this.settings.noCoolingOnMovement && ((_k = (_j = this.room) === null || _j === void 0 ? void 0 : _j.PraesenzGroup) === null || _k === void 0 ? void 0 : _k.anyPresent()) === true) {
150
+ return ac_mode_1.AcMode.Off;
151
+ }
150
152
  }
151
153
  else if (temp < heatUntil && this.settings.heatingAllowed && settings_service_1.SettingsService.heatMode === config_1.HeatingMode.Winter) {
152
154
  desiredMode = ac_mode_1.AcMode.Heating;
@@ -81,8 +81,8 @@ class OwnDaikinDevice extends ac_device_1.AcDevice {
81
81
  });
82
82
  }
83
83
  setDesiredInfo(retry = false, forceTemp) {
84
- var _a, _b, _c, _d;
85
- let targetTemp = (_c = (_b = (_a = this.room) === null || _a === void 0 ? void 0 : _a.HeatGroup) === null || _b === void 0 ? void 0 : _b.getTargetTemperature()) !== null && _c !== void 0 ? _c : 21;
84
+ var _a;
85
+ let targetTemp = this._desiredTemperatur;
86
86
  if (this.desiredMode == daikin_controller_1.Mode.HOT) {
87
87
  targetTemp = this.settings.useOwnTemperatureAndAutomatic ? targetTemp + 1 : 29;
88
88
  }
@@ -95,7 +95,7 @@ class OwnDaikinDevice extends ac_device_1.AcDevice {
95
95
  targetHumidity: this.desiredHum,
96
96
  targetTemperature: forceTemp !== null && forceTemp !== void 0 ? forceTemp : targetTemp,
97
97
  };
98
- (_d = this.device) === null || _d === void 0 ? void 0 : _d.setACControlInfo(changeObject, (err, res) => {
98
+ (_a = this.device) === null || _a === void 0 ? void 0 : _a.setACControlInfo(changeObject, (err, res) => {
99
99
  var _a;
100
100
  if (err !== null) {
101
101
  log_service_1.ServerLogService.writeLog(models_1.LogLevel.Warn, `Setting Ac Info for ${this.name} failed: ${err} `);