hoffmation-base 3.0.0-alpha.52 → 3.0.0-alpha.53

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.
@@ -14,6 +14,7 @@ const DeviceCapability_1 = require("../../devices/DeviceCapability");
14
14
  const settings_service_1 = require("../settings-service");
15
15
  const config_1 = require("../../config");
16
16
  const blockAutomaticHandler_1 = require("../blockAutomaticHandler");
17
+ const weather_1 = require("../weather");
17
18
  class AcDevice {
18
19
  /**
19
20
  * Whether the AC is allowed to cool (depends on the season
@@ -27,6 +28,12 @@ class AcDevice {
27
28
  if (this.settings.noCoolingOnMovement && ((_b = (_a = this.room) === null || _a === void 0 ? void 0 : _a.PraesenzGroup) === null || _b === void 0 ? void 0 : _b.anyPresent())) {
28
29
  return false;
29
30
  }
31
+ if (weather_1.WeatherService.active &&
32
+ weather_1.WeatherService.todayMaxTemp < 22 && // TODO: Make this value configurable
33
+ weather_1.WeatherService.todayMaxTemp !== devices_1.UNDEFINED_TEMP_VALUE) {
34
+ // As it is quite cold outside there is no need to cool
35
+ return false;
36
+ }
30
37
  return true;
31
38
  }
32
39
  /**
@@ -26,6 +26,7 @@ export declare class WeatherService {
26
26
  private static longitude;
27
27
  private static appID?;
28
28
  static addWeatherUpdateCb(name: string, cb: () => void): void;
29
+ static get todayMaxTemp(): number;
29
30
  static initialize(config: iWeatherSettings): void;
30
31
  static update(): void;
31
32
  static stopInterval(): void;
@@ -11,10 +11,15 @@ const utils_1 = require("../utils");
11
11
  const log_service_1 = require("../log-service");
12
12
  const suncalc_1 = __importDefault(require("suncalc"));
13
13
  const time_callback_service_1 = require("../time-callback-service");
14
+ const devices_1 = require("../../devices");
14
15
  class WeatherService {
15
16
  static addWeatherUpdateCb(name, cb) {
16
17
  this._dataUpdateCbs[name] = cb;
17
18
  }
19
+ static get todayMaxTemp() {
20
+ var _a, _b, _c;
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 : devices_1.UNDEFINED_TEMP_VALUE;
22
+ }
18
23
  static initialize(config) {
19
24
  this.active = true;
20
25
  this.longitude = config.longitude;