hoffmation-base 3.0.0-alpha.59 → 3.0.0-alpha.60

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.
@@ -6,3 +6,4 @@ export * from './presenceGroupFirstEnterAction';
6
6
  export * from './shutterPositionChangedAction';
7
7
  export * from './temperatureSensorChangeAction';
8
8
  export { BatteryLevelChangeAction } from './batteryLevelChangeAction';
9
+ export { PresenceGroupAnyMovementAction } from './presenceGroupAnyMovementAction';
@@ -14,7 +14,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
14
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
- exports.BatteryLevelChangeAction = exports.BaseAction = void 0;
17
+ exports.PresenceGroupAnyMovementAction = exports.BatteryLevelChangeAction = exports.BaseAction = void 0;
18
18
  var baseAction_1 = require("./baseAction");
19
19
  Object.defineProperty(exports, "BaseAction", { enumerable: true, get: function () { return baseAction_1.BaseAction; } });
20
20
  __exportStar(require("./humiditySensorChangeAction"), exports);
@@ -25,3 +25,5 @@ __exportStar(require("./shutterPositionChangedAction"), exports);
25
25
  __exportStar(require("./temperatureSensorChangeAction"), exports);
26
26
  var batteryLevelChangeAction_1 = require("./batteryLevelChangeAction");
27
27
  Object.defineProperty(exports, "BatteryLevelChangeAction", { enumerable: true, get: function () { return batteryLevelChangeAction_1.BatteryLevelChangeAction; } });
