hoffmation-base 3.0.0-alpha.73 → 3.0.0-alpha.75

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 (28) hide show
  1. package/lib/models/base64Image.d.ts +0 -1
  2. package/lib/models/command/ledSetLightCommand.js +4 -4
  3. package/lib/models/rooms/RoomBase.js +1 -1
  4. package/lib/server/devices/baseDeviceInterfaces/iHeater.d.ts +0 -1
  5. package/lib/server/devices/baseDeviceInterfaces/iHumiditySensor.d.ts +0 -1
  6. package/lib/server/devices/baseDeviceInterfaces/iScene.d.ts +0 -1
  7. package/lib/server/devices/baseDeviceInterfaces/iTemperatureSensor.d.ts +0 -1
  8. package/lib/server/devices/dachs/dachsTemperatureSensor.d.ts +0 -1
  9. package/lib/server/devices/groups/lightGroup.js +2 -2
  10. package/lib/server/devices/groups/presenceGroup.d.ts +3 -2
  11. package/lib/server/devices/groups/presenceGroup.js +11 -4
  12. package/lib/server/devices/hmIPDevices/hmIpHeizgruppe.d.ts +0 -1
  13. package/lib/server/devices/scene/room-scene.d.ts +0 -1
  14. package/lib/server/devices/sharedFunctions/lampUtils.js +1 -1
  15. package/lib/server/devices/shelly/shellyTrv.d.ts +0 -1
  16. package/lib/server/devices/smartGarden/smartGardenSensor.d.ts +0 -1
  17. package/lib/server/devices/zigbee/BaseDevices/zigbeeHeater.d.ts +0 -1
  18. package/lib/server/devices/zigbee/BaseDevices/zigbeeMotionSensor.d.ts +0 -1
  19. package/lib/server/devices/zigbee/BaseDevices/zigbeeShutter.d.ts +0 -1
  20. package/lib/server/devices/zigbee/zigbeeAquaraWater.d.ts +0 -1
  21. package/lib/server/devices/zigbee/zigbeeHeimanSmoke.d.ts +0 -1
  22. package/lib/server/devices/zigbee/zigbeeSonoffTemp.d.ts +0 -1
  23. package/lib/server/ioBroker/connection.d.ts +0 -2
  24. package/lib/server/services/ac/ac-device.d.ts +1 -2
  25. package/lib/server/services/ac/ac-device.js +21 -9
  26. package/lib/server/services/utils/utils.d.ts +0 -1
  27. package/lib/tsconfig.tsbuildinfo +1 -1
  28. package/package.json +20 -20
@@ -1,4 +1,3 @@
1
- /// <reference types="node" />
2
1
  export declare class Base64Image {
3
2
  data: string;
4
3
  name: string;
@@ -38,13 +38,13 @@ class LedSetLightCommand extends dimmerSetLightCommand_1.DimmerSetLightCommand {
38
38
  static byTimeBased(settings, c) {
39
39
  switch (c.time) {
40
40
  case timeCallback_1.TimeOfDay.Daylight:
41
- return new LedSetLightCommand(c, settings.dayOn, '', c.disableAutomaticCommand, settings.dayBrightness, undefined, settings.dayColor, settings.dayColorTemp);
41
+ return new LedSetLightCommand(c, settings.dayOn, `byTimeBased(${timeCallback_1.TimeOfDay[c.time]})`, c.disableAutomaticCommand, settings.dayBrightness, undefined, settings.dayColor, settings.dayColorTemp);
42
42
  case timeCallback_1.TimeOfDay.BeforeSunrise:
43
- return new LedSetLightCommand(c, settings.dawnOn, '', c.disableAutomaticCommand, settings.dawnBrightness, undefined, settings.dawnColor, settings.dawnColorTemp);
43
+ return new LedSetLightCommand(c, settings.dawnOn, `byTimeBased(${timeCallback_1.TimeOfDay[c.time]})`, c.disableAutomaticCommand, settings.dawnBrightness, undefined, settings.dawnColor, settings.dawnColorTemp);
44
44
  case timeCallback_1.TimeOfDay.AfterSunset:
45
- return new LedSetLightCommand(c, settings.duskOn, '', c.disableAutomaticCommand, settings.duskBrightness, undefined, settings.duskColor, settings.duskColorTemp);
45
+ return new LedSetLightCommand(c, settings.duskOn, `byTimeBased(${timeCallback_1.TimeOfDay[c.time]})`, c.disableAutomaticCommand, settings.duskBrightness, undefined, settings.duskColor, settings.duskColorTemp);
46
46
  case timeCallback_1.TimeOfDay.Night:
47
- return new LedSetLightCommand(c, settings.nightOn, '', c.disableAutomaticCommand, settings.nightBrightness, undefined, settings.nightColor, settings.nightColorTemp);
47
+ return new LedSetLightCommand(c, settings.nightOn, `byTimeBased(${timeCallback_1.TimeOfDay[c.time]})`, c.disableAutomaticCommand, settings.nightBrightness, undefined, settings.nightColor, settings.nightColorTemp);
48
48
  }
49
49
  }
50
50
  }
@@ -141,7 +141,7 @@ class RoomBase {
141
141
  })))) {
142
142
  timeOfDay = server_1.Utils.nowTime().hours > 16 ? timeCallback_1.TimeOfDay.AfterSunset : timeCallback_1.TimeOfDay.BeforeSunrise;
143
143
  }
