hoffmation-base 3.0.0-alpha.30 → 3.0.0-alpha.32

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.
Files changed (105) hide show
  1. package/lib/models/action/baseAction.d.ts +4 -0
  2. package/lib/models/action/baseAction.js +10 -0
  3. package/lib/models/action/humiditySensorChangeAction.d.ts +16 -0
  4. package/lib/models/action/humiditySensorChangeAction.js +15 -0
  5. package/lib/models/action/index.d.ts +7 -0
  6. package/lib/models/action/index.js +25 -0
  7. package/lib/models/action/motionSensorAction.d.ts +16 -0
  8. package/lib/models/action/motionSensorAction.js +15 -0
  9. package/lib/models/action/presenceGroupFirstEnterAction.d.ts +7 -0
  10. package/lib/models/action/presenceGroupFirstEnterAction.js +13 -0
  11. package/lib/models/action/presenceGroupLastLeftAction.d.ts +7 -0
  12. package/lib/models/action/presenceGroupLastLeftAction.js +13 -0
  13. package/lib/models/action/shutterPositionChangedAction.d.ts +13 -0
  14. package/lib/models/action/shutterPositionChangedAction.js +15 -0
  15. package/lib/models/action/temperatureSensorChangeAction.d.ts +16 -0
  16. package/lib/models/action/temperatureSensorChangeAction.js +15 -0
  17. package/lib/models/command/ShutterSetLevelCommand.d.ts +1 -1
  18. package/lib/models/command/ShutterSetLevelCommand.js +1 -1
  19. package/lib/models/command/WindowRestoreDesiredPositionCommand.d.ts +1 -1
  20. package/lib/models/command/WindowRestoreDesiredPositionCommand.js +1 -1
  21. package/lib/models/command/WindowSetDesiredPositionCommand.d.ts +1 -1
  22. package/lib/models/command/WindowSetDesiredPositionCommand.js +1 -1
  23. package/lib/models/command/WindowSetRolloByWeatherStatusCommand.d.ts +1 -1
  24. package/lib/models/command/WindowSetRolloByWeatherStatusCommand.js +1 -1
  25. package/lib/models/command/actuatorSetStateCommand.d.ts +1 -1
  26. package/lib/models/command/actuatorSetStateCommand.js +1 -1
  27. package/lib/models/command/actuatorToggleCommand.d.ts +1 -1
  28. package/lib/models/command/actuatorToggleCommand.js +1 -1
  29. package/lib/models/command/actuatorWriteStateToDeviceCommand.d.ts +1 -1
  30. package/lib/models/command/actuatorWriteStateToDeviceCommand.js +1 -1
  31. package/lib/models/command/baseCommand.d.ts +1 -1
  32. package/lib/models/command/baseCommand.js +2 -2
  33. package/lib/models/command/blockAutomaticCommand.d.ts +1 -1
  34. package/lib/models/command/blockAutomaticCommand.js +1 -1
  35. package/lib/models/command/blockAutomaticLiftBlockCommand.d.ts +1 -1
  36. package/lib/models/command/blockAutomaticLiftBlockCommand.js +1 -1
  37. package/lib/models/command/blockAutomaticUntilCommand.d.ts +1 -1
  38. package/lib/models/command/blockAutomaticUntilCommand.js +1 -1
  39. package/lib/models/command/commandType.d.ts +6 -0
  40. package/lib/models/command/commandType.js +6 -0
  41. package/lib/models/command/dimmerSetLightCommand.d.ts +1 -1
  42. package/lib/models/command/dimmerSetLightCommand.js +1 -1
  43. package/lib/models/command/floorSetAllShuttersCommand.d.ts +1 -1
  44. package/lib/models/command/floorSetAllShuttersCommand.js +1 -1
  45. package/lib/models/command/lampSetLightCommand.d.ts +1 -1
  46. package/lib/models/command/lampSetLightCommand.js +1 -1
  47. package/lib/models/command/lampSetTimeBasedCommand.d.ts +1 -1
  48. package/lib/models/command/lampSetTimeBasedCommand.js +1 -1
  49. package/lib/models/command/lampToggleLightCommand.d.ts +1 -1
  50. package/lib/models/command/lampToggleLightCommand.js +1 -1
  51. package/lib/models/command/ledSetLightCommand.d.ts +1 -1
  52. package/lib/models/command/ledSetLightCommand.js +1 -1
  53. package/lib/models/command/lightGroupSwitchTimeConditionalCommand.d.ts +1 -1
  54. package/lib/models/command/lightGroupSwitchTimeConditionalCommand.js +1 -1
  55. package/lib/models/command/restoreTargetAutomaticValueCommand.d.ts +1 -1
  56. package/lib/models/command/restoreTargetAutomaticValueCommand.js +1 -1
  57. package/lib/models/command/roomRestoreLightCommand.d.ts +1 -1
  58. package/lib/models/command/roomRestoreLightCommand.js +1 -1
  59. package/lib/models/command/roomRestoreShutterPositionCommand.d.ts +1 -1
  60. package/lib/models/command/roomRestoreShutterPositionCommand.js +1 -1
  61. package/lib/models/command/roomSetLightTimeBasedCommand.d.ts +1 -1
  62. package/lib/models/command/roomSetLightTimeBasedCommand.js +1 -1
  63. package/lib/models/command/shutterSunriseUpCommand.d.ts +1 -1
  64. package/lib/models/command/shutterSunriseUpCommand.js +1 -1
  65. package/lib/models/command/shutterSunsetDownCommand.d.ts +1 -1
  66. package/lib/models/command/shutterSunsetDownCommand.js +1 -1
  67. package/lib/models/command/wledSetLightCommand.d.ts +1 -1
  68. package/lib/models/command/wledSetLightCommand.js +1 -1
  69. package/lib/models/index.d.ts +1 -0
  70. package/lib/models/index.js +1 -0
  71. package/lib/server/devices/baseDeviceInterfaces/iHumiditySensor.d.ts +2 -1
  72. package/lib/server/devices/baseDeviceInterfaces/iMotionSensor.d.ts +2 -2
  73. package/lib/server/devices/baseDeviceInterfaces/iShutter.d.ts +1 -1
  74. package/lib/server/devices/baseDeviceInterfaces/iTemperatureSensor.d.ts +2 -1
  75. package/lib/server/devices/blueIris/cameraDevice.d.ts +2 -2
  76. package/lib/server/devices/blueIris/cameraDevice.js +1 -1
  77. package/lib/server/devices/dachs/dachsTemperatureSensor.d.ts +2 -2
  78. package/lib/server/devices/dachs/dachsTemperatureSensor.js +3 -2
  79. package/lib/server/devices/groups/Window.d.ts +2 -2
  80. package/lib/server/devices/groups/Window.js +4 -4
  81. package/lib/server/devices/groups/presenceGroup.d.ts +4 -2
  82. package/lib/server/devices/groups/presenceGroup.js +34 -39
  83. package/lib/server/devices/hmIPDevices/hmIpBewegung.d.ts +2 -2
  84. package/lib/server/devices/hmIPDevices/hmIpBewegung.js +1 -1
  85. package/lib/server/devices/hmIPDevices/hmIpHeizgruppe.d.ts +3 -3
  86. package/lib/server/devices/hmIPDevices/hmIpHeizgruppe.js +4 -4
  87. package/lib/server/devices/hmIPDevices/hmIpPraezenz.d.ts +8 -8
  88. package/lib/server/devices/hmIPDevices/hmIpPraezenz.js +9 -9
  89. package/lib/server/devices/hmIPDevices/hmIpRoll.js +1 -1
  90. package/lib/server/devices/index.d.ts +5 -3
  91. package/lib/server/devices/index.js +7 -4
  92. package/lib/server/devices/sharedFunctions/lampUtils.d.ts +10 -2
  93. package/lib/server/devices/sharedFunctions/lampUtils.js +29 -5
  94. package/lib/server/devices/wledDevice.js +7 -0
  95. package/lib/server/devices/zigbee/BaseDevices/zigbeeDimmer.js +7 -0
  96. package/lib/server/devices/zigbee/BaseDevices/zigbeeMotionSensor.d.ts +3 -3
  97. package/lib/server/devices/zigbee/BaseDevices/zigbeeMotionSensor.js +1 -1
  98. package/lib/server/devices/zigbee/BaseDevices/zigbeeShutter.d.ts +1 -1
  99. package/lib/server/devices/zigbee/BaseDevices/zigbeeShutter.js +1 -1
  100. package/lib/server/devices/zigbee/zigbeeSonoffTemp.d.ts +3 -2
  101. package/lib/server/devices/zigbee/zigbeeSonoffTemp.js +4 -4
  102. package/lib/server/services/ac/ac-device.js +3 -3
  103. package/lib/server/services/govee/own-govee-device.js +7 -0
  104. package/lib/tsconfig.tsbuildinfo +1 -1
  105. package/package.json +1 -1
