hoffmation-base 3.0.0-alpha.83 → 3.0.0-alpha.84

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.
@@ -20,6 +20,10 @@ export declare class DachsDeviceSettings extends ActuatorSettings {
20
20
  * Defines the battery level above which the dachs should be prevented from starting/running.
21
21
  */
22
22
  batteryLevelPreventStartThreshold: number;
23
+ /**
24
+ * Defines the battery level above which the external heating rod should be turned on
25
+ */
26
+ batteryLevelHeatingRodThreshold: number;
23
27
  /**
24
28
  * Defines the desired minimum temperature for warm water.
25
29
  */
@@ -26,6 +26,10 @@ class DachsDeviceSettings extends actuatorSettings_1.ActuatorSettings {
26
26
  * Defines the battery level above which the dachs should be prevented from starting/running.
27
27
  */
28
28
  this.batteryLevelPreventStartThreshold = 70;
29
+ /**
30
+ * Defines the battery level above which the external heating rod should be turned on
31
+ */
32
+ this.batteryLevelHeatingRodThreshold = 80;
29
33
  /**
30
34
  * Defines the desired minimum temperature for warm water.
31
35
  */
@@ -26,6 +26,10 @@ export declare class Dachs implements iBaseDevice, iActuator {
26
26
  * An external actuator controlling the warm water pump
27
27
  */
28
28
  warmWaterPump?: iActuator;
29
+ /**
30
+ * An external actuator controlling the heat rod.
31
+ */
32
+ heatingRod?: iActuator;
29
33
  /**
30
34
  * An external actuator to prevent the Dachs from starting.
31
35
  */
@@ -79,4 +83,5 @@ export declare class Dachs implements iBaseDevice, iActuator {
79
83
  */
80
84
  private onBatteryLevelChange;
81
85
  private onTempChange;
86
+ private checkHeatingRod;
82
87
  }
@@ -12,6 +12,7 @@ const dachsSettings_1 = require("../../../models/deviceSettings/dachsSettings");
12
12
  const lib_1 = require("./lib");
13
13
  const dachsTemperatureSensor_1 = require("./dachsTemperatureSensor");
14
14
  const blockAutomaticHandler_1 = require("../../services/blockAutomaticHandler");
15
+ const config_1 = require("../../config");
15
16
  class Dachs {
16
17
  /** @inheritDoc */
17
18
  get customName() {
@@ -105,6 +106,7 @@ class Dachs {
105
106
  'warmWaterSensor',
106
107
  'heatStorageTempSensor',
107
108
  'warmWaterPump',
109
+ 'heatingRod',
108
110
  'blockDachsStart',
109
111
  ]));
110
112
  }
@@ -197,6 +199,7 @@ class Dachs {
197
199
  * @param {BatteryLevelChangeAction} action - The action containing the new level
198
200
  */
199
201
  onBatteryLevelChange(action) {
202
+ this.checkHeatingRod(action);
200
203
  if (this.blockDachsStart !== undefined) {
201
204
  if (action.newLevel > this.settings.batteryLevelPreventStartThreshold) {
202
205
  const blockAction = new models_1.ActuatorSetStateCommand(action, true, `Battery reached ${action.newLevel}%, Dachs should not run any more`, null);
@@ -257,5 +260,18 @@ class Dachs {
257
260
  const setAction = new models_1.ActuatorSetStateCommand(action, desiredState, reason, null);
258
261
  this.warmWaterPump.setActuator(setAction);
259
262
  }
263
+ checkHeatingRod(action) {
264
+ var _a;
265
+ if (this.heatingRod === undefined) {
266
+ return;
267
+ }
268
+ const shouldBeOff = ((_a = services_1.SettingsService.settings.heaterSettings) === null || _a === void 0 ? void 0 : _a.mode) === config_1.HeatingMode.Winter ||
269
+ action.newLevel < this.settings.batteryLevelHeatingRodThreshold;
270
+ if (this.heatingRod.actuatorOn !== shouldBeOff) {
271
+ return;
272
+ }
273
+ const setAction = new models_1.ActuatorSetStateCommand(action, !shouldBeOff, `Battery reached ${action.newLevel}%, heating rod should be turned ${shouldBeOff ? 'off' : 'on'}`, null);
274
+ this.heatingRod.setActuator(setAction);
275
+ }
260
276
  }
261
277
  exports.Dachs = Dachs;