28
+ var presenceGroupAnyMovementAction_1 = require("./presenceGroupAnyMovementAction");
29
+ Object.defineProperty(exports, "PresenceGroupAnyMovementAction", { enumerable: true, get: function () { return presenceGroupAnyMovementAction_1.PresenceGroupAnyMovementAction; } });
@@ -0,0 +1,7 @@
1
+ import { BaseAction } from './baseAction';
2
+ import { CommandType } from '../command';
3
+ export declare class PresenceGroupAnyMovementAction extends BaseAction {
4
+ /** @inheritDoc */
5
+ type: CommandType;
6
+ constructor(source?: BaseAction, reason?: string);
7
+ }
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.PresenceGroupAnyMovementAction = void 0;
4
+ const baseAction_1 = require("./baseAction");
5
+ const command_1 = require("../command");
6
+ class PresenceGroupAnyMovementAction extends baseAction_1.BaseAction {
7
+ constructor(source, reason) {
8
+ super(source, reason);
9
+ /** @inheritDoc */
10
+ this.type = command_1.CommandType.PresenceGroupAnyMovementAction;
11
+ }
12
+ }
13
+ exports.PresenceGroupAnyMovementAction = PresenceGroupAnyMovementAction;
@@ -16,6 +16,7 @@ export declare enum CommandType {
16
16
  LedSetLightCommand = "LedSetLightCommand",
17
17
  LightGroupSwitchTimeConditional = "LightGroupSwitchTimeConditional",
18
18
  MotionSensorAction = "MotionSensorAction",
19
+ PresenceGroupAnyMovementAction = "PresenceGroupAnyMovementAction",
19
20
  PresenceGroupFirstEnterAction = "PresenceGroupFirstEnterAction",
20
21
  PresenceGroupLastLeftAction = "PresenceGroupLastLeftAction",
21
22
  RoomRestoreShutterPositionCommand = "RoomRestoreShutterPositionCommand",
@@ -20,6 +20,7 @@ var CommandType;
20
20
  CommandType["LedSetLightCommand"] = "LedSetLightCommand";
21
21
  CommandType["LightGroupSwitchTimeConditional"] = "LightGroupSwitchTimeConditional";
22
22
  CommandType["MotionSensorAction"] = "MotionSensorAction";
23
+ CommandType["PresenceGroupAnyMovementAction"] = "PresenceGroupAnyMovementAction";
23
24
  CommandType["PresenceGroupFirstEnterAction"] = "PresenceGroupFirstEnterAction";
24
25
  CommandType["PresenceGroupLastLeftAction"] = "PresenceGroupLastLeftAction";
25
26
  CommandType["RoomRestoreShutterPositionCommand"] = "RoomRestoreShutterPositionCommand";
@@ -1,4 +1,4 @@
1
- import { PresenceGroupFirstEnterAction, PresenceGroupLastLeftAction } from '../../../models';
1
+ import { PresenceGroupAnyMovementAction, PresenceGroupFirstEnterAction, PresenceGroupLastLeftAction } from '../../../models';
2
2
  import { BaseGroup } from './base-group';
3
3
  import { iMotionSensor } from '../baseDeviceInterfaces';
4
4
  export declare class PresenceGroup extends BaseGroup {
@@ -6,11 +6,13 @@ export declare class PresenceGroup extends BaseGroup {
6
6
  private _lastLeftTimeout;
7
7
  private _lastLeftCbs;
8
8
  private _firstEnterCbs;
9
+ private _anyMovementCbs;
9
10
  constructor(roomName: string, motionSensorIds: string[]);
10
11
  getMotionDetector(): Array<iMotionSensor>;
11
12
  initCallbacks(): void;
12
13
  presentAmount(): number;
13
14
  addLastLeftCallback(cb: (action: PresenceGroupLastLeftAction) => void): void;
15
+ addAnyMovementCallback(cb: (action: PresenceGroupAnyMovementAction) => void): void;
14
16
  anyPresent(): boolean;
15
17
  private fireFistEnterCBs;
16
18
  addFirstEnterCallback(cb: (action: PresenceGroupFirstEnterAction) => void): void;
@@ -26,5 +28,6 @@ export declare class PresenceGroup extends BaseGroup {
26
28
  * In case of an existing delayed last left callback timeout, this removes it.
27
29
  */
28
30
  private resetLastLeftTimeout;
31
+ private executeAnyMovementCbs;
29
32
  private executeLastLeftCbs;
30
33
  }
@@ -14,6 +14,7 @@ class PresenceGroup extends base_group_1.BaseGroup {
14
14
  this._lastLeftTimeout = null;
15
15
  this._lastLeftCbs = [];
16
16
  this._firstEnterCbs = [];
17
+ this._anyMovementCbs = [];
17
18
  this.deviceCluster.deviceMap.set(device_cluster_type_1.DeviceClusterType.MotionDetection, new device_list_1.DeviceList(motionSensorIds));
18
19
  }
19
20
  getMotionDetector() {
@@ -44,7 +45,7 @@ class PresenceGroup extends base_group_1.BaseGroup {
44
45
  (_a = this.getRoom().WindowGroup) === null || _a === void 0 ? void 0 : _a.changeVibrationMotionBlock(false);
45
46
  (_b = this.getRoom().LightGroup) === null || _b === void 0 ? void 0 : _b.switchAll(new models_1.ActuatorSetStateCommand(action, false, 'Presence Group LastLeftCallback'));
46
47
  });
47
- this.addFirstEnterCallback((action) => {
48
+ this.addAnyMovementCallback((action) => {
48
49
  if (!this.getRoom().settings.lampenBeiBewegung) {
49
50
  return;
50
51
  }
@@ -58,6 +59,9 @@ class PresenceGroup extends base_group_1.BaseGroup {
58
59
  addLastLeftCallback(cb) {
59
60
  this._lastLeftCbs.push(cb);
60
61
  }
62
+ addAnyMovementCallback(cb) {
63
+ this._anyMovementCbs.push(cb);
64
+ }
61
65
  anyPresent() {
62
66
  return this.getMotionDetector().find((b) => b.movementDetected) !== undefined;
63
67
  }
@@ -79,6 +83,7 @@ class PresenceGroup extends base_group_1.BaseGroup {
79
83
  (_a = this.getRoom().WindowGroup) === null || _a === void 0 ? void 0 : _a.changeVibrationMotionBlock(true);
80
84
  }
81
85
  services_1.RoomService.movementHistory.add(`${services_1.Utils.nowString()}: Raum "${this.roomName}" Gerät "${action.sensor.info.fullName}"`);
86
+ this.executeAnyMovementCbs(new models_1.PresenceGroupAnyMovementAction(action));
82
87
  }
83
88
  motionSensorOnLastLeft(action) {
84
89
  let timeAfterReset = this.getTimeAfterReset();
@@ -118,6 +123,11 @@ class PresenceGroup extends base_group_1.BaseGroup {
118
123
  clearTimeout(this._lastLeftTimeout);
119
124
  this._lastLeftTimeout = null;
120
125
  }
126
+ executeAnyMovementCbs(action) {
127
+ for (const cb of this._anyMovementCbs) {
128
+ cb(action);
129
+ }
130
+ }
121
131
  executeLastLeftCbs(action) {
122
132
  for (const cb of this._lastLeftCbs) {
123
133
  cb(action);
@@ -96,7 +96,7 @@ export declare abstract class AcDevice implements iExcessEnergyConsumer, iRoomDe
96
96
  /** @inheritDoc */
97
97
  persistDeviceInfo(): void;
98
98
  protected automaticCheck(): void;
99
- private onRoomFirstEnter;
99
+ private onRoomAnyMovement;
100
100
  private onRoomLastLeave;
101
101
  /** @inheritDoc */
102
102
  toJSON(): Partial<AcDevice>;
@@ -62,7 +62,7 @@ class AcDevice {
62
62
  if (room !== undefined && !this._movementCallbackAdded) {
63
63
  this._movementCallbackAdded = true;
64
64
  // TODO: Maybe change to any Movement
65
- (_a = room === null || room === void 0 ? void 0 : room.PraesenzGroup) === null || _a === void 0 ? void 0 : _a.addFirstEnterCallback(this.onRoomFirstEnter.bind(this));
65
+ (_a = room === null || room === void 0 ? void 0 : room.PraesenzGroup) === null || _a === void 0 ? void 0 : _a.addAnyMovementCallback(this.onRoomAnyMovement.bind(this));
66
66
  (_b = room === null || room === void 0 ? void 0 : room.PraesenzGroup) === null || _b === void 0 ? void 0 : _b.addLastLeftCallback(this.onRoomLastLeave.bind(this));
67
67
  }
68
68
  }
@@ -295,11 +295,11 @@ class AcDevice {
295
295
  }
296
296
  this.turnOn();
297
297
  }
298
- onRoomFirstEnter(_action) {
298
+ onRoomAnyMovement(_action) {
299
299
  if (!this.settings.noCoolingOnMovement || !this.on || this.mode === ac_mode_1.AcMode.Heating) {
300
300
  return;
301
301
  }
302
- this.log(models_1.LogLevel.Info, 'Someone entered the room. Turning off AC');
302
+ this.log(models_1.LogLevel.Info, 'Something moved in the room. Turning off AC');
303
303
  this.turnOff();
304
304
  }
305
305
  onRoomLastLeave(action) {