@@ -9,7 +9,7 @@ export declare class LedSetLightCommand extends DimmerSetLightCommand {
9
9
  color: string;
10
10
  colorTemp: number;
11
11
  /** @inheritDoc */
12
- _commandType: CommandType;
12
+ type: CommandType;
13
13
  /**
14
14
  * Command to set the light-state of a Led-Device
15
15
  * @param source - The source of the command
@@ -22,7 +22,7 @@ class LedSetLightCommand extends dimmerSetLightCommand_1.DimmerSetLightCommand {
22
22
  this.color = color;
23
23
  this.colorTemp = colorTemp;
24
24
  /** @inheritDoc */
25
- this._commandType = commandType_1.CommandType.LedSetLightCommand;
25
+ this.type = commandType_1.CommandType.LedSetLightCommand;
26
26
  }
27
27
  /** @inheritDoc */
28
28
  get logMessage() {
@@ -5,7 +5,7 @@ import { TimeOfDay } from '../timeCallback';
5
5
  export declare class LightGroupSwitchTimeConditionalCommand extends BaseCommand {
6
6
  readonly time: TimeOfDay;
7
7
  /** @inheritDoc */
8
- _commandType: CommandType;
8
+ type: CommandType;
9
9
  /**
10
10
  * Command to switch a light group in accordance to a specific time of the day
11
11
  * @param source - The source of the command
@@ -14,7 +14,7 @@ class LightGroupSwitchTimeConditionalCommand extends baseCommand_1.BaseCommand {
14
14
  super(source, reason);
15
15
  this.time = time;
16
16
  /** @inheritDoc */
17
- this._commandType = commandType_1.CommandType.LightGroupSwitchTimeConditional;
17
+ this.type = commandType_1.CommandType.LightGroupSwitchTimeConditional;
18
18
  }
19
19
  }