144
- this.LightGroup.switchTimeConditional(new command_1.LightGroupSwitchTimeConditionalCommand(c, timeOfDay));
144
+ this.LightGroup.switchTimeConditional(new command_1.LightGroupSwitchTimeConditionalCommand(c, timeOfDay, `time: ${timeCallback_1.TimeOfDay[timeOfDay]}`));
145
145
  }
146
146
  isNowLightTime() {
147
147
  var _a;
@@ -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';
@@ -61,7 +61,7 @@ class LightGroup extends base_group_1.BaseGroup {
61
61
  let resultLampen = false;
62
62
  let resultSteckdosen = false;
63
63
  let activatedGroups = 0;
64
- const command = new models_1.LampSetTimeBasedCommand(c, c.time, 'LightGroup switchTimeConditional');
64
+ const command = new models_1.LampSetTimeBasedCommand(c, c.time);
65
65
  if (this.getWled().length > 0) {
66
66
  activatedGroups++;
67
67
  this.log(models_1.LogLevel.Debug, `Set Wled time based for time "${models_1.TimeOfDay[c.time]}"`);
@@ -196,7 +196,7 @@ class LightGroup extends base_group_1.BaseGroup {
196
196
  var _a;
197
197
  this.log(models_1.LogLevel.Info, 'Ambientenbeleuchtung um Mitternacht abschalten.');
198
198
  this._ambientLightOn = false;
199
- if (((_a = this.getRoom().PraesenzGroup) === null || _a === void 0 ? void 0 : _a.anyPresent()) !== true) {
199
+ if (((_a = this.getRoom().PraesenzGroup) === null || _a === void 0 ? void 0 : _a.anyPresent(true)) !== true) {
200
200
  this.switchAll(new models_1.ActuatorSetStateCommand(models_1.CommandSource.Automatic, false, 'Ambient Light End Callback'));
201
201
  }
202
202
  }, services_1.Utils.timeTilMidnight, this);
@@ -8,12 +8,13 @@ export declare class PresenceGroup extends BaseGroup {
8
8
  private _firstEnterCbs;
9
9
  private _anyMovementCbs;
10
10
  constructor(roomName: string, motionSensorIds: string[]);
11
+ private get lastLeftDelayActive();
11
12
  getMotionDetector(): Array<iMotionSensor>;
12
13
  initCallbacks(): void;
13
- presentAmount(): number;
14
+ anyPresent(includeMovementResetDelayCheck?: boolean): boolean;
14
15
  addLastLeftCallback(cb: (action: PresenceGroupLastLeftAction) => void): void;
15
16
  addAnyMovementCallback(cb: (action: PresenceGroupAnyMovementAction) => void): void;
16
- anyPresent(): boolean;
17
+ private presentAmount;
17
18
  private fireFistEnterCBs;
18
19
  addFirstEnterCallback(cb: (action: PresenceGroupFirstEnterAction) => void): void;
19
20
  private motionSensorOnAnyMovement;
@@ -17,6 +17,9 @@ class PresenceGroup extends base_group_1.BaseGroup {
17
17
  this._anyMovementCbs = [];
18
18
  this.deviceCluster.deviceMap.set(device_cluster_type_1.DeviceClusterType.MotionDetection, new device_list_1.DeviceList(motionSensorIds));
19
19
  }
20
+ get lastLeftDelayActive() {
21
+ return this.getTimeAfterReset() < 0;
22
+ }
20
23
  getMotionDetector() {
21
24
  return this.deviceCluster.getDevicesByType(device_cluster_type_1.DeviceClusterType.MotionDetection);
22
25
  }
@@ -53,8 +56,11 @@ class PresenceGroup extends base_group_1.BaseGroup {
53
56
  this.getRoom().setLightTimeBased(new models_1.RoomSetLightTimeBasedCommand(action, true));
54
57
  });
55
58
  }
56
- presentAmount() {
57
- 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;
58
64
  }
59
65
  addLastLeftCallback(cb) {
60
66
  this._lastLeftCbs.push(cb);
@@ -62,8 +68,8 @@ class PresenceGroup extends base_group_1.BaseGroup {
62
68
  addAnyMovementCallback(cb) {
63
69
  this._anyMovementCbs.push(cb);
64
70
  }
65
- anyPresent() {
66
- return this.getMotionDetector().find((b) => b.movementDetected) !== undefined;
71
+ presentAmount() {
72
+ return this.getMotionDetector().filter((b) => b.movementDetected).length;
67
73
  }
68
74
  fireFistEnterCBs(action) {
69
75
  for (const cb of this._firstEnterCbs) {
@@ -88,6 +94,7 @@ class PresenceGroup extends base_group_1.BaseGroup {
88
94
  motionSensorOnLastLeft(action) {
89
95
  let timeAfterReset = this.getTimeAfterReset();
90
96
  if (timeAfterReset > 0) {
97
+ this._lastLeftTimeout = null;
91
98
  this.log(models_1.LogLevel.Debug, `Movement reset. Active Motions: ${this.presentAmount()}\tTime after Last Movement including Reset: ${timeAfterReset}`);
92
99
  this.executeLastLeftCbs(new models_1.PresenceGroupLastLeftAction(action));
93
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';
@@ -9,7 +9,7 @@ class LampUtils {
9
9
  LampUtils.stromStossContinueTimeouts.set(actuator.id, services_1.Utils.guardedTimeout(() => {
10
10
  var _a, _b;
11
11
  LampUtils.stromStossContinueTimeouts.delete(actuator.id);
12
- if ((_b = (_a = actuator.room) === null || _a === void 0 ? void 0 : _a.PraesenzGroup) === null || _b === void 0 ? void 0 : _b.anyPresent()) {
12
+ if ((_b = (_a = actuator.room) === null || _a === void 0 ? void 0 : _a.PraesenzGroup) === null || _b === void 0 ? void 0 : _b.anyPresent(true)) {
13
13
  actuator.setActuator(new models_1.ActuatorSetStateCommand(models_1.CommandSource.Automatic, true, 'StromStoss On due to Presence', null));
14
14
  }
15
15
  }, actuator.settings.stromStossResendTime * 1000, this));
@@ -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';
@@ -1,9 +1,8 @@
1
- import { DeviceInfo, DeviceType, iAcDevice, iExcessEnergyConsumer, iRoomDevice, iTemporaryDisableAutomatic } from '../../devices';
1
+ import { DeviceCapability, DeviceInfo, DeviceType, iAcDevice, iExcessEnergyConsumer, iRoomDevice, iTemporaryDisableAutomatic } from '../../devices';
2
2
  import { AcSettings, ExcessEnergyConsumerSettings, LogLevel, RoomBase } from '../../../models';
3
3
  import { LogDebugType } from '../log-service';
4
4
  import { AcMode } from './ac-mode';
5
5
  import { AcDeviceType } from './acDeviceType';
6
- import { DeviceCapability } from '../../devices/DeviceCapability';
7
6
  import { BlockAutomaticHandler } from '../blockAutomaticHandler';
8
7
  export declare abstract class AcDevice implements iExcessEnergyConsumer, iRoomDevice, iAcDevice, iTemporaryDisableAutomatic {
9
8
  ip: string;
@@ -10,7 +10,6 @@ const utils_1 = require("../utils");
10
10
  const log_service_1 = require("../log-service");
11
11
  const ac_mode_1 = require("./ac-mode");
12
12
  const lodash_1 = __importDefault(require("lodash"));
13
- const DeviceCapability_1 = require("../../devices/DeviceCapability");
14
13
  const settings_service_1 = require("../settings-service");
15
14
  const config_1 = require("../../config");
16
15
  const blockAutomaticHandler_1 = require("../blockAutomaticHandler");
@@ -21,13 +20,9 @@ class AcDevice {
21
20
  * @returns {boolean} True if the AC is allowed to cool
22
21
  */
23
22
  get coolingAllowed() {
24
- var _a, _b;
25
23
  if (settings_service_1.SettingsService.heatMode !== config_1.HeatingMode.Summer) {
26
24
  return false;
27
25
  }
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())) {
29
- return false;
30
- }
31
26
  if (weather_1.WeatherService.active &&
32
27
  weather_1.WeatherService.todayMaxTemp < this.settings.minOutdoorTempForCooling &&
33
28
  weather_1.WeatherService.todayMaxTemp !== devices_1.UNDEFINED_TEMP_VALUE) {
@@ -78,7 +73,7 @@ class AcDevice {
78
73
  /** @inheritDoc */
79
74
  this.settings = new models_1.AcSettings();
80
75
  /** @inheritDoc */
81
- this.deviceCapabilities = [DeviceCapability_1.DeviceCapability.ac, DeviceCapability_1.DeviceCapability.blockAutomatic];
76
+ this.deviceCapabilities = [devices_1.DeviceCapability.ac, devices_1.DeviceCapability.blockAutomatic];
82
77
  this._activatedByExcessEnergy = false;
83
78
  this._desiredTemperatur = devices_1.UNDEFINED_TEMP_VALUE;
84
79
  this._mode = ac_mode_1.AcMode.Off;
@@ -129,7 +124,7 @@ class AcDevice {
129
124
  }
130
125
  /** @inheritDoc */
131
126
  isAvailableForExcessEnergy() {
132
- var _a, _b;
127
+ var _a, _b, _c, _d;
133
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)) {
134
129
  return false;
135
130
  }
@@ -139,7 +134,13 @@ class AcDevice {
139
134
  if (!utils_1.Utils.timeWithinBorders(this.settings.minimumHours, this.settings.minimumMinutes, this.settings.maximumHours, this.settings.maximumMinutes)) {
140
135
  return false;
141
136
  }
142
- 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;
143
144
  }
144
145
  /** @inheritDoc */
145
146
  calculateDesiredMode() {
@@ -225,10 +226,17 @@ class AcDevice {
225
226
  }
226
227
  /** @inheritDoc */
227
228
  turnOnForExcessEnergy() {
229
+ var _a, _b;
228
230
  if (this.blockAutomationHandler.automaticBlockActive) {
229
231
  return;
230
232
  }
231
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
+ }
232
240
  this.setDesiredMode(this.calculateDesiredMode(), false);
233
241
  this.turnOn();
234
242
  }
@@ -279,6 +287,7 @@ class AcDevice {
279
287
  }, 5000, this);
280
288
  }
281
289
  automaticCheck() {
290
+ var _a, _b;
282
291
  if (this.blockAutomationHandler.automaticBlockActive) {
283
292
  // We aren't allowed to turn on or off anyway --> exit
284
293
  return;
@@ -289,7 +298,10 @@ class AcDevice {
289
298
  return;
290
299
  }
291
300
  this.setDesiredMode(desiredMode, false);
292
- 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)))) {
293
305
  this.turnOff();
294
306
  return;
295
307
  }
@@ -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';