hoffmation-base 3.0.0-alpha.95 → 3.0.0-alpha.97
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 */
|
|
@@ -158,10 +159,14 @@ class Dachs {
|
|
|
158
159
|
/** @inheritDoc */
|
|
159
160
|
setActuator(c) {
|
|
160
161
|
devices_1.LampUtils.setActuator(this, c);
|
|
161
|
-
if (c.on
|
|
162
|
-
|
|
163
|
-
this.
|
|
162
|
+
if (!c.on ||
|
|
163
|
+
!this.warmWaterPump ||
|
|
164
|
+
(this.queuedValue === false && !this._dachsOn) ||
|
|
165
|
+
this.heatStorageTempSensor.temperatureSensor.temperature < this.warmWaterSensor.temperatureSensor.temperature) {
|
|
166
|
+
return;
|
|
164
167
|
}
|
|
168
|
+
const startPumpCommand = new models_1.ActuatorSetStateCommand(c, true, 'Dachs is starting/on');
|
|
169
|
+
this.warmWaterPump.setActuator(startPumpCommand);
|
|
165
170
|
}
|
|
166
171
|
/** @inheritDoc */
|
|
167
172
|
toggleActuator(c) {
|
|
@@ -204,6 +209,7 @@ class Dachs {
|
|
|
204
209
|
onBatteryLevelChange(action) {
|
|
205
210
|
const shouldDachsBeStarted = this.shouldDachsBeStarted(action);
|
|
206
211
|
this.checkHeatingRod(action);
|
|
212
|
+
this.checkAlternativeActuator(shouldDachsBeStarted, action);
|
|
207
213
|
if (!shouldDachsBeStarted) {
|
|
208
214
|
return;
|
|
209
215
|
}
|
|
@@ -212,48 +218,52 @@ class Dachs {
|
|
|
212
218
|
this.setActuator(setStateCommand);
|
|
213
219
|
}
|
|
214
220
|
onTempChange(action) {
|
|
215
|
-
var _a;
|
|
221
|
+
var _a, _b;
|
|
216
222
|
if (this.warmWaterPump === undefined) {
|
|
217
223
|
// We have no control over the warm water pump --> nothing to do
|
|
218
224
|
return;
|
|
219
225
|
}
|
|
220
226
|
const wwTemp = this._tempWarmWater;
|
|
221
227
|
const heatStorageTemp = this._tempHeatStorage;
|
|
222
|
-
let
|
|
228
|
+
let desiredWwPumpState = false;
|
|
223
229
|
let reason = '';
|
|
224
|
-
if (this.
|
|
225
|
-
|
|
230
|
+
if (((_a = this.warmWaterDachsAlternativeActuator) === null || _a === void 0 ? void 0 : _a.actuatorOn) === true) {
|
|
231
|
+
desiredWwPumpState = false;
|
|
232
|
+
reason = 'Alternative heating source is on';
|
|
233
|
+
}
|
|
234
|
+
else if (this._dachsOn) {
|
|
235
|
+
desiredWwPumpState = true;
|
|
226
236
|
reason = 'Dachs is on anyways';
|
|
227
237
|
}
|
|
228
238
|
else if (wwTemp > heatStorageTemp) {
|
|
229
|
-
|
|
239
|
+
desiredWwPumpState = false;
|
|
230
240
|
reason = `Temperature of warm water pump ${wwTemp}°C is higher than temperature of heat storage ${heatStorageTemp}°C`;
|
|
231
241
|
}
|
|
232
|
-
else if (((
|
|
233
|
-
|
|
242
|
+
else if (((_b = this.blockDachsStart) === null || _b === void 0 ? void 0 : _b.actuatorOn) === false) {
|
|
243
|
+
desiredWwPumpState = true;
|
|
234
244
|
reason = 'Dachs is not blocked --> lowering storage temp might trigger it.';
|
|
235
245
|
}
|
|
236
246
|
else if (wwTemp > this.settings.warmWaterDesiredMinTemp + 3) {
|
|
237
|
-
|
|
247
|
+
desiredWwPumpState = false;
|
|
238
248
|
reason = `Temperature of warm water pump ${wwTemp}°C is above desired minimum temperature ${this.settings.warmWaterDesiredMinTemp}°C`;
|
|
239
249
|
}
|
|
240
250
|
else if (heatStorageTemp < this.settings.warmWaterDesiredMinTemp - 4) {
|
|
241
|
-
|
|
251
|
+
desiredWwPumpState = false;
|
|
242
252
|
reason = `Temperature of heat storage ${heatStorageTemp}°C is too low to heat water.`;
|
|
243
253
|
}
|
|
244
254
|
else if (wwTemp < this.settings.warmWaterDesiredMinTemp) {
|
|
245
|
-
|
|
255
|
+
desiredWwPumpState = true;
|
|
246
256
|
reason = `Temperature of warm water pump ${wwTemp}°C is lower than desired minimum temperature ${this.settings.warmWaterDesiredMinTemp}°C`;
|
|
247
257
|
}
|
|
248
258
|
else {
|
|
249
259
|
// We are somewhere between states, let's not change anything
|
|
250
260
|
return;
|
|
251
261
|
}
|
|
252
|
-
if (
|
|
262
|
+
if (desiredWwPumpState === this.warmWaterPump.actuatorOn) {
|
|
253
263
|
// Nothing to do
|
|
254
264
|
return;
|
|
255
265
|
}
|
|
256
|
-
const setAction = new models_1.ActuatorSetStateCommand(action,
|
|
266
|
+
const setAction = new models_1.ActuatorSetStateCommand(action, desiredWwPumpState, reason, null);
|
|
257
267
|
this.warmWaterPump.setActuator(setAction);
|
|
258
268
|
}
|
|
259
269
|
checkHeatingRod(action) {
|
|
@@ -300,5 +310,27 @@ class Dachs {
|
|
|
300
310
|
}
|
|
301
311
|
return true;
|
|
302
312
|
}
|
|
313
|
+
checkAlternativeActuator(shouldDachsBeStarted, action) {
|
|
314
|
+
var _a, _b;
|
|
315
|
+
if (!this.warmWaterDachsAlternativeActuator) {
|
|
316
|
+
return;
|
|
317
|
+
}
|
|
318
|
+
let desiredState = false;
|
|
319
|
+
let reason = 'Dachs is allowed to run --> Block alternative heating source';
|
|
320
|
+
if (shouldDachsBeStarted || this._dachsOn) {
|
|
321
|
+
reason = 'Dachs is running or should be started';
|
|
322
|
+
desiredState = false;
|
|
323
|
+
}
|
|
324
|
+
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) {
|
|
325
|
+
reason = 'Dachs is blocked --> Allow Alternative Heating Source';
|
|
326
|
+
desiredState = true;
|
|
327
|
+
}
|
|
328
|
+
if (this.warmWaterDachsAlternativeActuator.actuatorOn === desiredState) {
|
|
329
|
+
return;
|
|
330
|
+
}
|
|
331
|
+
const command = new models_1.ActuatorSetStateCommand(action, desiredState, reason, null);
|
|
332
|
+
command.overrideCommandSource = models_1.CommandSource.Force;
|
|
333
|
+
this.warmWaterDachsAlternativeActuator.setActuator(command);
|
|
334
|
+
}
|
|
303
335
|
}
|
|
304
336
|
exports.Dachs = Dachs;
|