20
20
  exports.LightGroupSwitchTimeConditionalCommand = LightGroupSwitchTimeConditionalCommand;
@@ -3,7 +3,7 @@ import { CommandSource } from './commandSource';
3
3
  import { CommandType } from './commandType';
4
4
  export declare class RestoreTargetAutomaticValueCommand extends BaseCommand {
5
5
  /** @inheritDoc */
6
- _commandType: CommandType;
6
+ type: CommandType;
7
7
  /**
8
8
  * Command to restore the target automatic value of an actuator
9
9
  * @param source - The source of the command
@@ -12,7 +12,7 @@ class RestoreTargetAutomaticValueCommand extends baseCommand_1.BaseCommand {
12
12
  constructor(source, reason = '') {
13
13
  super(source, reason);
14
14
  /** @inheritDoc */
15
- this._commandType = commandType_1.CommandType.ActuatorRestoreTargetAutomaticValueCommand;
15
+ this.type = commandType_1.CommandType.ActuatorRestoreTargetAutomaticValueCommand;
16
16
  }
17
17
  }
18
18
  exports.RestoreTargetAutomaticValueCommand = RestoreTargetAutomaticValueCommand;
@@ -3,7 +3,7 @@ import { CommandType } from './commandType';
3
3
  import { CommandSource } from './commandSource';
4
4
  export declare class RoomRestoreLightCommand extends BaseCommand {
5
5
  /** @inheritDoc */
6
- _commandType: CommandType;
6
+ type: CommandType;
7
7
  /**
8
8
  * Command to restore the normal automatic light-state of a room
9
9
  * @param source - The source of the command
@@ -12,7 +12,7 @@ class RoomRestoreLightCommand extends baseCommand_1.BaseCommand {
12
12
  constructor(source, reason = '') {
13
13
  super(source, reason);
14
14
  /** @inheritDoc */
15
- this._commandType = commandType_1.CommandType.RoomRestoreLightCommand;
15
+ this.type = commandType_1.CommandType.RoomRestoreLightCommand;
16
16
  }
17
17
  }
18
18
  exports.RoomRestoreLightCommand = RoomRestoreLightCommand;
@@ -4,7 +4,7 @@ import { CommandType } from './commandType';
4
4
  export declare class RoomRestoreShutterPositionCommand extends BaseCommand {
5
5
  readonly recalc: boolean;
6
6
  /** @inheritDoc */
7
- _commandType: CommandType;
7
+ type: CommandType;
8
8
  /**
9
9
  * Command to restore the normal automatic shutter position of a room
10
10
  * @param source - The source of the command
@@ -14,7 +14,7 @@ class RoomRestoreShutterPositionCommand extends baseCommand_1.BaseCommand {
14
14
  super(source, reason);
15
15
  this.recalc = recalc;
16
16
  /** @inheritDoc */
17
- this._commandType = commandType_1.CommandType.RoomRestoreShutterPositionCommand;
17
+ this.type = commandType_1.CommandType.RoomRestoreShutterPositionCommand;
18
18
  }
19
19
  }
20
20
  exports.RoomRestoreShutterPositionCommand = RoomRestoreShutterPositionCommand;
@@ -4,7 +4,7 @@ import { CommandSource } from './commandSource';
4
4
  export declare class RoomSetLightTimeBasedCommand extends BaseCommand {
5
5
  readonly movementDependant: boolean;
6
6
  /** @inheritDoc */
7
- _commandType: CommandType;
7
+ type: CommandType;
8
8
  /**
9
9
  * Sets the light based on the current time, rollo Position and room Settings
10
10
  * @param source - The source of the command
@@ -14,7 +14,7 @@ class RoomSetLightTimeBasedCommand extends baseCommand_1.BaseCommand {
14
14
  super(source, reason);
15
15
  this.movementDependant = movementDependant;
16
16
  /** @inheritDoc */
17
- this._commandType = commandType_1.CommandType.RoomSetLightTimeBasedCommand;
17
+ this.type = commandType_1.CommandType.RoomSetLightTimeBasedCommand;
18
18
  }
19
19
  }
20
20
  exports.RoomSetLightTimeBasedCommand = RoomSetLightTimeBasedCommand;
@@ -3,7 +3,7 @@ import { CommandSource } from './commandSource';
3
3
  import { CommandType } from './commandType';
4
4
  export declare class ShutterSunriseUpCommand extends BaseCommand {
5
5
  /** @inheritDoc */
6
- _commandType: CommandType;
6
+ type: CommandType;
7
7
  /**
8
8
  * Command to perform actions when the shutter should be opened due to sunrise
9
9
  * @param source - The source of the command
@@ -12,7 +12,7 @@ class ShutterSunriseUpCommand extends baseCommand_1.BaseCommand {
12
12
  constructor(source, reason = '') {
13
13
  super(source, reason);
14
14
  /** @inheritDoc */
15
- this._commandType = commandType_1.CommandType.ShutterSunriseUpCommand;
15
+ this.type = commandType_1.CommandType.ShutterSunriseUpCommand;
16
16
  }
