hoffmation-base 2.2.6 → 2.3.1

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,5 +1,5 @@
1
1
  import { TimeCallback } from '../timeCallback';
2
- import { BaseGroup, DeviceCluster, GroupType, HeatGroup, LampenGroup, PresenceGroup, SmokeGroup, SpeakerGroup, TasterGroup, WaterGroup, WindowGroup } from '../../server';
2
+ import { BaseGroup, DeviceCluster, GroupType, HeatGroup, LightGroup, PresenceGroup, SmokeGroup, SpeakerGroup, TasterGroup, WaterGroup, WindowGroup } from '../../server';
3
3
  import { LogLevel } from '../logLevel';
4
4
  import { RoomSettingsController } from './RoomSettings';
5
5
  import { iRoomBase } from './iRoomBase';
@@ -25,7 +25,7 @@ export declare class RoomBase implements iRoomBase, iIdHolder {
25
25
  get deviceCluster(): DeviceCluster;
26
26
  get WindowGroup(): WindowGroup | undefined;
27
27
  get PraesenzGroup(): PresenceGroup | undefined;
28
- get LampenGroup(): LampenGroup | undefined;
28
+ get LightGroup(): LightGroup | undefined;
29
29
  get TasterGroup(): TasterGroup | undefined;
30
30
  get SonosGroup(): SpeakerGroup | undefined;
31
31
  get SmokeGroup(): SmokeGroup | undefined;
@@ -21,11 +21,11 @@ class RoomBase {
21
21
  }
22
22
  get sonnenUntergangLichtCallback() {
23
23
  var _a;
24
- return (_a = this.LampenGroup) === null || _a === void 0 ? void 0 : _a.sonnenUntergangLichtCallback;
24
+ return (_a = this.LightGroup) === null || _a === void 0 ? void 0 : _a.sonnenUntergangLichtCallback;
25
25
  }
26
26
  get sonnenAufgangLichtCallback() {
27
27
  var _a;
28
- return (_a = this.LampenGroup) === null || _a === void 0 ? void 0 : _a.sonnenAufgangLichtCallback;
28
+ return (_a = this.LightGroup) === null || _a === void 0 ? void 0 : _a.sonnenAufgangLichtCallback;
29
29
  }
30
30
  get sunriseShutterCallback() {
31
31
  var _a;
@@ -54,7 +54,7 @@ class RoomBase {
54
54
  get PraesenzGroup() {
55
55
  return this.groupMap.get(server_1.GroupType.Presence);
56
56
  }
57
- get LampenGroup() {
57
+ get LightGroup() {
58
58
  return this.groupMap.get(server_1.GroupType.Light);
59
59
  }
60
60
  get TasterGroup() {
@@ -84,7 +84,7 @@ class RoomBase {
84
84
  this.recalcTimeCallbacks();
85
85
  (_a = this.PraesenzGroup) === null || _a === void 0 ? void 0 : _a.initCallbacks();
86
86
  (_b = this.WindowGroup) === null || _b === void 0 ? void 0 : _b.initialize();
87
- (_c = this.LampenGroup) === null || _c === void 0 ? void 0 : _c.initialize();
87
+ (_c = this.LightGroup) === null || _c === void 0 ? void 0 : _c.initialize();
88
88
  (_d = this.TasterGroup) === null || _d === void 0 ? void 0 : _d.initCallbacks();
89
89
  (_e = this.HeatGroup) === null || _e === void 0 ? void 0 : _e.initialize();
90
90
  }
@@ -95,7 +95,7 @@ class RoomBase {
95
95
  recalcTimeCallbacks() {
96
96
  var _a, _b;
97
97
  (_a = this.WindowGroup) === null || _a === void 0 ? void 0 : _a.recalcTimeCallbacks();
98
- (_b = this.LampenGroup) === null || _b === void 0 ? void 0 : _b.recalcTimeCallbacks();
98
+ (_b = this.LightGroup) === null || _b === void 0 ? void 0 : _b.recalculateTimeCallbacks();
99
99
  }
100
100
  /**
101
101
  * Sets the light based on the current time, rollo Position and room Settings
@@ -103,13 +103,13 @@ class RoomBase {
103
103
  */
104
104
  setLightTimeBased(movementDependant = false) {
105
105
  var _a, _b;
106
- if (!this.LampenGroup) {
106
+ if (!this.LightGroup) {
107
107
  this.log(logLevel_1.LogLevel.Trace, 'Ignore "setLightTimeBased" as we have no lamps');
108
108
  return;
109
109
  }
110
110
  if (movementDependant && this.PraesenzGroup && !((_a = this.PraesenzGroup) === null || _a === void 0 ? void 0 : _a.anyPresent())) {
111
111
  this.log(logLevel_1.LogLevel.Trace, 'Turn off lights as no-one is present.');
112
- this.LampenGroup.switchAll(false);
112
+ this.LightGroup.switchAll(false);
113
113
  return;
114
114
  }
115
115
  if (!this.settings.lampOffset && !this.settings.roomIsAlwaysDark) {
@@ -126,7 +126,7 @@ class RoomBase {
126
126
  })))) {
127
127
  timeOfDay = server_1.Utils.nowTime().hours > 16 ? timeCallback_1.TimeOfDay.AfterSunset : timeCallback_1.TimeOfDay.BeforeSunrise;
128
128
  }
129
- this.LampenGroup.switchTimeConditional(timeOfDay);
129
+ this.LightGroup.switchTimeConditional(timeOfDay);
130
130
  }
131
131
  isNowLightTime() {
132
132
  var _a;
@@ -3,7 +3,7 @@ export * from './Window';
3
3
  export * from './windowGroup';
4
4
  export * from './group-type';
5
5
  export * from './heatGroup';
6
- export * from './lampenGroup';
6
+ export * from './lightGroup';
7
7
  export * from './presenceGroup';
8
8
  export * from './smokeGroup';
9
9
  export * from './speakerGroup';
@@ -19,7 +19,7 @@ __exportStar(require("./Window"), exports);
19
19
  __exportStar(require("./windowGroup"), exports);
20
20
  __exportStar(require("./group-type"), exports);
21
21
  __exportStar(require("./heatGroup"), exports);
22
- __exportStar(require("./lampenGroup"), exports);
22
+ __exportStar(require("./lightGroup"), exports);
23
23
  __exportStar(require("./presenceGroup"), exports);
24
24
  __exportStar(require("./smokeGroup"), exports);
25
25
  __exportStar(require("./speakerGroup"), exports);
@@ -3,15 +3,15 @@ import { iActuator, iLamp } from '../baseDeviceInterfaces';
3
3
  import { TimeCallback, TimeOfDay } from '../../../models';
4
4
  import { WledDevice } from '../wledDevice';
5
5
  import { iLedRgbCct } from '../baseDeviceInterfaces/iLedRgbCct';
6
- export declare class LampenGroup extends BaseGroup {
6
+ export declare class LightGroup extends BaseGroup {
7
7
  sonnenAufgangLichtCallback: TimeCallback | undefined;
8
8
  sonnenUntergangLichtCallback: TimeCallback | undefined;
9
9
  constructor(roomName: string, lampenIds?: string[], steckerIds?: string[], ledIds?: string[], wledIds?: string[]);
10
10
  anyLightsOn(): boolean;
11
- getLampen(): iLamp[];
11
+ getLights(): iLamp[];
12
12
  getLED(): iLedRgbCct[];
13
13
  getWled(): WledDevice[];
14
- getStecker(): iActuator[];
14
+ getOutlets(): iActuator[];
15
15
  handleSunriseOff(): void;
16
16
  switchAll(target: boolean, force?: boolean): void;
17
17
  switchTimeConditional(time: TimeOfDay): void;
@@ -20,8 +20,7 @@ export declare class LampenGroup extends BaseGroup {
20
20
  setAllLED(pValue: boolean, brightness?: number, color?: string, colortemp?: number): void;
21
21
  setAllWled(pValue: boolean, brightness?: number, preset?: number): void;
22
22
  initialize(): void;
23
- recalcTimeCallbacks(): void;
24
- toJSON(): Partial<LampenGroup>;
23
+ recalculateTimeCallbacks(): void;
25
24
  private reconfigureSunriseTimeCallback;
26
25
  private reconfigureSunsetTimeCallback;
27
26
  }
@@ -1,17 +1,13 @@
1
1
  "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
2
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.LampenGroup = void 0;
3
+ exports.LightGroup = void 0;
7
4
  const services_1 = require("../../services");
8
5
  const base_group_1 = require("./base-group");
9
6
  const group_type_1 = require("./group-type");
10
7
  const device_cluster_type_1 = require("../device-cluster-type");
11
8
  const device_list_1 = require("../device-list");
12
9
  const models_1 = require("../../../models");
13
- const lodash_1 = __importDefault(require("lodash"));
14
- class LampenGroup extends base_group_1.BaseGroup {
10
+ class LightGroup extends base_group_1.BaseGroup {
15
11
  constructor(roomName, lampenIds = [], steckerIds = [], ledIds = [], wledIds = []) {
16
12
  super(roomName, group_type_1.GroupType.Light);
17
13
  this.deviceCluster.deviceMap.set(device_cluster_type_1.DeviceClusterType.Lamps, new device_list_1.DeviceList(lampenIds));
@@ -21,8 +17,8 @@ class LampenGroup extends base_group_1.BaseGroup {
21
17
  }
22
18
  anyLightsOn() {
23
19
  let i;
24
- for (i = 0; i < this.getLampen().length; i++) {
25
- if (this.getLampen()[i].lightOn) {
20
+ for (i = 0; i < this.getLights().length; i++) {
21
+ if (this.getLights()[i].lightOn) {
26
22
  return true;
27
23
  }
28
24
  }
@@ -31,8 +27,8 @@ class LampenGroup extends base_group_1.BaseGroup {
31
27
  return true;
32
28
  }
33
29
  }
34
- for (i = 0; i < this.getStecker().length; i++) {
35
- if (this.getStecker()[i].actuatorOn) {
30
+ for (i = 0; i < this.getOutlets().length; i++) {
31
+ if (this.getOutlets()[i].actuatorOn) {
36
32
  return true;
37
33
  }
38
34
  }
@@ -43,7 +39,7 @@ class LampenGroup extends base_group_1.BaseGroup {
43
39
  }
44
40
  return false;
45
41
  }
46
- getLampen() {
42
+ getLights() {
47
43
  return this.deviceCluster.getDevicesByType(device_cluster_type_1.DeviceClusterType.Lamps);
48
44
  }
49
45
  getLED() {
@@ -52,7 +48,7 @@ class LampenGroup extends base_group_1.BaseGroup {
52
48
  getWled() {
53
49
  return this.deviceCluster.getIoBrokerDevicesByType(device_cluster_type_1.DeviceClusterType.WLED);
54
50
  }
55
- getStecker() {
51
+ getOutlets() {
56
52
  return this.deviceCluster.getDevicesByType(device_cluster_type_1.DeviceClusterType.Outlets);
57
53
  }
58
54
  handleSunriseOff() {
@@ -88,7 +84,7 @@ class LampenGroup extends base_group_1.BaseGroup {
88
84
  s.setTimeBased(time);
89
85
  });
90
86
  }
91
- else if (this.getStecker().length > 0) {
87
+ else if (this.getOutlets().length > 0) {
92
88
  this.log(models_1.LogLevel.Trace, `Set outlets time based for time "${models_1.TimeOfDay[time]}"`);
93
89
  resultSteckdosen = darkOutside;
94
90
  }
@@ -100,7 +96,7 @@ class LampenGroup extends base_group_1.BaseGroup {
100
96
  this.setAllStecker(resultSteckdosen, time);
101
97
  }
102
98
  setAllLampen(pValue, time, force = false, timeout) {
103
- this.getLampen().forEach((s) => {
99
+ this.getLights().forEach((s) => {
104
100
  if (!pValue ||
105
101
  time === undefined ||
106
102
  (time === models_1.TimeOfDay.Night && s.settings.nightOn) ||
@@ -117,7 +113,7 @@ class LampenGroup extends base_group_1.BaseGroup {
117
113
  });
118
114
  }
119
115
  setAllStecker(pValue, time, force = false) {
120
- this.getStecker().forEach((s) => {
116
+ this.getOutlets().forEach((s) => {
121
117
  if (!pValue ||
122
118
  time === undefined ||
123
119
  (time === models_1.TimeOfDay.Night && s.settings.nightOn) ||
@@ -139,15 +135,12 @@ class LampenGroup extends base_group_1.BaseGroup {
139
135
  });
140
136
  }
141
137
  initialize() {
142
- this.recalcTimeCallbacks();
138
+ this.recalculateTimeCallbacks();
143
139
  }
144
- recalcTimeCallbacks() {
140
+ recalculateTimeCallbacks() {
145
141
  this.reconfigureSunriseTimeCallback();
146
142
  this.reconfigureSunsetTimeCallback();
147
143
  }
148
- toJSON() {
149
- return services_1.Utils.jsonFilter(lodash_1.default.omit(this, ['_deviceCluster']));
150
- }
151
144
  reconfigureSunriseTimeCallback() {
152
145
  const room = this.getRoom();
153
146
  if (!room.settings.lichtSonnenAufgangAus || !room.settings.lampOffset) {
@@ -200,4 +193,4 @@ class LampenGroup extends base_group_1.BaseGroup {
200
193
  }
201
194
  }
202
195
  }
203
- exports.LampenGroup = LampenGroup;
196
+ exports.LightGroup = LightGroup;
@@ -35,7 +35,7 @@ class PresenceGroup extends base_group_1.BaseGroup {
35
35
  });
36
36
  this.addLastLeftCallback(() => {
37
37
  var _a;
38
- (_a = this.getRoom().LampenGroup) === null || _a === void 0 ? void 0 : _a.switchAll(false);
38
+ (_a = this.getRoom().LightGroup) === null || _a === void 0 ? void 0 : _a.switchAll(false);
39
39
  });
40
40
  this.addFirstEnterCallback(() => {
41
41
  if (!this.getRoom().settings.lampenBeiBewegung) {
@@ -39,11 +39,11 @@ class TasterGroup extends base_group_1.BaseGroup {
39
39
  }, `All Rollos in this room to middle`);
40
40
  (_e = t.buttonMidLeft) === null || _e === void 0 ? void 0 : _e.addCb(button_1.ButtonPressType.long, (pValue) => {
41
41
  var _a;
42
- pValue && ((_a = this.getRoom().LampenGroup) === null || _a === void 0 ? void 0 : _a.switchAll(true, true));
42
+ pValue && ((_a = this.getRoom().LightGroup) === null || _a === void 0 ? void 0 : _a.switchAll(true, true));
43
43
  }, `Turn all Lights in this room on`);
44
44
  (_f = t.buttonMidRight) === null || _f === void 0 ? void 0 : _f.addCb(button_1.ButtonPressType.long, (pValue) => {
45
45
  var _a;
46
- pValue && ((_a = this.getRoom().LampenGroup) === null || _a === void 0 ? void 0 : _a.switchAll(false, true));
46
+ pValue && ((_a = this.getRoom().LightGroup) === null || _a === void 0 ? void 0 : _a.switchAll(false, true));
47
47
  }, `Turn all Lights in this room off`);
48
48
  if (((_g = services_1.SettingsService.settings.sonos) === null || _g === void 0 ? void 0 : _g.buttonBotRightForRadio) === true) {
49
49
  const sonosGroup = this.getRoom().SonosGroup;
@@ -113,7 +113,7 @@ class WindowGroup extends base_group_1.BaseGroup {
113
113
  this.allRolloToLevel(0, true);
114
114
  const room = this.getRoom();
115
115
  if (((_a = room.PraesenzGroup) === null || _a === void 0 ? void 0 : _a.anyPresent()) && room.settings.lampOffset) {
116
- (_b = room.LampenGroup) === null || _b === void 0 ? void 0 : _b.switchTimeConditional(services_1.TimeCallbackService.dayType(room.settings.lampOffset));
116
+ (_b = room.LightGroup) === null || _b === void 0 ? void 0 : _b.switchTimeConditional(services_1.TimeCallbackService.dayType(room.settings.lampOffset));
117
117
  }
118
118
  }
119
119
  reconfigureSunsetShutterCallback() {
@@ -39,10 +39,10 @@ class RoomService {
39
39
  log_service_1.ServerLogService.writeLog(models_1.LogLevel.Info, `Schalte alle Lampen in Etage ${floor} auf den Wert ${status}`);
40
40
  const rooms = floor > -1 ? this.getAllRoomsOfFloor(floor) : this.Rooms.entries();
41
41
  for (const [_name, room] of rooms) {
42
- (_a = room.LampenGroup) === null || _a === void 0 ? void 0 : _a.setAllLampen(status, -1, true, timeout);
43
- (_b = room.LampenGroup) === null || _b === void 0 ? void 0 : _b.setAllLED(status);
44
- (_c = room.LampenGroup) === null || _c === void 0 ? void 0 : _c.setAllStecker(status, -1, true);
45
- (_d = room.LampenGroup) === null || _d === void 0 ? void 0 : _d.setAllWled(status);
42
+ (_a = room.LightGroup) === null || _a === void 0 ? void 0 : _a.setAllLampen(status, -1, true, timeout);
43
+ (_b = room.LightGroup) === null || _b === void 0 ? void 0 : _b.setAllLED(status);
44
+ (_c = room.LightGroup) === null || _c === void 0 ? void 0 : _c.setAllStecker(status, -1, true);
45
+ (_d = room.LightGroup) === null || _d === void 0 ? void 0 : _d.setAllWled(status);
46
46
  }
47
47
  }
48
48
  static clearAllAlarms() {