hoffmation-base 3.0.0-alpha.55 → 3.0.0-alpha.57
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.
|
@@ -12,6 +12,18 @@ export declare class DachsDeviceSettings extends ActuatorSettings {
|
|
|
12
12
|
* Uses {@link iBatteryDevice.addBatteryLevelCallback}
|
|
13
13
|
*/
|
|
14
14
|
batteryLevelTurnOnThreshold: number;
|
|
15
|
+
/**
|
|
16
|
+
* Defines the battery level below which the dachs should be allowed to start
|
|
17
|
+
*/
|
|
18
|
+
batteryLevelAllowStartThreshold: number;
|
|
19
|
+
/**
|
|
20
|
+
* Defines the battery level above which the dachs should be prevented from starting/running.
|
|
21
|
+
*/
|
|
22
|
+
batteryLevelPreventStartThreshold: number;
|
|
23
|
+
/**
|
|
24
|
+
* Defines the desired minimum temperature for warm water.
|
|
25
|
+
*/
|
|
26
|
+
warmWaterDesiredMinTemp: number;
|
|
15
27
|
fromPartialObject(data: Partial<DachsDeviceSettings>): void;
|
|
16
28
|
protected toJSON(): Partial<DachsDeviceSettings>;
|
|
17
29
|
}
|
|
@@ -18,11 +18,27 @@ class DachsDeviceSettings extends actuatorSettings_1.ActuatorSettings {
|
|
|
18
18
|
* Uses {@link iBatteryDevice.addBatteryLevelCallback}
|
|
19
19
|
*/
|
|
20
20
|
this.batteryLevelTurnOnThreshold = -1;
|
|
21
|
+
/**
|
|
22
|
+
* Defines the battery level below which the dachs should be allowed to start
|
|
23
|
+
*/
|
|
24
|
+
this.batteryLevelAllowStartThreshold = 50;
|
|
25
|
+
/**
|
|
26
|
+
* Defines the battery level above which the dachs should be prevented from starting/running.
|
|
27
|
+
*/
|
|
28
|
+
this.batteryLevelPreventStartThreshold = 70;
|
|
29
|
+
/**
|
|
30
|
+
* Defines the desired minimum temperature for warm water.
|
|
31
|
+
*/
|
|
32
|
+
this.warmWaterDesiredMinTemp = 45;
|
|
21
33
|
}
|
|
22
34
|
fromPartialObject(data) {
|
|
23
|
-
var _a, _b;
|
|
35
|
+
var _a, _b, _c, _d, _e;
|
|
24
36
|
this.refreshInterval = (_a = data.refreshInterval) !== null && _a !== void 0 ? _a : this.refreshInterval;
|
|
25
37
|
this.batteryLevelTurnOnThreshold = (_b = data.batteryLevelTurnOnThreshold) !== null && _b !== void 0 ? _b : this.batteryLevelTurnOnThreshold;
|
|
38
|
+
this.batteryLevelPreventStartThreshold =
|
|
39
|
+
(_c = data.batteryLevelPreventStartThreshold) !== null && _c !== void 0 ? _c : this.batteryLevelPreventStartThreshold;
|
|
40
|
+
this.batteryLevelAllowStartThreshold = (_d = data.batteryLevelAllowStartThreshold) !== null && _d !== void 0 ? _d : this.batteryLevelAllowStartThreshold;
|
|
41
|
+
this.warmWaterDesiredMinTemp = (_e = data.warmWaterDesiredMinTemp) !== null && _e !== void 0 ? _e : this.warmWaterDesiredMinTemp;
|
|
26
42
|
super.fromPartialObject(data);
|
|
27
43
|
}
|
|
28
44
|
toJSON() {
|
|
@@ -22,6 +22,14 @@ export declare class Dachs implements iBaseDevice, iActuator {
|
|
|
22
22
|
* A reference to the Temperature measuring heat storage temperature
|
|
23
23
|
*/
|
|
24
24
|
readonly heatStorageTempSensor: DachsTemperatureSensor;
|
|
25
|
+
/**
|
|
26
|
+
* An external actuator controlling the warm water pump
|
|
27
|
+
*/
|
|
28
|
+
warmWaterPump?: iActuator;
|
|
29
|
+
/**
|
|
30
|
+
* An external actuator to prevent the Dachs from starting.
|
|
31
|
+
*/
|
|
32
|
+
blockDachsStart?: iActuator;
|
|
25
33
|
private readonly client;
|
|
26
34
|
private readonly config;
|
|
27
35
|
/** @inheritDoc */
|
|
@@ -70,4 +78,5 @@ export declare class Dachs implements iBaseDevice, iActuator {
|
|
|
70
78
|
* @param {BatteryLevelChangeAction} action - The action containing the new level
|
|
71
79
|
*/
|
|
72
80
|
private onBatteryLevelChange;
|
|
81
|
+
private onTempChange;
|
|
73
82
|
}
|
|
@@ -62,6 +62,8 @@ class Dachs {
|
|
|
62
62
|
const energyManager = devices_1.Devices.energymanager;
|
|
63
63
|
energyManager.addBatteryLevelCallback(this.onBatteryLevelChange.bind(this));
|
|
64
64
|
}
|
|
65
|
+
this.warmWaterSensor.addTempChangeCallback(this.onTempChange.bind(this));
|
|
66
|
+
this.heatStorageTempSensor.addTempChangeCallback(this.onTempChange.bind(this));
|
|
65
67
|
}
|
|
66
68
|
/** @inheritDoc */
|
|
67
69
|
get info() {
|
|
@@ -95,7 +97,16 @@ class Dachs {
|
|
|
95
97
|
}
|
|
96
98
|
/** @inheritDoc */
|
|
97
99
|
toJSON() {
|
|
98
|
-
return services_1.Utils.jsonFilter(lodash_1.default.omit(this, [
|
|
100
|
+
return services_1.Utils.jsonFilter(lodash_1.default.omit(this, [
|
|
101
|
+
'room',
|
|
102
|
+
'client',
|
|
103
|
+
'config',
|
|
104
|
+
'_influxClient',
|
|
105
|
+
'warmWaterSensor',
|
|
106
|
+
'heatStorageTempSensor',
|
|
107
|
+
'warmWaterPump',
|
|
108
|
+
'blockDachsStart',
|
|
109
|
+
]));
|
|
99
110
|
}
|
|
100
111
|
/** @inheritDoc */
|
|
101
112
|
persistDeviceInfo() {
|
|
@@ -186,7 +197,23 @@ class Dachs {
|
|
|
186
197
|
* @param {BatteryLevelChangeAction} action - The action containing the new level
|
|
187
198
|
*/
|
|
188
199
|
onBatteryLevelChange(action) {
|
|
189
|
-
if (this.
|
|
200
|
+
if (this.blockDachsStart !== undefined) {
|
|
201
|
+
if (action.newLevel > this.settings.batteryLevelPreventStartThreshold) {
|
|
202
|
+
const blockAction = new models_1.ActuatorSetStateCommand(action, true, `Battery reached ${action.newLevel}%, Dachs should not run any more`, null);
|
|
203
|
+
blockAction.overrideCommandSource = models_1.CommandSource.Force;
|
|
204
|
+
this.blockDachsStart.setActuator(blockAction);
|
|
205
|
+
return;
|
|
206
|
+
}
|
|
207
|
+
else if (action.newLevel < this.settings.batteryLevelAllowStartThreshold) {
|
|
208
|
+
const liftAction = new models_1.ActuatorSetStateCommand(action, false, `Battery reached ${action.newLevel}%, Dachs is now allowed to run if needed`, null);
|
|
209
|
+
this.blockDachsStart.setActuator(liftAction);
|
|
210
|
+
}
|
|
211
|
+
else if (this.blockDachsStart.actuatorOn) {
|
|
212
|
+
// We haven't reached the lower threshold yet --> nothing to do
|
|
213
|
+
return;
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
if (this._dachsOn || this.settings.batteryLevelTurnOnThreshold > action.newLevel) {
|
|
190
217
|
// We are already running, or battery level is high enough.
|
|
191
218
|
return;
|
|
192
219
|
}
|
|
@@ -194,5 +221,42 @@ class Dachs {
|
|
|
194
221
|
setStateCommand.overrideCommandSource = models_1.CommandSource.Force;
|
|
195
222
|
this.setActuator(setStateCommand);
|
|
196
223
|
}
|
|
224
|
+
onTempChange(action) {
|
|
225
|
+
if (this.warmWaterPump === undefined) {
|
|
226
|
+
// We have no control over the warm water pump --> nothing to do
|
|
227
|
+
return;
|
|
228
|
+
}
|
|
229
|
+
const wwTemp = this._tempWarmWater;
|
|
230
|
+
const heatStorageTemp = this._tempHeatStorage;
|
|
231
|
+
let desiredState = false;
|
|
232
|
+
let reason = '';
|
|
233
|
+
if (wwTemp > this.settings.warmWaterDesiredMinTemp + 3) {
|
|
234
|
+
desiredState = false;
|
|
235
|
+
reason = `Temperature of warm water pump ${wwTemp}°C is above desired minimum temperature ${this.settings.warmWaterDesiredMinTemp}°C`;
|
|
236
|
+
}
|
|
237
|
+
else if (wwTemp > heatStorageTemp) {
|
|
238
|
+
desiredState = false;
|
|
239
|
+
reason = `Temperature of warm water pump ${wwTemp}°C is higher than temperature of heat storage ${heatStorageTemp}°C`;
|
|
240
|
+
}
|
|
241
|
+
else if (heatStorageTemp < this.settings.warmWaterDesiredMinTemp - 4) {
|
|
242
|
+
desiredState = false;
|
|
243
|
+
reason = `Temperature of heat storage ${heatStorageTemp}°C is too low to heat water.`;
|
|
244
|
+
}
|
|
245
|
+
else if (wwTemp < this.settings.warmWaterDesiredMinTemp) {
|
|
246
|
+
desiredState = true;
|
|
247
|
+
reason = `Temperature of warm water pump ${wwTemp}°C is lower than desired minimum temperature ${this.settings.warmWaterDesiredMinTemp}°C`;
|
|
248
|
+
}
|
|
249
|
+
else {
|
|
250
|
+
// We are somewhere between states, let's not change anything
|
|
251
|
+
return;
|
|
252
|
+
}
|
|
253
|
+
if (desiredState === this.warmWaterPump.actuatorOn) {
|
|
254
|
+
// Nothing to do
|
|
255
|
+
return;
|
|
256
|
+
}
|
|
257
|
+
const setAction = new models_1.ActuatorSetStateCommand(action, desiredState, reason, null);
|
|
258
|
+
setAction.overrideCommandSource = models_1.CommandSource.Force;
|
|
259
|
+
this.warmWaterPump.setActuator(setAction);
|
|
260
|
+
}
|
|
197
261
|
}
|
|
198
262
|
exports.Dachs = Dachs;
|