hoffmation-base 3.0.0-alpha.87 → 3.0.0-alpha.88

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.
@@ -10,6 +10,18 @@ export declare class VictronDeviceSettings extends DeviceSettings {
10
10
  * @default true
11
11
  */
12
12
  hasBattery: boolean;
13
+ /**
14
+ * The minimum battery level for nighttime AC usage allowance
15
+ */
16
+ minimumNightTimeAcBatteryLevel: number;
17
+ /**
18
+ * The minimum battery level for early morning or evening hours AC usage allowance
19
+ */
20
+ minimumTransientTimeAcBatteryLevel: number;
21
+ /**
22
+ * The minimum battery level at which the system should be allowed to use AC
23
+ */
24
+ minimumDayTimeAcBatteryLevel: number;
13
25
  /**
14
26
  * If the system has a grid
15
27
  * @default true
@@ -16,6 +16,18 @@ class VictronDeviceSettings extends deviceSettings_1.DeviceSettings {
16
16
  * @default true
17
17
  */
18
18
  this.hasBattery = true;
19
+ /**
20
+ * The minimum battery level for nighttime AC usage allowance
21
+ */
22
+ this.minimumNightTimeAcBatteryLevel = 80;
23
+ /**
24
+ * The minimum battery level for early morning or evening hours AC usage allowance
25
+ */
26
+ this.minimumTransientTimeAcBatteryLevel = 70;
27
+ /**
28
+ * The minimum battery level at which the system should be allowed to use AC
29
+ */
30
+ this.minimumDayTimeAcBatteryLevel = 60;
19
31
  /**
20
32
  * If the system has a grid
21
33
  * @default true
@@ -51,16 +63,20 @@ class VictronDeviceSettings extends deviceSettings_1.DeviceSettings {
51
63
  this.excessEnergyTurnOffThreshold = 50;
52
64
  }
53
65
  fromPartialObject(data) {
54
- var _a, _b, _c, _d, _e, _f, _g, _h, _j;
66
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
55
67
  this.maxBatteryLoadWattage = (_a = data.maxBatteryLoadWattage) !== null && _a !== void 0 ? _a : this.maxBatteryLoadWattage;
56
68
  this.hasBattery = (_b = data.hasBattery) !== null && _b !== void 0 ? _b : this.hasBattery;
57
69
  this.hasGrid = (_c = data.hasGrid) !== null && _c !== void 0 ? _c : this.hasGrid;
58
70
  this.hasSolar = (_d = data.hasSolar) !== null && _d !== void 0 ? _d : this.hasSolar;
59
- this.batteryCapacityWattage = (_e = data.batteryCapacityWattage) !== null && _e !== void 0 ? _e : this.batteryCapacityWattage;
60
- this.normalBaseConsumptionWattage = (_f = data.normalBaseConsumptionWattage) !== null && _f !== void 0 ? _f : this.normalBaseConsumptionWattage;
61
- this.maximumBatteryDischargeWattage = (_g = data.maximumBatteryDischargeWattage) !== null && _g !== void 0 ? _g : this.maximumBatteryDischargeWattage;
62
- this.excessEnergyTurnOnThreshold = (_h = data.excessEnergyTurnOnThreshold) !== null && _h !== void 0 ? _h : this.excessEnergyTurnOnThreshold;
63
- this.excessEnergyTurnOffThreshold = (_j = data.excessEnergyTurnOffThreshold) !== null && _j !== void 0 ? _j : this.excessEnergyTurnOffThreshold;
71
+ this.minimumNightTimeAcBatteryLevel = (_e = data.minimumNightTimeAcBatteryLevel) !== null && _e !== void 0 ? _e : this.minimumNightTimeAcBatteryLevel;
72
+ this.minimumTransientTimeAcBatteryLevel =
73
+ (_f = data.minimumTransientTimeAcBatteryLevel) !== null && _f !== void 0 ? _f : this.minimumTransientTimeAcBatteryLevel;
74
+ this.minimumDayTimeAcBatteryLevel = (_g = data.minimumDayTimeAcBatteryLevel) !== null && _g !== void 0 ? _g : this.minimumDayTimeAcBatteryLevel;
75
+ this.batteryCapacityWattage = (_h = data.batteryCapacityWattage) !== null && _h !== void 0 ? _h : this.batteryCapacityWattage;
76
+ this.normalBaseConsumptionWattage = (_j = data.normalBaseConsumptionWattage) !== null && _j !== void 0 ? _j : this.normalBaseConsumptionWattage;
77
+ this.maximumBatteryDischargeWattage = (_k = data.maximumBatteryDischargeWattage) !== null && _k !== void 0 ? _k : this.maximumBatteryDischargeWattage;
78
+ this.excessEnergyTurnOnThreshold = (_l = data.excessEnergyTurnOnThreshold) !== null && _l !== void 0 ? _l : this.excessEnergyTurnOnThreshold;
79
+ this.excessEnergyTurnOffThreshold = (_m = data.excessEnergyTurnOffThreshold) !== null && _m !== void 0 ? _m : this.excessEnergyTurnOffThreshold;
64
80
  super.fromPartialObject(data);
65
81
  }
66
82
  toJSON() {
@@ -49,12 +49,12 @@ class VictronDevice {
49
49
  if (this.settings.hasBattery) {
50
50
  const hours = new Date().getHours();
51
51
  if (hours < 6 || hours > 18) {
52
- return this.battery < 70;
52
+ return this.battery < this.settings.minimumNightTimeAcBatteryLevel;
53
53
  }
54
54
  if (hours < 10 || hours > 16) {
55
- return this.battery < 60;
55
+ return this.battery < this.settings.minimumTransientTimeAcBatteryLevel;
56
56
  }
57
- return this.battery < 50;
57
+ return this.battery < this.settings.minimumDayTimeAcBatteryLevel;
58
58
  }
59
59
  return false;
60
60
  }