hoffmation-base 3.0.0-alpha.33 → 3.0.0-alpha.35

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.
@@ -110,15 +110,22 @@ class RoomBase {
110
110
  * @param c - The command to execute
111
111
  */
112
112
  setLightTimeBased(c) {
113
- var _a, _b;
113
+ var _a;
114
114
  if (!this.LightGroup) {
115
115
  this.log(logLevel_1.LogLevel.Trace, 'Ignore "setLightTimeBased" as we have no lamps');
116
116
  return;
117
117
  }
118
- if (c.movementDependant && this.PraesenzGroup && !((_a = this.PraesenzGroup) === null || _a === void 0 ? void 0 : _a.anyPresent())) {
119
- this.log(logLevel_1.LogLevel.Trace, 'Turn off lights as no-one is present.');
120
- this.LightGroup.switchAll(new command_1.ActuatorSetStateCommand(c, false, 'No one is present --> Turn off lights.'));
121
- return;
118
+ if (c.movementDependant) {
119
+ if (!this.PraesenzGroup ||
120
+ this.PraesenzGroup.deviceCluster.getDevicesByType(server_1.DeviceClusterType.MotionDetection).length === 0) {
121
+ this.log(logLevel_1.LogLevel.Trace, 'Ignore movement dependant "setLightTimeBased" as we have no Presence Group or no sensors');
122
+ return;
123
+ }
124
+ if (!this.PraesenzGroup.anyPresent()) {
125
+ this.log(logLevel_1.LogLevel.Trace, 'Turn off lights as no-one is present.');
126
+ this.LightGroup.switchAll(new command_1.ActuatorSetStateCommand(c, false, 'No one is present --> Turn off lights.'));
127
+ return;
128
+ }
122
129
  }
123
130
  if (!this.settings.lampOffset && !this.settings.roomIsAlwaysDark) {
124
131
  this.log(logLevel_1.LogLevel.Alert, `Beim Aufruf von "setLightTimeBased" im Raum ${this.roomName} liegt kein Lampen Offset vor`);
@@ -129,7 +136,7 @@ class RoomBase {
129
136
  : server_1.TimeCallbackService.dayType(this.settings.lampOffset);
130
137
  if (timeOfDay === timeCallback_1.TimeOfDay.Daylight &&
131
138
  ((this.settings.lightIfNoWindows && (!this.WindowGroup || this.WindowGroup.windows.length === 0)) ||
132
- ((_b = this.WindowGroup) === null || _b === void 0 ? void 0 : _b.windows.some((f) => {
139
+ ((_a = this.WindowGroup) === null || _a === void 0 ? void 0 : _a.windows.some((f) => {
133
140
  return server_1.ShutterService.anyRolloDown(f.getShutter());
134
141
  })))) {
135
142
  timeOfDay = server_1.Utils.nowTime().hours > 16 ? timeCallback_1.TimeOfDay.AfterSunset : timeCallback_1.TimeOfDay.BeforeSunrise;
@@ -3,7 +3,6 @@ import { iRoomDefaultSettings } from './iRoomDefaultSettings';
3
3
  import { iTimePair, SunTimeOffsets } from '../../../server';
4
4
  import { RoomSettings } from './roomSettings';
5
5
  export declare class RoomSettingsController implements iRoomDefaultSettings {
6
- constructor(room: RoomBase);
7
6
  /**
8
7
  * The name of the room this settings are for
9
8
  */
@@ -17,6 +16,7 @@ export declare class RoomSettingsController implements iRoomDefaultSettings {
17
16
  */
18
17
  lampOffset: SunTimeOffsets;
19
18
  private _settingsContainer;
19
+ constructor(room: RoomBase);
20
20
  get settingsContainer(): RoomSettings;
21
21
  get lichtSonnenAufgangAus(): boolean;
22
22
  get ambientLightAfterSunset(): boolean;
@@ -14,7 +14,7 @@ export declare class LampUtils {
14
14
  * @param {DimmerSetLightCommand} c - The command to check
15
15
  * @returns {boolean} - True if the command can be skipped
16
16
  */
17
- static checkDimmerUnchanged(device: iDimmableLamp, c: DimmerSetLightCommand): boolean;
18
- static checkUnchanged(device: iActuator, c: ActuatorSetStateCommand, noLog?: boolean): boolean;
17
+ static canDimmerChangeBeSkipped(device: iDimmableLamp, c: DimmerSetLightCommand): boolean;
18
+ static canActuatorChangeBeSkipped(device: iActuator, c: ActuatorSetStateCommand, noLog?: boolean): boolean;
19
19
  static setActuator(device: iActuator, c: ActuatorSetStateCommand): void;
20
20
  }
@@ -67,11 +67,11 @@ class LampUtils {
67
67
  * @param {DimmerSetLightCommand} c - The command to check
68
68
  * @returns {boolean} - True if the command can be skipped
69
69
  */
70
- static checkDimmerUnchanged(device, c) {
70
+ static canDimmerChangeBeSkipped(device, c) {
71
71
  if (c.isForceAction) {
72
72
  return false;
73
73
  }
74
- if (!this.checkUnchanged(device, c, true)) {
74
+ if (!this.canActuatorChangeBeSkipped(device, c, true)) {
75
75
  return false;
76
76
  }
77
77
  if (c.brightness !== device.brightness) {
@@ -80,11 +80,12 @@ class LampUtils {
80
80
  device.log(models_1.LogLevel.DeepTrace, `Light command can be skipped as the device is already in desired state: ${c.logMessage}`, services_1.LogDebugType.SkipUnchangedActuatorCommand);
81
81
  return true;
82
82
  }
83
- static checkUnchanged(device, c, noLog = false) {
83
+ static canActuatorChangeBeSkipped(device, c, noLog = false) {
84
84
  if (c.isForceAction) {
85
85
  return false;
86
86
  }
87
- if (c.on !== device.queuedValue || (device.queuedValue === null && device.actuatorOn !== c.on)) {
87
+ if ((device.queuedValue === null && device.actuatorOn !== c.on) ||
88
+ (device.queuedValue !== null && c.on === device.queuedValue)) {
88
89
  return false;
89
90
  }
90
91
  if (!noLog) {
@@ -107,7 +108,7 @@ class LampUtils {
107
108
  // Preserve the target state for the automatic handler, as
108
109
  device.targetAutomaticState = c.on;
109
110
  }
110
- if (LampUtils.checkUnchanged(device, c)) {
111
+ if (LampUtils.canActuatorChangeBeSkipped(device, c)) {
111
112
  return;
112
113
  }
113
114
  device.queuedValue = c.on;
@@ -69,7 +69,7 @@ class WledDevice extends IoBrokerBaseDevice_1.IoBrokerBaseDevice {
69
69
  if (sharedFunctions_1.LampUtils.checkBlockActive(this, c)) {
70
70
  return;
71
71
  }
72
- if (sharedFunctions_1.LampUtils.checkDimmerUnchanged(this, c)) {
72
+ if (sharedFunctions_1.LampUtils.canDimmerChangeBeSkipped(this, c)) {
73
73
  return;
74
74
  }
75
75
  if (c.isAutomaticAction) {
@@ -57,7 +57,7 @@ class ZigbeeDimmer extends zigbeeLamp_1.ZigbeeLamp {
57
57
  if (sharedFunctions_1.LampUtils.checkBlockActive(this, c)) {
58
58
  return;
59
59
  }
60
- if (sharedFunctions_1.LampUtils.checkDimmerUnchanged(this, c)) {
60
+ if (sharedFunctions_1.LampUtils.canDimmerChangeBeSkipped(this, c)) {
61
61
  return;
62
62
  }
63
63
  if (c.isAutomaticAction) {
@@ -117,7 +117,7 @@ class OwnGoveeDevice {
117
117
  if (devices_1.LampUtils.checkBlockActive(this, c)) {
118
118
  return;
119
119
  }
120
- if (devices_1.LampUtils.checkDimmerUnchanged(this, c)) {
120
+ if (devices_1.LampUtils.canDimmerChangeBeSkipped(this, c)) {
121
121
  return;
122
122
  }
123
123
  if (c.isAutomaticAction) {