hoffmation-base 3.0.0-alpha.95 → 3.0.0-alpha.96

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.
@@ -34,6 +34,10 @@ export declare class Dachs implements iBaseDevice, iActuator {
34
34
  * An external actuator to prevent the Dachs from starting.
35
35
  */
36
36
  blockDachsStart?: iActuator;
37
+ /**
38
+ * An external actuator controlling some device to heat the warm water while the Dachs is prohibited from starting.
39
+ */
40
+ warmWaterDachsAlternativeActuator?: iActuator;
37
41
  private readonly client;
38
42
  private readonly config;
39
43
  /** @inheritDoc */
@@ -85,4 +89,5 @@ export declare class Dachs implements iBaseDevice, iActuator {
85
89
  private onTempChange;
86
90
  private checkHeatingRod;
87
91
  private shouldDachsBeStarted;
92
+ private checkAlternativeActuator;
88
93
  }
@@ -107,6 +107,7 @@ class Dachs {
107
107
  'warmWaterPump',
108
108
  'heatingRod',
109
109
  'blockDachsStart',
110
+ 'warmWaterDachsAlternativeActuator',
110
111
  ]));
111
112
  }
112
113
  /** @inheritDoc */
@@ -204,6 +205,7 @@ class Dachs {
204
205
  onBatteryLevelChange(action) {
205
206
  const shouldDachsBeStarted = this.shouldDachsBeStarted(action);
206
207
  this.checkHeatingRod(action);
208
+ this.checkAlternativeActuator(shouldDachsBeStarted, action);
207
209
  if (!shouldDachsBeStarted) {
208
210
  return;
209
211
  }
@@ -212,48 +214,52 @@ class Dachs {
212
214
  this.setActuator(setStateCommand);
213
215
  }
214
216
  onTempChange(action) {
215
- var _a;
217
+ var _a, _b;
216
218
  if (this.warmWaterPump === undefined) {
217
219
  // We have no control over the warm water pump --> nothing to do
218
220
  return;
219
221
  }
220
222
  const wwTemp = this._tempWarmWater;
221
223
  const heatStorageTemp = this._tempHeatStorage;
222
- let desiredState = false;
224
+ let desiredWwPumpState = false;
223
225
  let reason = '';
224
- if (this._dachsOn) {
225
- desiredState = true;
226
+ if (((_a = this.warmWaterDachsAlternativeActuator) === null || _a === void 0 ? void 0 : _a.actuatorOn) === true) {
227
+ desiredWwPumpState = false;
228
+ reason = 'Alternative heating source is on';
229
+ }
230
+ else if (this._dachsOn) {
231
+ desiredWwPumpState = true;
226
232
  reason = 'Dachs is on anyways';
227
233
  }
228
234
  else if (wwTemp > heatStorageTemp) {
229
- desiredState = false;
235
+ desiredWwPumpState = false;
230
236
  reason = `Temperature of warm water pump ${wwTemp}°C is higher than temperature of heat storage ${heatStorageTemp}°C`;
231
237
  }
232
- else if (((_a = this.blockDachsStart) === null || _a === void 0 ? void 0 : _a.actuatorOn) === false) {
233
- desiredState = true;
238
+ else if (((_b = this.blockDachsStart) === null || _b === void 0 ? void 0 : _b.actuatorOn) === false) {
239
+ desiredWwPumpState = true;
234
240
  reason = 'Dachs is not blocked --> lowering storage temp might trigger it.';
235
241
  }
236
242
  else if (wwTemp > this.settings.warmWaterDesiredMinTemp + 3) {
237
- desiredState = false;
243
+ desiredWwPumpState = false;
238
244
  reason = `Temperature of warm water pump ${wwTemp}°C is above desired minimum temperature ${this.settings.warmWaterDesiredMinTemp}°C`;
239
245
  }
240
246
  else if (heatStorageTemp < this.settings.warmWaterDesiredMinTemp - 4) {
241
- desiredState = false;
247
+ desiredWwPumpState = false;
242
248
  reason = `Temperature of heat storage ${heatStorageTemp}°C is too low to heat water.`;
243
249
  }
244
250
  else if (wwTemp < this.settings.warmWaterDesiredMinTemp) {
245
- desiredState = true;
251
+ desiredWwPumpState = true;
246
252
  reason = `Temperature of warm water pump ${wwTemp}°C is lower than desired minimum temperature ${this.settings.warmWaterDesiredMinTemp}°C`;
247
253
  }
248
254
  else {
249
255
  // We are somewhere between states, let's not change anything
250
256
  return;
251
257
  }
252
- if (desiredState === this.warmWaterPump.actuatorOn) {
258
+ if (desiredWwPumpState === this.warmWaterPump.actuatorOn) {
253
259
  // Nothing to do
254
260
  return;
255
261
  }
256
- const setAction = new models_1.ActuatorSetStateCommand(action, desiredState, reason, null);
262
+ const setAction = new models_1.ActuatorSetStateCommand(action, desiredWwPumpState, reason, null);
257
263
  this.warmWaterPump.setActuator(setAction);
258
264
  }
259
265
  checkHeatingRod(action) {
@@ -300,5 +306,27 @@ class Dachs {
300
306
  }
301
307
  return true;
302
308
  }
309
+ checkAlternativeActuator(shouldDachsBeStarted, action) {
310
+ var _a, _b;
311
+ if (!this.warmWaterDachsAlternativeActuator) {
312
+ return;
313
+ }
314
+ let desiredState = false;
315
+ let reason = 'Dachs is allowed to run --> Block alternative heating source';
316
+ if (shouldDachsBeStarted || this._dachsOn) {
317
+ reason = 'Dachs is running or should be started';
318
+ desiredState = false;
319
+ }
320
+ else if (((_a = this.blockDachsStart) === null || _a === void 0 ? void 0 : _a.actuatorOn) === true || ((_b = this.blockDachsStart) === null || _b === void 0 ? void 0 : _b.queuedValue) === true) {
321
+ reason = 'Dachs is blocked --> Allow Alternative Heating Source';
322
+ desiredState = true;
323
+ }
324
+ if (this.warmWaterDachsAlternativeActuator.actuatorOn === desiredState) {
325
+ return;
326
+ }
327
+ const command = new models_1.ActuatorSetStateCommand(action, desiredState, reason, null);
328
+ command.overrideCommandSource = models_1.CommandSource.Force;
329
+ this.warmWaterDachsAlternativeActuator.setActuator(command);
330
+ }
303
331
  }
304
332
  exports.Dachs = Dachs;