hoffmation-base 3.4.4 → 3.4.7

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.
@@ -201,4 +201,16 @@ export declare class API {
201
201
  * @returns The temperature measurements or an error if the device is not found or not a temperature sensor
202
202
  */
203
203
  static getTemperatureHistory(deviceId: string, startDate?: Date, endDate?: Date): Promise<iTemperatureMeasurement[] | Error>;
204
+ /**
205
+ * Generisches Laden eines Konfig-Blobs (z.B. für Express-eigene Settings). Base-agnostisch.
206
+ * @param id - The id of the config to load
207
+ * @returns The config as JSON string or undefined if not found
208
+ */
209
+ static loadConfig(id: string): Promise<string | undefined>;
210
+ /**
211
+ * Generisches Speichern eines Konfig-Blobs. Base-agnostisch — kennt den Inhalt nicht.
212
+ * @param id - The id of the config to save
213
+ * @param data - The config data as JSON string
214
+ */
215
+ static saveConfig(id: string, data: string): void;
204
216
  }
@@ -6,6 +6,7 @@ const enums_1 = require("../enums");
6
6
  const command_1 = require("../command");
7
7
  const logging_1 = require("../logging");
8
8
  const services_1 = require("../services");
9
+ const persistence_1 = require("../services/dbo/persistence");
9
10
  class API {
10
11
  /**
11
12
  * Endpoint to end a scene manually (or early if it has automatic turn off)
@@ -495,5 +496,23 @@ class API {
495
496
  logging_1.ServerLogService.writeLog(enums_1.LogLevel.Debug, `API Call to get temperature history for ${deviceId}`);
496
497
  return d.temperatureSensor.getTemperatureHistory(startDate, endDate);
497
498
  }
499
+ /**
500
+ * Generisches Laden eines Konfig-Blobs (z.B. für Express-eigene Settings). Base-agnostisch.
501
+ * @param id - The id of the config to load
502
+ * @returns The config as JSON string or undefined if not found
503
+ */
504
+ static async loadConfig(id) {
505
+ var _a;
506
+ return (_a = persistence_1.Persistence.dbo) === null || _a === void 0 ? void 0 : _a.loadSettings(id);
507
+ }
508
+ /**
509
+ * Generisches Speichern eines Konfig-Blobs. Base-agnostisch — kennt den Inhalt nicht.
510
+ * @param id - The id of the config to save
511
+ * @param data - The config data as JSON string
512
+ */
513
+ static saveConfig(id, data) {
514
+ var _a;
515
+ (_a = persistence_1.Persistence.dbo) === null || _a === void 0 ? void 0 : _a.persistSettings(id, data, id);
516
+ }
498
517
  }
499
518
  exports.API = API;
@@ -161,18 +161,29 @@ class AcDevice extends devices_1.RoomBaseDevice {
161
161
  }
162
162
  if (this.settings.useOwnTemperature) {
163
163
  // Device is in automatic mode so ignore energy and room temperature
164
+ const outdoorTemp = weather_1.WeatherService.todayMaxTemp;
164
165
  if (this.settings.useAutomatic) {
166
+ // In automatic mode, check if outdoor temperature allows cooling
167
+ // If not and heating is allowed, prefer heating mode over automatic
168
+ if (!this.coolingAllowed && this.heatingAllowed) {
169
+ this.log(enums_1.LogLevel.Info, `Using heating mode instead of automatic (useAutomatic=true, but outdoorTemp=${outdoorTemp}°C < minOutdoorTempForCooling=${this.settings.minOutdoorTempForCooling}°C, season not summer)`);
170
+ return enums_1.AcMode.Heating;
171
+ }
172
+ this.log(enums_1.LogLevel.Info, `Using automatic mode (useAutomatic=true, outdoorTemp=${outdoorTemp}°C, coolingAllowed=${this.coolingAllowed})`);
165
173
  return enums_1.AcMode.Auto;
166
174
  }
167
- if (this.heatingAllowed) {
168
- return enums_1.AcMode.Heating;
169
- }
170
- else if (this.coolingAllowed) {
175
+ if (this.coolingAllowed) {
171
176
  if (this.settings.overrideCoolingTargetTemp > 0) {
172
177
  this._desiredTemperatur = this.settings.overrideCoolingTargetTemp;
173
178
  }
179
+ this.log(enums_1.LogLevel.Info, `Using cooling mode (useOwnTemperature=true, outdoorTemp=${outdoorTemp}°C, minOutdoorTempForCooling=${this.settings.minOutdoorTempForCooling}°C)`);
174
180
  return enums_1.AcMode.Cooling;
175
181
  }
182
+ else if (this.heatingAllowed) {
183
+ this.log(enums_1.LogLevel.Info, `Using heating mode (useOwnTemperature=true, coolingAllowed=false, outdoorTemp=${outdoorTemp}°C, minOutdoorTempForCooling=${this.settings.minOutdoorTempForCooling}°C)`);
184
+ return enums_1.AcMode.Heating;
185
+ }
186
+ this.log(enums_1.LogLevel.Info, `Turning off AC (useOwnTemperature=true, coolingAllowed=false, heatingAllowed=false, outdoorTemp=${outdoorTemp}°C)`);
176
187
  return enums_1.AcMode.Off;
177
188
  }
178
189
  const temp = this.roomTemperature;
@@ -196,6 +207,9 @@ class AcDevice extends devices_1.RoomBaseDevice {
196
207
  const targetTemp = heatGroup.desiredTemp;
197
208
  const coolUntil = targetTemp + threshold;
198
209
  const heatUntil = targetTemp - thresholdHeating;
210
+ if (coolUntil <= heatUntil && this.coolingAllowed && this.heatingAllowed) {
211
+ this.log(enums_1.LogLevel.Warn, `INVALID CONFIGURATION: coolUntil (${coolUntil}°C) <= heatUntil (${heatUntil}°C) with both cooling and heating allowed. This will cause oscillation! targetTemp: ${targetTemp}°C, threshold: ${threshold}, thresholdHeating: ${thresholdHeating}`);
212
+ }
199
213
  if (temp > coolUntil && this.coolingAllowed) {
200
214
  desiredMode = enums_1.AcMode.Cooling;
201
215
  }