hoffmation-base 3.2.6 → 3.2.8

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.
@@ -45,17 +45,28 @@ class VictronDevice extends BaseDevice_1.BaseDevice {
45
45
  }
46
46
  /** @inheritDoc */
47
47
  get acBlocked() {
48
- if (this.settings.hasBattery) {
49
- const hours = new Date().getHours();
50
- if (hours < 6 || hours > 18) {
51
- return this.batteryLevel < this.settings.minimumNightTimeAcBatteryLevel;
52
- }
53
- if (hours < 10 || hours > 16) {
54
- return this.batteryLevel < this.settings.minimumTransientTimeAcBatteryLevel;
55
- }
56
- return this.batteryLevel < this.settings.minimumDayTimeAcBatteryLevel;
48
+ var _a;
49
+ if (!this.settings.hasBattery) {
50
+ return false;
51
+ }
52
+ const hours = new Date().getHours();
53
+ if (hours > 18) {
54
+ return this.batteryLevel < this.settings.minimumNightTimeAcBatteryLevel;
55
+ }
56
+ else if (hours > 16) {
57
+ return this.batteryLevel < this.settings.minimumTransientTimeAcBatteryLevel;
58
+ }
59
+ else if (hours > 5 &&
60
+ hours < 12 &&
61
+ ((_a = services_1.WeatherService.todayCloudiness) !== null && _a !== void 0 ? _a : 99) < 30 &&
62
+ services_1.WeatherService.todayMaxTemp > 25) {
63
+ // During morning hours battery still might be kinda empty but if it gets sunny again, we should go for ac anyways.
64
+ return this.batteryLevel > this.settings.minimumMorningSunnyDayAcBatteryLevel;
65
+ }
66
+ else if (hours < 10) {
67
+ return this.batteryLevel > this.settings.minimumTransientTimeAcBatteryLevel;
57
68
  }
58
- return false;
69
+ return this.batteryLevel < this.settings.minimumDayTimeAcBatteryLevel;
59
70
  }
60
71
  /** @inheritDoc */
61
72
  get batteryLevel() {
@@ -48,6 +48,11 @@ export interface iAcSettings extends iDeviceSettings {
48
48
  *
49
49
  */
50
50
  minOutdoorTempForCooling: number;
51
+ /**
52
+ * Set's a specific override temperature as cooling target (e.g. to maximize cooling)
53
+ * -1 = Off
54
+ */
55
+ overrideCoolingTargetTemp?: number;
51
56
  /**
52
57
  *
53
58
  */
@@ -168,6 +168,9 @@ class AcDevice extends devices_1.RoomBaseDevice {
168
168
  return enums_1.AcMode.Heating;
169
169
  }
170
170
  else if (this.coolingAllowed) {
171
+ if (this.settings.overrideCoolingTargetTemp > 0) {
172
+ this._desiredTemperatur = this.settings.overrideCoolingTargetTemp;
173
+ }
171
174
  return enums_1.AcMode.Cooling;
172
175
  }
173
176
  return enums_1.AcMode.Off;
@@ -111,7 +111,12 @@ class OwnDaikinDevice extends ac_device_1.AcDevice {
111
111
  targetTemp = this.settings.useOwnTemperature ? targetTemp : 29;
112
112
  }
113
113
  else if (this.desiredMode == daikin_controller_1.Mode.COLD) {
114
- targetTemp = this.settings.useOwnTemperature ? targetTemp : 16;
114
+ if (this.settings.useOwnTemperature) {
115
+ targetTemp = this.settings.overrideCoolingTargetTemp > 0 ? this.settings.overrideCoolingTargetTemp : targetTemp;
116
+ }
117
+ else {
118
+ targetTemp = 16;
119
+ }
115
120
  }
116
121
  const changeObject = {
117
122
  power: this.desiredState,
@@ -25,6 +25,7 @@ export declare class WeatherService {
25
25
  private static appID?;
26
26
  static addWeatherUpdateCb(name: string, cb: () => void): void;
27
27
  static get todayMaxTemp(): number;
28
+ static get todayCloudiness(): number | undefined;
28
29
  static initialize(config: iWeatherSettings): void;
29
30
  static update(): void;
30
31
  static stopInterval(): void;
@@ -20,6 +20,10 @@ class WeatherService {
20
20
  var _a, _b, _c;
21
21
  return (_c = (_b = (_a = WeatherService.lastResponse) === null || _a === void 0 ? void 0 : _a.daily[0]) === null || _b === void 0 ? void 0 : _b.temp.max) !== null && _c !== void 0 ? _c : interfaces_1.UNDEFINED_TEMP_VALUE;
22
22
  }
23
+ static get todayCloudiness() {
24
+ var _a, _b;
25
+ return (_b = (_a = WeatherService.lastResponse) === null || _a === void 0 ? void 0 : _a.daily[0]) === null || _b === void 0 ? void 0 : _b.clouds;
26
+ }
23
27
  static initialize(config) {
24
28
  this.active = true;
25
29
  this.longitude = config.longitude;
@@ -44,6 +44,8 @@ export declare class AcSettings extends DeviceSettings implements iAcSettings {
44
44
  * The minimum outside temperature (max. of day) in Celsius to even consider cooling.
45
45
  */
46
46
  minOutdoorTempForCooling: number;
47
+ /** @inheritDoc */
48
+ overrideCoolingTargetTemp: number;
47
49
  fromPartialObject(data: Partial<AcSettings>): void;
48
50
  toJSON(): Partial<AcSettings>;
49
51
  }
@@ -50,9 +50,11 @@ class AcSettings extends deviceSettings_1.DeviceSettings {
50
50
  * The minimum outside temperature (max. of day) in Celsius to even consider cooling.
51
51
  */
52
52
  this.minOutdoorTempForCooling = 21;
53
+ /** @inheritDoc */
54
+ this.overrideCoolingTargetTemp = -1;
53
55
  }
54
56
  fromPartialObject(data) {
55
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
57
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
56
58
  this.minimumHours = (_a = data.minimumHours) !== null && _a !== void 0 ? _a : this.minimumHours;
57
59
  this.minimumMinutes = (_b = data.minimumMinutes) !== null && _b !== void 0 ? _b : this.minimumMinutes;
58
60
  this.maximumHours = (_c = data.maximumHours) !== null && _c !== void 0 ? _c : this.maximumHours;
@@ -63,6 +65,7 @@ class AcSettings extends deviceSettings_1.DeviceSettings {
63
65
  this.useAutomatic = (_h = data.useAutomatic) !== null && _h !== void 0 ? _h : this.useAutomatic;
64
66
  this.manualDisabled = (_j = data.manualDisabled) !== null && _j !== void 0 ? _j : this.manualDisabled;
65
67
  this.minOutdoorTempForCooling = (_k = data.minOutdoorTempForCooling) !== null && _k !== void 0 ? _k : this.minOutdoorTempForCooling;
68
+ this.overrideCoolingTargetTemp = (_l = data.overrideCoolingTargetTemp) !== null && _l !== void 0 ? _l : this.overrideCoolingTargetTemp;
66
69
  super.fromPartialObject(data);
67
70
  }
68
71
  toJSON() {
@@ -27,6 +27,11 @@ export declare class VictronDeviceSettings extends DeviceSettings {
27
27
  * The minimum battery level at which the system should be allowed to use AC
28
28
  */
29
29
  minimumDayTimeAcBatteryLevel: number;
30
+ /**
31
+ * The minimum battery level at which the system should be allowed to use AC on expectetly hot/sunny days mornings
32
+ * @type {number}
33
+ */
34
+ minimumMorningSunnyDayAcBatteryLevel: number;
30
35
  /**
31
36
  * If the system has a grid
32
37
  * @default true
@@ -33,6 +33,11 @@ class VictronDeviceSettings extends deviceSettings_1.DeviceSettings {
33
33
  * The minimum battery level at which the system should be allowed to use AC
34
34
  */
35
35
  this.minimumDayTimeAcBatteryLevel = 60;
36
+ /**
37
+ * The minimum battery level at which the system should be allowed to use AC on expectetly hot/sunny days mornings
38
+ * @type {number}
39
+ */
40
+ this.minimumMorningSunnyDayAcBatteryLevel = 30;
36
41
  /**
37
42
  * If the system has a grid
38
43
  * @default true
@@ -68,21 +73,23 @@ class VictronDeviceSettings extends deviceSettings_1.DeviceSettings {
68
73
  this.excessEnergyTurnOffThreshold = 50;
69
74
  }
70
75
  fromPartialObject(data) {
71
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o;
76
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
72
77
  this.maxBatteryLoadWattage = (_a = data.maxBatteryLoadWattage) !== null && _a !== void 0 ? _a : this.maxBatteryLoadWattage;
73
78
  this.batteryReportingInterval = (_b = data.batteryReportingInterval) !== null && _b !== void 0 ? _b : this.batteryReportingInterval;
74
79
  this.hasBattery = (_c = data.hasBattery) !== null && _c !== void 0 ? _c : this.hasBattery;
75
80
  this.hasGrid = (_d = data.hasGrid) !== null && _d !== void 0 ? _d : this.hasGrid;
76
81
  this.hasSolar = (_e = data.hasSolar) !== null && _e !== void 0 ? _e : this.hasSolar;
77
82
  this.minimumNightTimeAcBatteryLevel = (_f = data.minimumNightTimeAcBatteryLevel) !== null && _f !== void 0 ? _f : this.minimumNightTimeAcBatteryLevel;
83
+ this.minimumMorningSunnyDayAcBatteryLevel =
84
+ (_g = data.minimumMorningSunnyDayAcBatteryLevel) !== null && _g !== void 0 ? _g : this.minimumMorningSunnyDayAcBatteryLevel;
78
85
  this.minimumTransientTimeAcBatteryLevel =
79
- (_g = data.minimumTransientTimeAcBatteryLevel) !== null && _g !== void 0 ? _g : this.minimumTransientTimeAcBatteryLevel;
80
- this.minimumDayTimeAcBatteryLevel = (_h = data.minimumDayTimeAcBatteryLevel) !== null && _h !== void 0 ? _h : this.minimumDayTimeAcBatteryLevel;
81
- this.batteryCapacityWattage = (_j = data.batteryCapacityWattage) !== null && _j !== void 0 ? _j : this.batteryCapacityWattage;
82
- this.normalBaseConsumptionWattage = (_k = data.normalBaseConsumptionWattage) !== null && _k !== void 0 ? _k : this.normalBaseConsumptionWattage;
83
- this.maximumBatteryDischargeWattage = (_l = data.maximumBatteryDischargeWattage) !== null && _l !== void 0 ? _l : this.maximumBatteryDischargeWattage;
84
- this.excessEnergyTurnOnThreshold = (_m = data.excessEnergyTurnOnThreshold) !== null && _m !== void 0 ? _m : this.excessEnergyTurnOnThreshold;
85
- this.excessEnergyTurnOffThreshold = (_o = data.excessEnergyTurnOffThreshold) !== null && _o !== void 0 ? _o : this.excessEnergyTurnOffThreshold;
86
+ (_h = data.minimumTransientTimeAcBatteryLevel) !== null && _h !== void 0 ? _h : this.minimumTransientTimeAcBatteryLevel;
87
+ this.minimumDayTimeAcBatteryLevel = (_j = data.minimumDayTimeAcBatteryLevel) !== null && _j !== void 0 ? _j : this.minimumDayTimeAcBatteryLevel;
88
+ this.batteryCapacityWattage = (_k = data.batteryCapacityWattage) !== null && _k !== void 0 ? _k : this.batteryCapacityWattage;
89
+ this.normalBaseConsumptionWattage = (_l = data.normalBaseConsumptionWattage) !== null && _l !== void 0 ? _l : this.normalBaseConsumptionWattage;
90
+ this.maximumBatteryDischargeWattage = (_m = data.maximumBatteryDischargeWattage) !== null && _m !== void 0 ? _m : this.maximumBatteryDischargeWattage;
91
+ this.excessEnergyTurnOnThreshold = (_o = data.excessEnergyTurnOnThreshold) !== null && _o !== void 0 ? _o : this.excessEnergyTurnOnThreshold;
92
+ this.excessEnergyTurnOffThreshold = (_p = data.excessEnergyTurnOffThreshold) !== null && _p !== void 0 ? _p : this.excessEnergyTurnOffThreshold;
86
93
  super.fromPartialObject(data);
87
94
  }
88
95
  toJSON() {