hoffmation-base 3.0.0-alpha.99 → 3.0.0-beta.0
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.
- package/lib/models/action/actuatorChangeAction.d.ts +13 -0
- package/lib/models/action/actuatorChangeAction.js +14 -0
- package/lib/models/action/index.d.ts +1 -0
- package/lib/models/action/index.js +3 -1
- package/lib/models/command/commandType.d.ts +1 -0
- package/lib/models/command/commandType.js +1 -0
- package/lib/server/devices/dachs/dachs.d.ts +2 -0
- package/lib/server/devices/dachs/dachs.js +26 -13
- package/lib/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { BaseAction } from './baseAction';
|
|
2
|
+
import { CommandType } from '../command';
|
|
3
|
+
import { iActuator } from '../../server';
|
|
4
|
+
export declare class ActuatorChangeAction extends BaseAction {
|
|
5
|
+
/** @inheritDoc */
|
|
6
|
+
type: CommandType;
|
|
7
|
+
/**
|
|
8
|
+
* The new state
|
|
9
|
+
* @type {boolean}
|
|
10
|
+
*/
|
|
11
|
+
readonly actuatorOn: boolean;
|
|
12
|
+
constructor(device: iActuator);
|
|
13
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ActuatorChangeAction = void 0;
|
|
4
|
+
const baseAction_1 = require("./baseAction");
|
|
5
|
+
const command_1 = require("../command");
|
|
6
|
+
class ActuatorChangeAction extends baseAction_1.BaseAction {
|
|
7
|
+
constructor(device) {
|
|
8
|
+
super(undefined, `New Actuator state (${device.actuatorOn}) received`);
|
|
9
|
+
/** @inheritDoc */
|
|
10
|
+
this.type = command_1.CommandType.ActuatorChangeAction;
|
|
11
|
+
this.actuatorOn = device.actuatorOn;
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
exports.ActuatorChangeAction = ActuatorChangeAction;
|
|
@@ -5,5 +5,6 @@ export * from './presenceGroupLastLeftAction';
|
|
|
5
5
|
export * from './presenceGroupFirstEnterAction';
|
|
6
6
|
export * from './shutterPositionChangedAction';
|
|
7
7
|
export * from './temperatureSensorChangeAction';
|
|
8
|
+
export { ActuatorChangeAction } from './actuatorChangeAction';
|
|
8
9
|
export { BatteryLevelChangeAction } from './batteryLevelChangeAction';
|
|
9
10
|
export { PresenceGroupAnyMovementAction } from './presenceGroupAnyMovementAction';
|
|
@@ -14,7 +14,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
exports.PresenceGroupAnyMovementAction = exports.BatteryLevelChangeAction = exports.BaseAction = void 0;
|
|
17
|
+
exports.PresenceGroupAnyMovementAction = exports.BatteryLevelChangeAction = exports.ActuatorChangeAction = exports.BaseAction = void 0;
|
|
18
18
|
var baseAction_1 = require("./baseAction");
|
|
19
19
|
Object.defineProperty(exports, "BaseAction", { enumerable: true, get: function () { return baseAction_1.BaseAction; } });
|
|
20
20
|
__exportStar(require("./humiditySensorChangeAction"), exports);
|
|
@@ -23,6 +23,8 @@ __exportStar(require("./presenceGroupLastLeftAction"), exports);
|
|
|
23
23
|
__exportStar(require("./presenceGroupFirstEnterAction"), exports);
|
|
24
24
|
__exportStar(require("./shutterPositionChangedAction"), exports);
|
|
25
25
|
__exportStar(require("./temperatureSensorChangeAction"), exports);
|
|
26
|
+
var actuatorChangeAction_1 = require("./actuatorChangeAction");
|
|
27
|
+
Object.defineProperty(exports, "ActuatorChangeAction", { enumerable: true, get: function () { return actuatorChangeAction_1.ActuatorChangeAction; } });
|
|
26
28
|
var batteryLevelChangeAction_1 = require("./batteryLevelChangeAction");
|
|
27
29
|
Object.defineProperty(exports, "BatteryLevelChangeAction", { enumerable: true, get: function () { return batteryLevelChangeAction_1.BatteryLevelChangeAction; } });
|
|
28
30
|
var presenceGroupAnyMovementAction_1 = require("./presenceGroupAnyMovementAction");
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
export declare enum CommandType {
|
|
2
|
+
ActuatorChangeAction = "ActuatorChangeAction",
|
|
2
3
|
BatteryManagerLevelChangeAction = "BatteryManagerLevelChangeAction",
|
|
3
4
|
BlockAutomaticLiftBlockCommand = "BlockAutomaticLiftBlockCommand",
|
|
4
5
|
BlockAutomaticCommand = "BlockAutomaticCommand",
|
|
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.CommandType = void 0;
|
|
4
4
|
var CommandType;
|
|
5
5
|
(function (CommandType) {
|
|
6
|
+
CommandType["ActuatorChangeAction"] = "ActuatorChangeAction";
|
|
6
7
|
CommandType["BatteryManagerLevelChangeAction"] = "BatteryManagerLevelChangeAction";
|
|
7
8
|
CommandType["BlockAutomaticLiftBlockCommand"] = "BlockAutomaticLiftBlockCommand";
|
|
8
9
|
CommandType["BlockAutomaticCommand"] = "BlockAutomaticCommand";
|
|
@@ -86,8 +86,10 @@ export declare class Dachs implements iBaseDevice, iActuator {
|
|
|
86
86
|
* @param {BatteryLevelChangeAction} action - The action containing the new level
|
|
87
87
|
*/
|
|
88
88
|
private onBatteryLevelChange;
|
|
89
|
+
private checkAllDesiredStates;
|
|
89
90
|
private onTempChange;
|
|
90
91
|
private checkHeatingRod;
|
|
91
92
|
private shouldDachsBeStarted;
|
|
92
93
|
private checkAlternativeActuator;
|
|
94
|
+
private onDachsRunningStateChange;
|
|
93
95
|
}
|
|
@@ -141,11 +141,17 @@ class Dachs {
|
|
|
141
141
|
this._influxClient.addMeasurementToQueue(key, value ? '1' : '0');
|
|
142
142
|
}
|
|
143
143
|
this._influxClient.flush();
|
|
144
|
+
const isDachsOn = this.fetchedData['Hka_Mw1.usDrehzahl'] >= 1;
|
|
145
|
+
const didDachsChange = this._dachsOn !== isDachsOn;
|
|
146
|
+
this._dachsOn = isDachsOn;
|
|
144
147
|
this._dachsOn = this.fetchedData['Hka_Mw1.usDrehzahl'] >= 1;
|
|
145
148
|
this._tempWarmWater = (_a = this.fetchedData['Hka_Mw1.Temp.sbZS_Warmwasser']) !== null && _a !== void 0 ? _a : 0;
|
|
146
149
|
this.warmWaterSensor.update(this._tempWarmWater);
|
|
147
150
|
this._tempHeatStorage = (_b = this.fetchedData['Hka_Mw1.Temp.sbFuehler1']) !== null && _b !== void 0 ? _b : 0;
|
|
148
151
|
this.heatStorageTempSensor.update(this._tempHeatStorage);
|
|
152
|
+
if (didDachsChange) {
|
|
153
|
+
this.onDachsRunningStateChange(new models_1.ActuatorChangeAction(this));
|
|
154
|
+
}
|
|
149
155
|
this.persist();
|
|
150
156
|
})
|
|
151
157
|
.catch((error) => {
|
|
@@ -208,8 +214,11 @@ class Dachs {
|
|
|
208
214
|
* @param {BatteryLevelChangeAction} action - The action containing the new level
|
|
209
215
|
*/
|
|
210
216
|
onBatteryLevelChange(action) {
|
|
211
|
-
|
|
212
|
-
|
|
217
|
+
this.checkAllDesiredStates(action, action.newLevel);
|
|
218
|
+
}
|
|
219
|
+
checkAllDesiredStates(action, batteryLevel) {
|
|
220
|
+
const shouldDachsBeStarted = this.shouldDachsBeStarted(action, batteryLevel);
|
|
221
|
+
this.checkHeatingRod(action, batteryLevel);
|
|
213
222
|
this.checkAlternativeActuator(shouldDachsBeStarted, action);
|
|
214
223
|
if (!shouldDachsBeStarted) {
|
|
215
224
|
return;
|
|
@@ -267,34 +276,34 @@ class Dachs {
|
|
|
267
276
|
const setAction = new models_1.ActuatorSetStateCommand(action, desiredWwPumpState, reason, null);
|
|
268
277
|
this.warmWaterPump.setActuator(setAction);
|
|
269
278
|
}
|
|
270
|
-
checkHeatingRod(action) {
|
|
279
|
+
checkHeatingRod(action, batteryLevel) {
|
|
271
280
|
if (this.heatingRod === undefined) {
|
|
272
281
|
return;
|
|
273
282
|
}
|
|
274
|
-
const shouldBeOff =
|
|
283
|
+
const shouldBeOff = batteryLevel < this.settings.batteryLevelHeatingRodThreshold;
|
|
275
284
|
if (this.heatingRod.actuatorOn !== shouldBeOff) {
|
|
276
285
|
return;
|
|
277
286
|
}
|
|
278
|
-
const setAction = new models_1.ActuatorSetStateCommand(action, !shouldBeOff, `Battery reached ${
|
|
287
|
+
const setAction = new models_1.ActuatorSetStateCommand(action, !shouldBeOff, `Battery reached ${batteryLevel}%, heating rod should be turned ${shouldBeOff ? 'off' : 'on'}`, null);
|
|
279
288
|
this.heatingRod.setActuator(setAction);
|
|
280
289
|
}
|
|
281
|
-
shouldDachsBeStarted(action) {
|
|
290
|
+
shouldDachsBeStarted(action, batteryLevel) {
|
|
282
291
|
var _a;
|
|
283
292
|
if (this.blockDachsStart !== undefined) {
|
|
284
|
-
if (
|
|
285
|
-
const blockAction = new models_1.ActuatorSetStateCommand(action, true, `Battery reached ${
|
|
293
|
+
if (batteryLevel > this.settings.batteryLevelPreventStartThreshold) {
|
|
294
|
+
const blockAction = new models_1.ActuatorSetStateCommand(action, true, `Battery reached ${batteryLevel}%, Dachs should not run any more`, null);
|
|
286
295
|
blockAction.overrideCommandSource = models_1.CommandSource.Force;
|
|
287
296
|
this.blockDachsStart.setActuator(blockAction);
|
|
288
297
|
return false;
|
|
289
298
|
}
|
|
290
|
-
else if (
|
|
291
|
-
const liftAction = new models_1.ActuatorSetStateCommand(action, false, `Battery reached ${
|
|
299
|
+
else if (batteryLevel < this.settings.batteryLevelAllowStartThreshold) {
|
|
300
|
+
const liftAction = new models_1.ActuatorSetStateCommand(action, false, `Battery reached ${batteryLevel}%, Dachs is now allowed to run if needed`, null);
|
|
292
301
|
this.blockDachsStart.setActuator(liftAction);
|
|
293
302
|
}
|
|
294
303
|
else if (((_a = services_1.SettingsService.settings.heaterSettings) === null || _a === void 0 ? void 0 : _a.mode) === config_1.HeatingMode.Winter &&
|
|
295
304
|
this.heatStorageTempSensor.temperatureSensor.temperature < 60 &&
|
|
296
305
|
services_1.Utils.dateByTimeSpan(21, 30) < new Date()) {
|
|
297
|
-
const liftWinterAction = new models_1.ActuatorSetStateCommand(action, false, `Battery at ${
|
|
306
|
+
const liftWinterAction = new models_1.ActuatorSetStateCommand(action, false, `Battery at ${batteryLevel}% but it is winter, we are nearing night and heat storage is kinda cold: Dachs is now allowed to run if needed`, null);
|
|
298
307
|
this.blockDachsStart.setActuator(liftWinterAction);
|
|
299
308
|
}
|
|
300
309
|
else if (this.blockDachsStart.actuatorOn) {
|
|
@@ -308,11 +317,11 @@ class Dachs {
|
|
|
308
317
|
}
|
|
309
318
|
const dayType = services_1.TimeCallbackService.dayType(new services_1.SunTimeOffsets());
|
|
310
319
|
if ((dayType === models_1.TimeOfDay.Daylight || dayType === models_1.TimeOfDay.BeforeSunrise) &&
|
|
311
|
-
|
|
320
|
+
batteryLevel > this.settings.batteryLevelTurnOnThreshold) {
|
|
312
321
|
// It is daytime (maybe solar power) and it is no critical battery level
|
|
313
322
|
return false;
|
|
314
323
|
}
|
|
315
|
-
if (
|
|
324
|
+
if (batteryLevel > this.settings.batteryLevelBeforeNightTurnOnThreshold) {
|
|
316
325
|
// It is not daylight but battery level is high enough
|
|
317
326
|
return false;
|
|
318
327
|
}
|
|
@@ -340,5 +349,9 @@ class Dachs {
|
|
|
340
349
|
command.overrideCommandSource = models_1.CommandSource.Force;
|
|
341
350
|
this.warmWaterDachsAlternativeActuator.setActuator(command);
|
|
342
351
|
}
|
|
352
|
+
onDachsRunningStateChange(runStateChange) {
|
|
353
|
+
var _a, _b;
|
|
354
|
+
this.checkAllDesiredStates(runStateChange, (_b = (_a = devices_1.Devices.energymanager) === null || _a === void 0 ? void 0 : _a.batteryLevel) !== null && _b !== void 0 ? _b : 0);
|
|
355
|
+
}
|
|
343
356
|
}
|
|
344
357
|
exports.Dachs = Dachs;
|