hoffmation-base 3.0.0-alpha.85 → 3.0.0-alpha.86

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,15 @@ export declare class DachsDeviceSettings extends ActuatorSettings {
12
12
  * Uses {@link iBatteryDevice.addBatteryLevelCallback}
13
13
  */
14
14
  batteryLevelTurnOnThreshold: number;
15
+ /**
16
+ * Defines the battery level at which the dachs should be turned on,
17
+ * in evening hours to prevent a battery based island-system to run out of
18
+ * power overnight.
19
+ * @default -1 --> No turn on for battery loading
20
+ *
21
+ * Uses {@link iBatteryDevice.addBatteryLevelCallback}
22
+ */
23
+ batteryLevelBeforeNightTurnOnThreshold: number;
15
24
  /**
16
25
  * Defines the battery level below which the dachs should be allowed to start
17
26
  */
@@ -18,6 +18,15 @@ 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 at which the dachs should be turned on,
23
+ * in evening hours to prevent a battery based island-system to run out of
24
+ * power overnight.
25
+ * @default -1 --> No turn on for battery loading
26
+ *
27
+ * Uses {@link iBatteryDevice.addBatteryLevelCallback}
28
+ */
29
+ this.batteryLevelBeforeNightTurnOnThreshold = -1;
21
30
  /**
22
31
  * Defines the battery level below which the dachs should be allowed to start
23
32
  */
@@ -216,8 +216,18 @@ class Dachs {
216
216
  return;
217
217
  }
218
218
  }
219
- if (this._dachsOn || this.settings.batteryLevelTurnOnThreshold < action.newLevel) {
220
- // We are already running, or battery level is high enough.
219
+ if (this._dachsOn) {
220
+ // We are already running
221
+ return;
222
+ }
223
+ const dayType = services_1.TimeCallbackService.dayType(new services_1.SunTimeOffsets());
224
+ if ((dayType === models_1.TimeOfDay.Daylight || dayType === models_1.TimeOfDay.BeforeSunrise) &&
225
+ action.newLevel > this.settings.batteryLevelTurnOnThreshold) {
226
+ // It is daytime (maybe solar power) and it is no critical battery level
227
+ return;
228
+ }
229
+ if (action.newLevel > this.settings.batteryLevelBeforeNightTurnOnThreshold) {
230
+ // It is not daylight but battery level is high enough
221
231
  return;
222
232
  }
223
233
  const setStateCommand = new models_1.ActuatorSetStateCommand(action, true, 'Energy Level of battery dropped to critical level', null);