17
17
  }
18
18
  exports.ShutterSunriseUpCommand = ShutterSunriseUpCommand;
@@ -3,7 +3,7 @@ import { CommandSource } from './commandSource';
3
3
  import { CommandType } from './commandType';
4
4
  export declare class ShutterSunsetDownCommand extends BaseCommand {
5
5
  /** @inheritDoc */
6
- _commandType: CommandType;
6
+ type: CommandType;
7
7
  /**
8
8
  * Command to perform actions when the shutter is closing due to sunset
9
9
  * @param source - The source of the command
@@ -12,7 +12,7 @@ class ShutterSunsetDownCommand extends baseCommand_1.BaseCommand {
12
12
  constructor(source, reason = '') {
13
13
  super(source, reason);
14
14
  /** @inheritDoc */
15
- this._commandType = commandType_1.CommandType.SunsetDownCommand;
15
+ this.type = commandType_1.CommandType.SunsetDownCommand;
16
16
  }
17
17
  }
18
18
  exports.ShutterSunsetDownCommand = ShutterSunsetDownCommand;
@@ -8,7 +8,7 @@ import { BlockAutomaticCommand } from './blockAutomaticCommand';
8
8
  export declare class WledSetLightCommand extends DimmerSetLightCommand {
9
9
  preset?: number | undefined;
10
10
  /** @inheritDoc */
11
- _commandType: CommandType;
11
+ type: CommandType;
12
12
  /**
13
13
  * Command to set the light state of a WLED device
14
14
  * @param source - The source of the command
@@ -20,7 +20,7 @@ class WledSetLightCommand extends dimmerSetLightCommand_1.DimmerSetLightCommand
20
20
  super(source, on, reason, disableAutomatic, brightness, transitionTime);
21
21
  this.preset = preset;
22
22
  /** @inheritDoc */
23
- this._commandType = commandType_1.CommandType.WledSetLightCommand;
23
+ this.type = commandType_1.CommandType.WledSetLightCommand;
24
24
  }
