hoffmation-base 3.4.3 → 3.4.5

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.
@@ -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
  }