hoffmation-base 3.0.0-alpha.74 → 3.0.0-alpha.76

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.
@@ -1,4 +1,3 @@
1
- /// <reference types="node" />
2
1
  export declare class Base64Image {
3
2
  data: string;
4
3
  name: string;
@@ -1,4 +1,3 @@
1
- /// <reference types="node" />
2
1
  import { HeaterSettings } from '../../../models';
3
2
  import { iRoomDevice } from './iRoomDevice';
4
3
  import { iDisposable } from '../../services';
@@ -1,4 +1,3 @@
1
- /// <reference types="node" />
2
1
  import { iRoomDevice } from './iRoomDevice';
3
2
  import { HumiditySensorChangeAction } from '../../../models';
4
3
  export declare const UNDEFINED_HUMIDITY_VALUE = -1;
@@ -1,4 +1,3 @@
1
- /// <reference types="node" />
2
1
  import { iRoomDevice } from './index';
3
2
  import { SceneSettings } from '../../../models';
4
3
  /**
@@ -1,4 +1,3 @@
1
- /// <reference types="node" />
2
1
  import { iRoomDevice } from './iRoomDevice';
3
2
  import { TemperatureSensorChangeAction } from '../../../models';
4
3
  export declare const UNDEFINED_TEMP_VALUE = -99;
@@ -1,4 +1,3 @@
1
- /// <reference types="node" />
2
1
  import { iTemperatureSensor } from '../baseDeviceInterfaces';
3
2
  import { LogDebugType, OwnSonosDevice } from '../../services';
4
3
  import { DeviceCapability } from '../DeviceCapability';
@@ -11,10 +11,10 @@ export declare class PresenceGroup extends BaseGroup {
11
11
  private get lastLeftDelayActive();
12
12
  getMotionDetector(): Array<iMotionSensor>;
13
13
  initCallbacks(): void;
14
- presentAmount(): number;
14
+ anyPresent(includeMovementResetDelayCheck?: boolean): boolean;
15
15
  addLastLeftCallback(cb: (action: PresenceGroupLastLeftAction) => void): void;
16
16
  addAnyMovementCallback(cb: (action: PresenceGroupAnyMovementAction) => void): void;
17
- anyPresent(includeMovementResetDelayCheck?: boolean): boolean;
17
+ private presentAmount;
18
18
  private fireFistEnterCBs;
19
19
  addFirstEnterCallback(cb: (action: PresenceGroupFirstEnterAction) => void): void;
20
20
  private motionSensorOnAnyMovement;
@@ -18,7 +18,7 @@ class PresenceGroup extends base_group_1.BaseGroup {
18
18
  this.deviceCluster.deviceMap.set(device_cluster_type_1.DeviceClusterType.MotionDetection, new device_list_1.DeviceList(motionSensorIds));
19
19
  }
20
20
  get lastLeftDelayActive() {
21
- return this._lastLeftTimeout !== null;
21
+ return this.getTimeAfterReset() < 0;
22
22
  }
23
23
  getMotionDetector() {
24
24
  return this.deviceCluster.getDevicesByType(device_cluster_type_1.DeviceClusterType.MotionDetection);
@@ -56,8 +56,11 @@ class PresenceGroup extends base_group_1.BaseGroup {
56
56
  this.getRoom().setLightTimeBased(new models_1.RoomSetLightTimeBasedCommand(action, true));
57
57
  });
58
58
  }
59
- presentAmount() {
60
- return this.getMotionDetector().filter((b) => b.movementDetected).length;
59
+ anyPresent(includeMovementResetDelayCheck = false) {
60
+ if (includeMovementResetDelayCheck && this.lastLeftDelayActive) {
61
+ return true;
62
+ }
63
+ return this.presentAmount() > 0;
61
64
  }
62
65
  addLastLeftCallback(cb) {
63
66
  this._lastLeftCbs.push(cb);
@@ -65,11 +68,8 @@ class PresenceGroup extends base_group_1.BaseGroup {
65
68
  addAnyMovementCallback(cb) {
66
69
  this._anyMovementCbs.push(cb);
67
70
  }
68
- anyPresent(includeMovementResetDelayCheck = false) {
69
- if (includeMovementResetDelayCheck && this.lastLeftDelayActive) {
70
- return true;
71
- }
72
- return this.getMotionDetector().find((b) => b.movementDetected) !== undefined;
71
+ presentAmount() {
72
+ return this.getMotionDetector().filter((b) => b.movementDetected).length;
73
73
  }
74
74
  fireFistEnterCBs(action) {
75
75
  for (const cb of this._firstEnterCbs) {
@@ -94,6 +94,7 @@ class PresenceGroup extends base_group_1.BaseGroup {
94
94
  motionSensorOnLastLeft(action) {
95
95
  let timeAfterReset = this.getTimeAfterReset();
96
96
  if (timeAfterReset > 0) {
97
+ this._lastLeftTimeout = null;
97
98
  this.log(models_1.LogLevel.Debug, `Movement reset. Active Motions: ${this.presentAmount()}\tTime after Last Movement including Reset: ${timeAfterReset}`);
98
99
  this.executeLastLeftCbs(new models_1.PresenceGroupLastLeftAction(action));
99
100
  return;
@@ -1,4 +1,3 @@
1
- /// <reference types="node" />
2
1
  import { HmIPDevice } from './hmIpDevice';
3
2
  import { iDisposable } from '../../services';
4
3
  import { HeaterSettings, HumiditySensorChangeAction, TemperatureSensorChangeAction } from '../../../models';
@@ -1,4 +1,3 @@
1
- /// <reference types="node" />
2
1
  import { iScene } from '../baseDeviceInterfaces';
3
2
  import { LogLevel, RoomBase, SceneSettings } from '../../../models';
4
3
  import { TvDevice } from '../tv';
@@ -1,4 +1,3 @@
1
- /// <reference types="node" />
2
1
  import { ShellyDevice } from './shellyDevice';
3
2
  import { iBatteryDevice, iHeater } from '../baseDeviceInterfaces';
4
3
  import { BatteryLevelChangeAction, HeaterSettings } from '../../../models';
@@ -1,4 +1,3 @@
1
- /// <reference types="node" />
2
1
  import { iHumiditySensor, iTemperatureSensor } from '../baseDeviceInterfaces';
3
2
  import { SmartGardenDevice } from './smartGardenDevice';
4
3
  import { HumiditySensorChangeAction, TemperatureSensorChangeAction } from '../../../models';
@@ -1,4 +1,3 @@
1
- /// <reference types="node" />
2
1
  import { ZigbeeDevice } from './zigbeeDevice';
3
2
  import { iBatteryDevice, iHeater } from '../../baseDeviceInterfaces';
4
3
  import { BatteryLevelChangeAction, HeaterSettings } from '../../../../models';
@@ -1,4 +1,3 @@
1
- /// <reference types="node" />
2
1
  import { DeviceType } from '../../deviceType';
3
2
  import { ZigbeeDevice } from './index';
4
3
  import { BatteryLevelChangeAction, MotionSensorAction, MotionSensorSettings } from '../../../../models';
@@ -1,4 +1,3 @@
1
- /// <reference types="node" />
2
1
  import { DeviceType } from '../../deviceType';
3
2
  import { ShutterCalibration, ShutterSetLevelCommand, ShutterSettings } from '../../../../models';
4
3
  import { ZigbeeDevice } from './zigbeeDevice';
@@ -1,4 +1,3 @@
1
- /// <reference types="node" />
2
1
  import { ZigbeeDevice } from './BaseDevices';
3
2
  import { BatteryLevelChangeAction } from '../../../models';
4
3
  import { IoBrokerDeviceInfo } from '../IoBrokerDeviceInfo';
@@ -1,4 +1,3 @@
1
- /// <reference types="node" />
2
1
  import { ZigbeeDevice } from './BaseDevices';
3
2
  import { BatteryLevelChangeAction } from '../../../models';
4
3
  import { IoBrokerDeviceInfo } from '../IoBrokerDeviceInfo';
@@ -1,4 +1,3 @@
1
- /// <reference types="node" />
2
1
  import { ZigbeeDevice } from './BaseDevices';
3
2
  import { iBatteryDevice, iHumiditySensor, iTemperatureSensor } from '../baseDeviceInterfaces';
4
3
  import { IoBrokerDeviceInfo } from '../IoBrokerDeviceInfo';
@@ -1,5 +1,3 @@
1
- /// <reference types="node" />
2
- /// <reference types="node" />
3
1
  import { IncomingMessage } from 'http';
4
2
  import { iDisposable } from '../services';
5
3
  import { ConnectionCallbacks } from '../../models';
@@ -20,13 +20,9 @@ class AcDevice {
20
20
  * @returns {boolean} True if the AC is allowed to cool
21
21
  */
22
22
  get coolingAllowed() {
23
- var _a, _b;
24
23
  if (settings_service_1.SettingsService.heatMode !== config_1.HeatingMode.Summer) {
25
24
  return false;
26
25
  }
27
- if (this.settings.noCoolingOnMovement && ((_b = (_a = this.room) === null || _a === void 0 ? void 0 : _a.PraesenzGroup) === null || _b === void 0 ? void 0 : _b.anyPresent(true))) {
28
- return false;
29
- }
30
26
  if (weather_1.WeatherService.active &&
31
27
  weather_1.WeatherService.todayMaxTemp < this.settings.minOutdoorTempForCooling &&
32
28
  weather_1.WeatherService.todayMaxTemp !== devices_1.UNDEFINED_TEMP_VALUE) {
@@ -128,7 +124,7 @@ class AcDevice {
128
124
  }
129
125
  /** @inheritDoc */
130
126
  isAvailableForExcessEnergy() {
131
- var _a, _b;
127
+ var _a, _b, _c, _d;
132
128
  if (this.settings.useAutomatic || (((_b = (_a = this.room) === null || _a === void 0 ? void 0 : _a.HeatGroup) === null || _b === void 0 ? void 0 : _b.settings.automaticMode) && this.settings.heatingAllowed)) {
133
129
  return false;
134
130
  }
@@ -138,7 +134,13 @@ class AcDevice {
138
134
  if (!utils_1.Utils.timeWithinBorders(this.settings.minimumHours, this.settings.minimumMinutes, this.settings.maximumHours, this.settings.maximumMinutes)) {
139
135
  return false;
140
136
  }
141
- return this.calculateDesiredMode() !== ac_mode_1.AcMode.Off;
137
+ const desiredMode = this.calculateDesiredMode();
138
+ if (desiredMode === ac_mode_1.AcMode.Cooling &&
139
+ this.settings.noCoolingOnMovement &&
140
+ ((_d = (_c = this.room) === null || _c === void 0 ? void 0 : _c.PraesenzGroup) === null || _d === void 0 ? void 0 : _d.anyPresent(true))) {
141
+ return false;
142
+ }
143
+ return true;
142
144
  }
143
145
  /** @inheritDoc */
144
146
  calculateDesiredMode() {
@@ -224,10 +226,17 @@ class AcDevice {
224
226
  }
225
227
  /** @inheritDoc */
226
228
  turnOnForExcessEnergy() {
229
+ var _a, _b;
227
230
  if (this.blockAutomationHandler.automaticBlockActive) {
228
231
  return;
229
232
  }
230
233
  this._activatedByExcessEnergy = true;
234
+ const desiredMode = this.calculateDesiredMode();
235
+ if (desiredMode === ac_mode_1.AcMode.Cooling &&
236
+ this.settings.noCoolingOnMovement &&
237
+ ((_b = (_a = this.room) === null || _a === void 0 ? void 0 : _a.PraesenzGroup) === null || _b === void 0 ? void 0 : _b.anyPresent(true))) {
238
+ return;
239
+ }
231
240
  this.setDesiredMode(this.calculateDesiredMode(), false);
232
241
  this.turnOn();
233
242
  }
@@ -278,6 +287,7 @@ class AcDevice {
278
287
  }, 5000, this);
279
288
  }
280
289
  automaticCheck() {
290
+ var _a, _b;
281
291
  if (this.blockAutomationHandler.automaticBlockActive) {
282
292
  // We aren't allowed to turn on or off anyway --> exit
283
293
  return;
@@ -288,7 +298,10 @@ class AcDevice {
288
298
  return;
289
299
  }
290
300
  this.setDesiredMode(desiredMode, false);
291
- if (desiredMode == ac_mode_1.AcMode.Off) {
301
+ if (desiredMode == ac_mode_1.AcMode.Off ||
302
+ (desiredMode === ac_mode_1.AcMode.Cooling &&
303
+ this.settings.noCoolingOnMovement &&
304
+ ((_b = (_a = this.room) === null || _a === void 0 ? void 0 : _a.PraesenzGroup) === null || _b === void 0 ? void 0 : _b.anyPresent(true)))) {
292
305
  this.turnOff();
293
306
  return;
294
307
  }
@@ -192,9 +192,6 @@ class OwnGoveeDevice {
192
192
  });
193
193
  }
194
194
  turnOn() {
195
- if (this._actuatorOn) {
196
- return;
197
- }
198
195
  this.queuedValue = true;
199
196
  govee_service_1.GooveeService.sendCommand(this, `on/true`).then((result) => {
200
197
  if (!result) {
@@ -206,9 +203,6 @@ class OwnGoveeDevice {
206
203
  });
207
204
  }
208
205
  turnOff() {
209
- if (!this._actuatorOn) {
210
- return;
211
- }
212
206
  this.queuedValue = false;
213
207
  govee_service_1.GooveeService.sendCommand(this, `on/false`).then((result) => {
214
208
  if (!result) {
@@ -1,4 +1,3 @@
1
- /// <reference types="node" />
2
1
  import { iPersist } from '../dbo';
3
2
  import { CatchEmResult } from './catchEmResult';
4
3
  import { iTimePair } from '../../config';