25
25
  get logMessage() {
26
26
  var _a;
@@ -1,3 +1,4 @@
1
+ export * from './action/index';
1
2
  export * from './rooms/index';
2
3
  export * from './deviceSettings/index';
3
4
  export * from './persistence/index';
@@ -15,6 +15,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
17
  exports.BlockAutomaticSettings = void 0;
18
+ __exportStar(require("./action/index"), exports);
18
19
  __exportStar(require("./rooms/index"), exports);
19
20
  __exportStar(require("./deviceSettings/index"), exports);
20
21
  __exportStar(require("./persistence/index"), exports);
@@ -1,5 +1,6 @@
1
1
  /// <reference types="node" />
2
2
  import { iRoomDevice } from './iRoomDevice';
3
+ import { HumiditySensorChangeAction } from '../../../models';
3
4
  export declare const UNDEFINED_HUMIDITY_VALUE = -1;
4
5
  /**
5
6
  * This interface represents a humidity sensor device.
@@ -20,7 +21,7 @@ export interface iHumiditySensor extends iRoomDevice {
20
21
  * Add a callback that is called when the humidity changes
21
22
  * @param pCallback - The callback to fire
22
23
  */
23
- addHumidityCallback(pCallback: (pValue: number) => void): void;
24
+ addHumidityCallback(pCallback: (action: HumiditySensorChangeAction) => void): void;
24
25
  /**
25
26
  * Persists the current humidity information to the database
26
27
  */
@@ -1,4 +1,4 @@
1
- import { MotionSensorSettings } from '../../../models';
1
+ import { MotionSensorAction, MotionSensorSettings } from '../../../models';
2
2
  import { iRoomDevice } from './iRoomDevice';
3
3
  /**
4
4
  * This interface represents a motion sensor device.
@@ -26,7 +26,7 @@ export interface iMotionSensor extends iRoomDevice {
26
26
  * Adds a callback for when a motion state has changed.
27
27
  * @param pCallback - Function that accepts the new state as parameter
28
28
  */
29
- addMovementCallback(pCallback: (newState: boolean) => void): void;
29
+ addMovementCallback(pCallback: (action: MotionSensorAction) => void): void;
30
30
  /**
31
31
  * Persists the current motion information to the database
32
32
  */
@@ -14,7 +14,7 @@ export interface iShutter extends iRoomDevice {
14
14
  /**
15
15
  * The current level of the shutter (0 = closed, 100 = open)
16
16
  */
17
- currentLevel: number;
17
+ readonly currentLevel: number;
18
18
  /**
19
19
  * The desired level of the shutter for this window (this might be different from the current level due to the desired level being set by the user)
20
20
  */
@@ -1,5 +1,6 @@
1
1
  /// <reference types="node" />
2
2
  import { iRoomDevice } from './iRoomDevice';
3
+ import { TemperatureSensorChangeAction } from '../../../models';
3
4
  export declare const UNDEFINED_TEMP_VALUE = -99;
4
5
  /**
5
6
  * This interface represents a temperature sensor device.
@@ -28,7 +29,7 @@ export interface iTemperatureSensor extends iRoomDevice {
28
29
  * Adds a callback to be called when the temperature changes
29
30
  * @param pCallback - The callback to be called
30
31
  */
31
- addTempChangeCallback(pCallback: (pValue: number) => void): void;
32
+ addTempChangeCallback(pCallback: (action: TemperatureSensorChangeAction) => void): void;
32
33
  /**
33
34
  * Inform the temperature sensor that the temperature in the room has changed
34
35
  * @param newTemperatur - The new temperature in the room in Celsius
@@ -1,5 +1,5 @@
1
1
  import { iBaseDevice, iCameraDevice, iRoomDevice } from '../baseDeviceInterfaces';
2
- import { CameraSettings, LogLevel, RoomBase } from '../../../models';
2
+ import { CameraSettings, LogLevel, MotionSensorAction, RoomBase } from '../../../models';
3
3
  import { LogDebugType } from '../../services';
4
4
  import { DeviceInfo } from '../DeviceInfo';
5
5
  import { DeviceCapability } from '../DeviceCapability';
@@ -66,7 +66,7 @@ export declare class CameraDevice implements iCameraDevice {
66
66
  /** @inheritDoc */
67
67
  get room(): RoomBase | undefined;
68
68
  /** @inheritDoc */
69
- addMovementCallback(pCallback: (newState: boolean) => void): void;
69
+ addMovementCallback(pCallback: (action: MotionSensorAction) => void): void;
70
70
  /** @inheritDoc */
71
71
  blockForDevice(device: iBaseDevice, block: boolean): void;
72
72
  /** @inheritDoc */
@@ -237,7 +237,7 @@ class CameraDevice {
237
237
  this.log(models_1.LogLevel.Trace, `This is movement no. ${this.detectionsToday}`);
238
238
  }
239
239
  for (const c of this._movementDetectedCallback) {
240
- c(newState);
240
+ c(new models_1.MotionSensorAction(this));
241
241
  }
242
242
  }
243
243
  resetPersonDetectFallbackTimer() {
@@ -4,7 +4,7 @@ import { LogDebugType, OwnSonosDevice } from '../../services';
4
4
  import { DeviceCapability } from '../DeviceCapability';
5
5
  import { DeviceType } from '../deviceType';
6
6
  import { DeviceInfo } from '../DeviceInfo';
7
- import { DeviceSettings, LogLevel, RoomBase } from '../../../models';
7
+ import { DeviceSettings, LogLevel, RoomBase, TemperatureSensorChangeAction } from '../../../models';
8
8
  export declare class DachsTemperatureSensor implements iTemperatureSensor {
9
9
  /** @inheritDoc */
10
10
  settings: DeviceSettings | undefined;
@@ -39,7 +39,7 @@ export declare class DachsTemperatureSensor implements iTemperatureSensor {
39
39
  private set temperature(value);
40
40
  update(newTemp: number): void;
41
41
  /** @inheritDoc */
42
- addTempChangeCallback(pCallback: (pValue: number) => void): void;
42
+ addTempChangeCallback(pCallback: (action: TemperatureSensorChangeAction) => void): void;
43
43
  /** @inheritDoc */
44
44
  onTemperaturChange(newTemperatur: number): void;
45
45
  /** @inheritDoc */
@@ -11,6 +11,7 @@ const deviceType_1 = require("../deviceType");
11
11
  const DeviceInfo_1 = require("../DeviceInfo");
12
12
  const devices_1 = require("../devices");
13
13
  const lodash_1 = __importDefault(require("lodash"));
14
+ const models_1 = require("../../../models");
14
15
  class DachsTemperatureSensor {
15
16
  constructor(roomName, shortKey, longKey) {
16
17
  /** @inheritDoc */
@@ -76,7 +77,7 @@ class DachsTemperatureSensor {
76
77
  set temperature(val) {
77
78
  this._temperature = val;
78
79
  for (const cb of this._temperaturCallbacks) {
79
- cb(val);
80
+ cb(new models_1.TemperatureSensorChangeAction(this, val));
80
81
  }
81
82
  }
82
83
  update(newTemp) {
@@ -86,7 +87,7 @@ class DachsTemperatureSensor {
86
87
  addTempChangeCallback(pCallback) {
87
88
  this._temperaturCallbacks.push(pCallback);
88
89
  if (this._temperature > baseDeviceInterfaces_1.UNDEFINED_TEMP_VALUE) {
89
- pCallback(this._temperature);
90
+ pCallback(new models_1.TemperatureSensorChangeAction(this, this._temperature));
90
91
  }
91
92
  }
92
93
  /** @inheritDoc */
@@ -1,6 +1,6 @@
1
1
  import { HmIpGriff } from '../hmIPDevices';
2
2
  import { WindowPosition } from '../models';
3
- import { WindowRestoreDesiredPositionCommand, WindowSetDesiredPositionCommand } from '../../../models';
3
+ import { ShutterPositionChangedAction, WindowRestoreDesiredPositionCommand, WindowSetDesiredPositionCommand } from '../../../models';
4
4
  import { iShutter, iVibrationSensor } from '../baseDeviceInterfaces';
5
5
  import { BaseGroup } from './base-group';
6
6
  import { ZigbeeMagnetContact } from '../zigbee';
@@ -27,6 +27,6 @@ export declare class Window extends BaseGroup {
27
27
  getVibration(): iVibrationSensor[];
28
28
  griffeInPosition(pPosition: WindowPosition): number;
29
29
  initialize(): void;
30
- rolloPositionChange(pValue: number): void;
30
+ rolloPositionChange(action: ShutterPositionChangedAction): void;
31
31
  restoreDesiredPosition(c: WindowRestoreDesiredPositionCommand): void;
32
32
  }
@@ -104,10 +104,10 @@ class Window extends base_group_1.BaseGroup {
104
104
  });
105
105
  }, 5, this);
106
106
  }
107
- rolloPositionChange(pValue) {
108
- this.log(models_2.LogLevel.Debug, `Rollo Position Change in ${this.roomName} to ${pValue}`, pValue == this._desiredPosition ? services_1.LogDebugType.None : services_1.LogDebugType.ShutterPositionChange);
109
- if (pValue === 0 || pValue === 100) {
110
- this.getRoom().setLightTimeBased(new models_2.RoomSetLightTimeBasedCommand(models_2.CommandSource.Automatic, true, 'Window.rolloPositionChange'));
107
+ rolloPositionChange(action) {
108
+ this.log(models_2.LogLevel.Debug, `Rollo Position Change in ${this.roomName}: ${action.reasonTrace}`, action.newPosition == this._desiredPosition ? services_1.LogDebugType.None : services_1.LogDebugType.ShutterPositionChange);
109
+ if (action.newPosition === 0 || action.newPosition === 100) {
110
+ this.getRoom().setLightTimeBased(new models_2.RoomSetLightTimeBasedCommand(action, true));
111
111
  }
112
112
  }
113
113
  restoreDesiredPosition(c) {
@@ -1,3 +1,4 @@
1
+ import { PresenceGroupFirstEnterAction, PresenceGroupLastLeftAction } from '../../../models';
1
2
  import { BaseGroup } from './base-group';
2
3
  import { iMotionSensor } from '../baseDeviceInterfaces';
3
4
  export declare class PresenceGroup extends BaseGroup {
@@ -8,10 +9,11 @@ export declare class PresenceGroup extends BaseGroup {
8
9
  constructor(roomName: string, motionSensorIds: string[]);
9
10
  getMotionDetector(): Array<iMotionSensor>;
10
11
  initCallbacks(): void;
12
+ addLastLeftCallback(cb: (action: PresenceGroupLastLeftAction) => void): void;
11
13
  presentAmount(): number;
12
14
  anyPresent(): boolean;
13
- addLastLeftCallback(cb: () => void): void;
14
- addFirstEnterCallback(cb: () => void): void;
15
+ addFirstEnterCallback(cb: (action: PresenceGroupFirstEnterAction) => void): void;
16
+ private motionSensorAnyMovement;
15
17
  private motionSensorOnLastLeft;
16
18
  /**
17
19
  * In case of an existing delayed last left callback timeout, this removes it.
@@ -21,43 +21,28 @@ class PresenceGroup extends base_group_1.BaseGroup {
21
21
  }
22
22
  initCallbacks() {
23
23
  this.getMotionDetector().forEach((b) => {
24
- b.addMovementCallback((val) => {
25
- var _a;
26
- if (!val) {
27
- return;
28
- }
29
- if (services_1.RoomService.awayModeActive || (services_1.RoomService.nightAlarmActive && !b.settings.excludeFromNightAlarm)) {
30
- services_1.RoomService.startIntrusionAlarm(this.getRoom(), b);
31
- }
32
- if (!b.settings.seesWindow) {
33
- (_a = this.getRoom().WindowGroup) === null || _a === void 0 ? void 0 : _a.changeVibrationMotionBlock(true);
34
- }
35
- services_1.RoomService.movementHistory.add(`${services_1.Utils.nowString()}: Raum "${this.roomName}" Gerät "${b.info.fullName}"`);
24
+ b.addMovementCallback((action) => {
25
+ this.motionSensorOnFirstEnter(action);
26
+ this.motionSensorOnLastLeft(action);
27
+ this.motionSensorAnyMovement(action);
36
28
  });
37
29
  });
38
- this.addLastLeftCallback(() => {
30
+ this.addLastLeftCallback((action) => {
39
31
  var _a, _b;
40
32
  (_a = this.getRoom().WindowGroup) === null || _a === void 0 ? void 0 : _a.changeVibrationMotionBlock(false);
41
- (_b = this.getRoom().LightGroup) === null || _b === void 0 ? void 0 : _b.switchAll(new models_1.ActuatorSetStateCommand(models_1.CommandSource.Automatic, false, 'Presence Group LastLeftCallback'));
33
+ (_b = this.getRoom().LightGroup) === null || _b === void 0 ? void 0 : _b.switchAll(new models_1.ActuatorSetStateCommand(action, false, 'Presence Group LastLeftCallback'));
42
34
  });
43
- this.addFirstEnterCallback(() => {
35
+ this.addFirstEnterCallback((action) => {
44
36
  if (!this.getRoom().settings.lampenBeiBewegung) {
45
37
  return;
46
38
  }
47
39
  this.log(models_1.LogLevel.DeepTrace, `Bewegung im Raum ${this.roomName} festgestellt --> Licht einschalten`);
48
- this.getRoom().setLightTimeBased(new models_1.RoomSetLightTimeBasedCommand(models_1.CommandSource.Automatic, true, 'Motion detected'));
49
- });
50
- this.getMotionDetector().forEach((b) => {
51
- b.addMovementCallback((val) => {
52
- this.motionSensorOnFirstEnter(val);
53
- });
54
- });
55
- this.getMotionDetector().forEach((b) => {
56
- b.addMovementCallback((val) => {
57
- this.motionSensorOnLastLeft(val);
58
- });
40
+ this.getRoom().setLightTimeBased(new models_1.RoomSetLightTimeBasedCommand(action, true));
59
41
  });
60
42
  }
43
+ addLastLeftCallback(cb) {
44
+ this._lastLeftCbs.push(cb);
45
+ }
61
46
  presentAmount() {
62
47
  let count = 0;
63
48
  for (let i = 0; i < this.getMotionDetector().length; i++) {
@@ -75,21 +60,31 @@ class PresenceGroup extends base_group_1.BaseGroup {
75
60
  }
76
61
  return false;
77
62
  }
78
- addLastLeftCallback(cb) {
79
- this._lastLeftCbs.push(cb);
80
- }
81
63
  addFirstEnterCallback(cb) {
82
64
  this._firstEnterCbs.push(cb);
83
65
  }
84
- motionSensorOnLastLeft(val) {
85
- if (val || this.anyPresent()) {
66
+ motionSensorAnyMovement(action) {
67
+ var _a;
68
+ if (!action.motionDetected) {
69
+ return;
70
+ }
71
+ if (services_1.RoomService.awayModeActive || (services_1.RoomService.nightAlarmActive && !action.sensor.settings.excludeFromNightAlarm)) {
72
+ services_1.RoomService.startIntrusionAlarm(this.getRoom(), action.sensor);
73
+ }
74
+ if (!action.sensor.settings.seesWindow) {
75
+ (_a = this.getRoom().WindowGroup) === null || _a === void 0 ? void 0 : _a.changeVibrationMotionBlock(true);
76
+ }
77
+ services_1.RoomService.movementHistory.add(`${services_1.Utils.nowString()}: Raum "${this.roomName}" Gerät "${action.sensor.info.fullName}"`);
78
+ }
79
+ motionSensorOnLastLeft(action) {
80
+ if (action.motionDetected || this.anyPresent()) {
86
81
  this.resetLastLeftTimeout();
87
82
  return;
88
83
  }
89
84
  let timeAfterReset = services_1.Utils.nowMS() - this._lastMovement.getTime() - this.getRoom().settings.movementResetTimer * 1000;
90
85
  if (timeAfterReset > 0) {
91
86
  this.log(models_1.LogLevel.Debug, `Movement reset. Active Motions: ${this.presentAmount()}\tTime after Last Movement including Reset: ${timeAfterReset}`);
92
- this.executeLastLeftCbs();
87
+ this.executeLastLeftCbs(new models_1.PresenceGroupLastLeftAction(action));
93
88
  return;
94
89
  }
95
90
  this.log(models_1.LogLevel.Debug, `Movement reset in ${this.roomName} delayed.`);
@@ -98,9 +93,9 @@ class PresenceGroup extends base_group_1.BaseGroup {
98
93
  timeAfterReset =
99
94
  services_1.Utils.nowMS() - this._lastMovement.getTime() - this.getRoom().settings.movementResetTimer * 1000;
100
95
  const presentAmount = this.presentAmount();
101
- this.log(models_1.LogLevel.Debug, `Delayed Movement reset. Active Motions: ${this.presentAmount()}\tTime after Last Movement including Reset: ${timeAfterReset}`);
96
+ this.log(models_1.LogLevel.Debug, `Delayed Movement reset. Active Motions: ${this.presentAmount()}\tTime after Last Movement including Reset: ${timeAfterReset}, action: ${action.reasonTrace}`);
102
97
  if (presentAmount <= 0 && timeAfterReset > 0) {
103
- this.executeLastLeftCbs();
98
+ this.executeLastLeftCbs(new models_1.PresenceGroupLastLeftAction(action));
104
99
  }
105
100
  }, Math.abs(timeAfterReset) + 500, this);
106
101
  }
@@ -112,8 +107,8 @@ class PresenceGroup extends base_group_1.BaseGroup {
112
107
  clearTimeout(this._lastLeftTimeout);
113
108
  }
114
109
  }
115
- motionSensorOnFirstEnter(val) {
116
- if (!val) {
110
+ motionSensorOnFirstEnter(action) {
111
+ if (!action.motionDetected) {
117
112
  return;
118
113
  }
119
114
  this._lastMovement = new Date();
@@ -121,12 +116,12 @@ class PresenceGroup extends base_group_1.BaseGroup {
121
116
  return;
122
117
  }
123
118
  for (const cb of this._firstEnterCbs) {
124
- cb();
119
+ cb(new models_1.PresenceGroupFirstEnterAction(action));
125
120
  }
126
121
  }
127
- executeLastLeftCbs() {
122
+ executeLastLeftCbs(action) {
128
123
  for (const cb of this._lastLeftCbs) {
129
- cb();
124
+ cb(action);
130
125
  }
131
126
  }
132
127
  }
@@ -1,5 +1,5 @@
1
1
  import { HmIPDevice } from './hmIpDevice';
2
- import { MotionSensorSettings } from '../../../models';
2
+ import { MotionSensorAction, MotionSensorSettings } from '../../../models';
3
3
  import { iIlluminationSensor, iMotionSensor } from '../baseDeviceInterfaces';
4
4
  import { IoBrokerDeviceInfo } from '../IoBrokerDeviceInfo';
5
5
  export declare class HmIpBewegung extends HmIPDevice implements iIlluminationSensor, iMotionSensor {
@@ -21,7 +21,7 @@ export declare class HmIpBewegung extends HmIPDevice implements iIlluminationSen
21
21
  get timeSinceLastMotion(): number;
22
22
  get currentIllumination(): number;
23
23
  private set currentIllumination(value);
24
- addMovementCallback(pCallback: (pValue: boolean) => void): void;
24
+ addMovementCallback(pCallback: (action: MotionSensorAction) => void): void;
25
25
  persistMotionSensor(): void;
26
26
  /** @inheritDoc */
27
27
  update(idSplit: string[], state: ioBroker.State, initial?: boolean): void;
@@ -99,7 +99,7 @@ class HmIpBewegung extends hmIpDevice_1.HmIPDevice {
99
99
  this.log(models_1.LogLevel.Trace, `Dies ist die ${this.detectionsToday} Bewegung `);
100
100
  }
101
101
  for (const c of this._movementDetectedCallback) {
102
- c(pVal);
102
+ c(new models_1.MotionSensorAction(this));
103
103
  }
104
104
  }
105
105
  resetFallbackTimeout() {
@@ -1,7 +1,7 @@
1
1
  /// <reference types="node" />
2
2
  import { HmIPDevice } from './hmIpDevice';
3
3
  import { iDisposable } from '../../services';
4
- import { HeaterSettings } from '../../../models';
4
+ import { HeaterSettings, HumiditySensorChangeAction, TemperatureSensorChangeAction } from '../../../models';
5
5
  import { iHeater, iHumiditySensor, iTemperatureSensor } from '../baseDeviceInterfaces';
6
6
  import { IoBrokerDeviceInfo } from '../IoBrokerDeviceInfo';
7
7
  export declare class HmIpHeizgruppe extends HmIPDevice implements iTemperatureSensor, iHumiditySensor, iHeater, iDisposable {
@@ -48,14 +48,14 @@ export declare class HmIpHeizgruppe extends HmIPDevice implements iTemperatureSe
48
48
  /** @inheritDoc */
49
49
  get roomTemperature(): number;
50
50
  /** @inheritDoc */
51
- addHumidityCallback(pCallback: (pValue: number) => void): void;
51
+ addHumidityCallback(pCallback: (action: HumiditySensorChangeAction) => void): void;
52
52
  getBelongingHeizungen(): iHeater[];
53
53
  /** @inheritDoc */
54
54
  update(idSplit: string[], state: ioBroker.State, initial?: boolean): void;
55
55
  /** @inheritDoc */
56
56
  checkAutomaticChange(): void;
57
57
  /** @inheritDoc */
58
- addTempChangeCallback(pCallback: (pValue: number) => void): void;
58
+ addTempChangeCallback(pCallback: (action: TemperatureSensorChangeAction) => void): void;
59
59
  /** @inheritDoc */
60
60
  onTemperaturChange(newTemperatur: number): void;
61
61
  /** @inheritDoc */
@@ -67,7 +67,7 @@ class HmIpHeizgruppe extends hmIpDevice_1.HmIPDevice {
67
67
  set temperature(val) {
68
68
  this._temperature = val;
69
69
  for (const cb of this._temperatureCallbacks) {
70
- cb(val);
70
+ cb(new models_1.TemperatureSensorChangeAction(this, val));
71
71
  }
72
72
  }
73
73
  /** @inheritDoc */
@@ -77,7 +77,7 @@ class HmIpHeizgruppe extends hmIpDevice_1.HmIPDevice {
77
77
  set humidity(val) {
78
78
  this._humidity = val;
79
79
  for (const cb of this._humidityCallbacks) {
80
- cb(val);
80
+ cb(new models_1.HumiditySensorChangeAction(this, val));
81
81
  }
82
82
  }
83
83
  /** @inheritDoc */
@@ -115,7 +115,7 @@ class HmIpHeizgruppe extends hmIpDevice_1.HmIPDevice {
115
115
  addHumidityCallback(pCallback) {
116
116
  this._humidityCallbacks.push(pCallback);
117
117
  if (this._humidity > 0) {
118
- pCallback(this._humidity);
118
+ pCallback(new models_1.HumiditySensorChangeAction(this, this._humidity));
119
119
  }
120
120
  }
121
121
  getBelongingHeizungen() {
@@ -155,7 +155,7 @@ class HmIpHeizgruppe extends hmIpDevice_1.HmIPDevice {
155
155
  addTempChangeCallback(pCallback) {
156
156
  this._temperatureCallbacks.push(pCallback);
157
157
  if (this._temperature > baseDeviceInterfaces_1.UNDEFINED_TEMP_VALUE) {
158
- pCallback(this._temperature);
158
+ pCallback(new models_1.TemperatureSensorChangeAction(this, this._temperature));
159
159
  }
160
160
  }
161
161
  /** @inheritDoc */