hoffmation-base 0.1.30-8 → 0.1.31-3

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 (72) hide show
  1. package/lib/index.d.ts +1 -4
  2. package/lib/index.js +2 -8
  3. package/lib/models/rooms/RoomBase.d.ts +16 -53
  4. package/lib/models/rooms/RoomBase.js +45 -222
  5. package/lib/models/rooms/index.d.ts +1 -0
  6. package/lib/models/rooms/index.js +1 -0
  7. package/lib/models/rooms/roomInfo.d.ts +6 -0
  8. package/lib/models/rooms/roomInfo.js +10 -0
  9. package/lib/server/config/iConfig.d.ts +1 -1
  10. package/lib/server/devices/Fenster.d.ts +7 -7
  11. package/lib/server/devices/Fenster.js +63 -55
  12. package/lib/server/devices/IoBrokerBaseDevice.d.ts +1 -5
  13. package/lib/server/devices/IoBrokerBaseDevice.js +5 -8
  14. package/lib/server/devices/device-cluster-type.d.ts +16 -0
  15. package/lib/server/devices/device-cluster-type.js +20 -0
  16. package/lib/server/devices/device-cluster.d.ts +10 -0
  17. package/lib/server/devices/device-cluster.js +20 -0
  18. package/lib/server/devices/device-list.d.ts +8 -0
  19. package/lib/server/devices/device-list.js +24 -0
  20. package/lib/server/devices/devices.d.ts +0 -2
  21. package/lib/server/devices/devices.js +0 -5
  22. package/lib/server/devices/groups/base-group.d.ts +11 -0
  23. package/lib/server/devices/groups/base-group.js +20 -0
  24. package/lib/server/devices/groups/fensterGroup.d.ts +4 -5
  25. package/lib/server/devices/groups/fensterGroup.js +42 -47
  26. package/lib/server/devices/groups/group-type.d.ts +11 -0
  27. package/lib/server/devices/groups/group-type.js +15 -0
  28. package/lib/server/devices/groups/heatGroup.d.ts +4 -5
  29. package/lib/server/devices/groups/heatGroup.js +18 -14
  30. package/lib/server/devices/groups/index.d.ts +6 -4
  31. package/lib/server/devices/groups/index.js +6 -4
  32. package/lib/server/devices/groups/lampenGroup.d.ts +7 -8
  33. package/lib/server/devices/groups/lampenGroup.js +54 -50
  34. package/lib/server/devices/groups/praesenzGroup.d.ts +5 -6
  35. package/lib/server/devices/groups/praesenzGroup.js +54 -44
  36. package/lib/server/devices/groups/smokeGroup.d.ts +4 -5
  37. package/lib/server/devices/groups/smokeGroup.js +12 -8
  38. package/lib/server/devices/groups/sonosGroup.d.ts +4 -5
  39. package/lib/server/devices/groups/sonosGroup.js +13 -9
  40. package/lib/server/devices/groups/tasterGroup.d.ts +4 -5
  41. package/lib/server/devices/groups/tasterGroup.js +27 -13
  42. package/lib/server/devices/groups/waterGroup.d.ts +4 -5
  43. package/lib/server/devices/groups/waterGroup.js +12 -8
  44. package/lib/server/devices/hmIPDevices/hmIpBewegung.js +2 -2
  45. package/lib/server/devices/hmIPDevices/hmIpGriff.js +5 -3
  46. package/lib/server/devices/hmIPDevices/hmIpPraezenz.js +2 -2
  47. package/lib/server/devices/iLamp.d.ts +2 -1
  48. package/lib/server/devices/index.d.ts +3 -0
  49. package/lib/server/devices/index.js +3 -0
  50. package/lib/server/devices/zigbee/zigbeeAquaraMotion.js +2 -2
  51. package/lib/server/devices/zigbee/zigbeeHeimanSmoke.js +2 -2
  52. package/lib/server/ioBroker/ioBroker.main.d.ts +2 -0
  53. package/lib/server/ioBroker/ioBroker.main.js +1 -2
  54. package/lib/server/services/ShutterService.d.ts +6 -0
  55. package/lib/server/services/ShutterService.js +38 -8
  56. package/lib/server/services/Telegram/telegram-Commands.js +7 -7
  57. package/lib/server/services/api/api-service.d.ts +10 -0
  58. package/lib/server/services/api/api-service.js +20 -0
  59. package/lib/server/services/api/index.d.ts +1 -0
  60. package/lib/server/services/{rest → api}/index.js +1 -1
  61. package/lib/server/services/dbo/persist.js +5 -2
  62. package/lib/server/services/index.d.ts +2 -1
  63. package/lib/server/services/index.js +2 -1
  64. package/lib/server/services/room-service/room-service.d.ts +41 -0
  65. package/lib/server/services/room-service/room-service.js +198 -0
  66. package/lib/server/services/utils/utils.d.ts +1 -0
  67. package/lib/server/services/utils/utils.js +9 -0
  68. package/lib/tsconfig.tsbuildinfo +1 -1
  69. package/package.json +2 -4
  70. package/lib/server/services/rest/index.d.ts +0 -1
  71. package/lib/server/services/rest/rest-service.d.ts +0 -6
  72. package/lib/server/services/rest/rest-service.js +0 -28
package/lib/index.d.ts CHANGED
@@ -1,15 +1,12 @@
1
- import { Express } from 'express';
2
1
  import { Devices, iConfig, ioBrokerMain, OwnSonosDevice } from './server';
3
2
  export * from './models/index';
4
3
  export * from './server/index';
5
4
  export declare class HoffmationInitializationObject {
6
5
  config: iConfig;
7
- readonly app: Express;
8
- constructor(config: iConfig, app: Express);
6
+ constructor(config: iConfig);
9
7
  }
10
8
  export declare class HoffmationBase {
11
9
  static ioMain: ioBrokerMain;
12
- private static _app;
13
10
  static initializeBeforeIoBroker(initObject: HoffmationInitializationObject): Promise<void>;
14
11
  static initializePostIoBroker(defaultMuellSonos?: OwnSonosDevice): void;
15
12
  static startIoBroker(devices: Devices): void;
package/lib/index.js CHANGED
@@ -13,13 +13,11 @@ Object.defineProperty(exports, "__esModule", { value: true });
13
13
  exports.HoffmationBase = exports.HoffmationInitializationObject = void 0;
14
14
  const models_1 = require("./models");
15
15
  const server_1 = require("./server");
16
- const rest_service_1 = require("./server/services/rest/rest-service");
17
16
  __exportStar(require("./models/index"), exports);
18
17
  __exportStar(require("./server/index"), exports);
19
18
  class HoffmationInitializationObject {
20
- constructor(config, app) {
19
+ constructor(config) {
21
20
  this.config = config;
22
- this.app = app;
23
21
  }
24
22
  }
25
23
  exports.HoffmationInitializationObject = HoffmationInitializationObject;
@@ -37,7 +35,6 @@ class HoffmationBase {
37
35
  else {
38
36
  server_1.Persist.turnOff();
39
37
  }
40
- this._app = initObject.app;
41
38
  if (server_1.SettingsService.settings.mp3Server) {
42
39
  server_1.ServerLogService.writeLog(models_1.LogLevel.Info, `Mp3Server settings detected --> initializing`);
43
40
  new server_1.MP3Server(server_1.SettingsService.settings.mp3Server);
@@ -54,7 +51,7 @@ class HoffmationBase {
54
51
  server_1.ServerLogService.writeLog(models_1.LogLevel.Info, `Hoffmation-Base First Initializations finished`);
55
52
  }
56
53
  static initializePostIoBroker(defaultMuellSonos) {
57
- var _a, _b;
54
+ var _a;
58
55
  server_1.ServerLogService.writeLog(models_1.LogLevel.Info, `Hoffmation-Base Post ioBrokerInitializations`);
59
56
  if (server_1.SettingsService.TelegramActive)
60
57
  server_1.TelegramCommands.initialize();
@@ -77,9 +74,6 @@ class HoffmationBase {
77
74
  });
78
75
  if (server_1.SettingsService.TelegramActive)
79
76
  server_1.TelegramService.publishCommands();
80
- if ((_b = server_1.SettingsService.settings.restServer) === null || _b === void 0 ? void 0 : _b.active) {
81
- rest_service_1.RestService.initialize(this._app, server_1.SettingsService.settings.restServer);
82
- }
83
77
  server_1.ServerLogService.writeLog(models_1.LogLevel.Info, `Hoffmation-Base Post ioBrokerInitializations finished`);
84
78
  }
85
79
  static startIoBroker(devices) {
@@ -1,70 +1,37 @@
1
- import { ringStorage } from '../../server/services/utils/ringstorage';
2
1
  import { TimeCallback } from '../timeCallback';
3
2
  import { TasterGroup } from '../../server/devices/groups/tasterGroup';
4
3
  import { PraesenzGroup } from '../../server/devices/groups/praesenzGroup';
5
4
  import { HeatGroup } from '../../server/devices/groups/heatGroup';
6
5
  import { WaterGroup } from '../../server/devices/groups/waterGroup';
7
- import { IoBrokerBaseDevice } from '../../server/devices/IoBrokerBaseDevice';
8
6
  import { LampenGroup } from '../../server/devices/groups/lampenGroup';
9
7
  import { RoomSettings } from './RoomSettings/RoomSettings';
10
8
  import { SmokeGroup } from '../../server/devices/groups/smokeGroup';
11
9
  import { FensterGroup } from '../../server/devices/groups/fensterGroup';
12
10
  import { SonosGroup } from '../../server/devices/groups/sonosGroup';
13
11
  import { iRoomBase } from './iRoomBase';
12
+ import { RoomInfo } from './roomInfo';
13
+ import { BaseGroup } from '../../server/devices/groups/base-group';
14
+ import { GroupType } from '../../server/devices/groups/group-type';
14
15
  export declare class RoomBase implements iRoomBase {
15
- roomName: string;
16
16
  Einstellungen: RoomSettings;
17
- static Rooms: {
18
- [name: string]: RoomBase;
19
- };
20
- static allRooms: RoomBase[];
21
- static floors: {
22
- [level: number]: RoomBase[];
23
- };
24
- static awayModeActive: boolean;
25
- static nightAlarmActive: boolean;
26
- static movementHistory: ringStorage;
27
- FensterGroup: FensterGroup;
28
- PraesenzGroup: PraesenzGroup;
29
- LampenGroup: LampenGroup;
30
- TasterGroup: TasterGroup;
31
- SonosGroup: SonosGroup;
32
- SmokeGroup: SmokeGroup;
33
- WaterGroup: WaterGroup;
34
- HeatGroup: HeatGroup;
17
+ groups: Map<GroupType, BaseGroup>;
18
+ info: RoomInfo;
19
+ get FensterGroup(): FensterGroup | undefined;
20
+ get PraesenzGroup(): PraesenzGroup | undefined;
21
+ get LampenGroup(): LampenGroup | undefined;
22
+ get TasterGroup(): TasterGroup | undefined;
23
+ get SonosGroup(): SonosGroup | undefined;
24
+ get SmokeGroup(): SmokeGroup | undefined;
25
+ get WaterGroup(): WaterGroup | undefined;
26
+ get HeatGroup(): HeatGroup | undefined;
35
27
  Settings: RoomSettings;
36
28
  sonnenAufgangCallback: TimeCallback | undefined;
37
29
  sonnenUntergangCallback: TimeCallback | undefined;
38
30
  sonnenAufgangLichtCallback: TimeCallback | undefined;
39
31
  skipNextRolloUp: boolean;
40
- private static _awayModeTimer;
41
- private static _nightModeTimer;
42
- private static _intrusionAlarmActive;
43
- private static _intrusionAlarmLevel;
44
- private static _intrusionAlarmTimeout;
45
- static addToRoomList(room: RoomBase): void;
46
- static getAllRoomsOfFloor(floor: number): Array<RoomBase>;
47
- /**
48
- * Set ALl Roolos of a specific floor
49
- * !!floor -1 sets all rollos in house instead!!
50
- * @param floor the level on which all rollos shall be changed -1 equals all rooms
51
- * @param position (0 equals down, 100 up)
52
- */
53
- static setAllRolloOfFloor(floor?: number, position?: number): void;
54
- /**
55
- * Set ALl Lamps of a specific floor
56
- * !!floor -1 sets all lamps in house instead!!
57
- * @param floor the level on which all lamps shall be changed -1 equals all rooms
58
- * @param status
59
- */
60
- static setAllLampsOfFloor(floor: number, status?: boolean): void;
61
- static clearAllAlarms(): void;
62
- static startAwayMode(): void;
63
- static startNightAlarmMode(): void;
64
- static startIntrusionAlarm(room: iRoomBase, device: IoBrokerBaseDevice): void;
65
- static endAlarmModes(): void;
66
- static getLastMovements(): string;
67
- constructor(roomName: string, Einstellungen: RoomSettings);
32
+ get roomName(): string;
33
+ get etage(): number | undefined;
34
+ constructor(roomName: string, Einstellungen: RoomSettings, groups: Map<GroupType, BaseGroup>);
68
35
  initializeBase(): void;
69
36
  persist(): void;
70
37
  recalcTimeCallbacks(): void;
@@ -74,8 +41,4 @@ export declare class RoomBase implements iRoomBase {
74
41
  */
75
42
  setLightTimeBased(movementDependant?: boolean): void;
76
43
  isNowLightTime(): boolean;
77
- private static stopIntrusionAlarm;
78
- private static performNextIntrusionLevel;
79
- private static restoreRolloPosition;
80
- private static restoreLight;
81
44
  }
@@ -1,159 +1,61 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.RoomBase = void 0;
4
- const ringstorage_1 = require("../../server/services/utils/ringstorage");
5
- const tasterGroup_1 = require("../../server/devices/groups/tasterGroup");
6
- const praesenzGroup_1 = require("../../server/devices/groups/praesenzGroup");
7
- const telegram_service_1 = require("../../server/services/Telegram/telegram-service");
8
- const heatGroup_1 = require("../../server/devices/groups/heatGroup");
9
4
  const logLevel_1 = require("../logLevel");
10
- const waterGroup_1 = require("../../server/devices/groups/waterGroup");
11
5
  const log_service_1 = require("../../server/services/log-service");
12
- const utils_1 = require("../../server/services/utils/utils");
13
- const lampenGroup_1 = require("../../server/devices/groups/lampenGroup");
14
- const smokeGroup_1 = require("../../server/devices/groups/smokeGroup");
15
- const fensterGroup_1 = require("../../server/devices/groups/fensterGroup");
16
6
  const persist_1 = require("../../server/services/dbo/persist");
17
7
  const time_callback_service_1 = require("../../server/services/time-callback-service");
18
- const sonos_service_1 = require("../../server/services/Sonos/sonos-service");
19
- const sonosGroup_1 = require("../../server/devices/groups/sonosGroup");
20
- const res_1 = require("../../server/services/Translation/res");
8
+ const room_service_1 = require("../../server/services/room-service/room-service");
9
+ const roomInfo_1 = require("./roomInfo");
10
+ const group_type_1 = require("../../server/devices/groups/group-type");
11
+ const ShutterService_1 = require("../../server/services/ShutterService");
21
12
  class RoomBase {
22
- constructor(roomName, Einstellungen) {
23
- this.roomName = roomName;
13
+ constructor(roomName, Einstellungen, groups) {
24
14
  this.Einstellungen = Einstellungen;
25
- this.FensterGroup = new fensterGroup_1.FensterGroup(this, []);
26
- this.PraesenzGroup = new praesenzGroup_1.PraesenzGroup(this, [], []);
27
- this.LampenGroup = new lampenGroup_1.LampenGroup(this, [], [], []);
28
- this.TasterGroup = new tasterGroup_1.TasterGroup(this, []);
29
- this.SonosGroup = new sonosGroup_1.SonosGroup(this, []);
30
- this.SmokeGroup = new smokeGroup_1.SmokeGroup(this, []);
31
- this.WaterGroup = new waterGroup_1.WaterGroup(this, []);
32
- this.HeatGroup = new heatGroup_1.HeatGroup(this, []);
15
+ this.groups = groups;
33
16
  this.skipNextRolloUp = false;
34
- if (Einstellungen.etage !== undefined) {
35
- const level = Einstellungen.etage;
36
- if (RoomBase.floors[level] === undefined) {
37
- RoomBase.floors[level] = [];
38
- }
39
- RoomBase.floors[level].push(this);
40
- }
17
+ this.info = new roomInfo_1.RoomInfo(roomName, Einstellungen);
41
18
  Einstellungen.room = this;
42
19
  this.Settings = Einstellungen;
43
- RoomBase.allRooms.push(this);
20
+ room_service_1.RoomService.addToRoomList(this);
44
21
  }
45
- static addToRoomList(room) {
46
- RoomBase.Rooms[room.roomName] = room;
22
+ get FensterGroup() {
23
+ return this.groups.get(group_type_1.GroupType.Window);
47
24
  }
48
- static getAllRoomsOfFloor(floor) {
49
- return this.floors[floor];
25
+ get PraesenzGroup() {
26
+ return this.groups.get(group_type_1.GroupType.Presence);
50
27
  }
51
- /**
52
- * Set ALl Roolos of a specific floor
53
- * !!floor -1 sets all rollos in house instead!!
54
- * @param floor the level on which all rollos shall be changed -1 equals all rooms
55
- * @param position (0 equals down, 100 up)
56
- */
57
- static setAllRolloOfFloor(floor = -1, position = 0) {
58
- const rooms = floor > -1 ? this.getAllRoomsOfFloor(floor) : this.allRooms;
59
- for (const room of rooms) {
60
- room.FensterGroup.allRolloToLevel(position, true);
61
- }
28
+ get LampenGroup() {
29
+ return this.groups.get(group_type_1.GroupType.Light);
62
30
  }
63
- /**
64
- * Set ALl Lamps of a specific floor
65
- * !!floor -1 sets all lamps in house instead!!
66
- * @param floor the level on which all lamps shall be changed -1 equals all rooms
67
- * @param status
68
- */
69
- static setAllLampsOfFloor(floor, status = false) {
70
- log_service_1.ServerLogService.writeLog(logLevel_1.LogLevel.Info, `Schalte alle Lampen in Etage ${floor} auf den Wert ${status}`);
71
- const rooms = floor > -1 ? this.getAllRoomsOfFloor(floor) : this.allRooms;
72
- for (const room of rooms) {
73
- room.LampenGroup.setAllLampen(status, -1, true);
74
- room.LampenGroup.setAllLED(status);
75
- room.LampenGroup.setAllStecker(status, -1, true);
76
- }
31
+ get TasterGroup() {
32
+ return this.groups.get(group_type_1.GroupType.Buttons);
77
33
  }
78
- static clearAllAlarms() {
79
- for (const r of RoomBase.allRooms) {
80
- if (r.WaterGroup) {
81
- r.WaterGroup.stopAlarm();
82
- }
83
- if (r.SmokeGroup) {
84
- r.SmokeGroup.stopAlarm();
85
- }
86
- }
87
- this.stopIntrusionAlarm();
88
- this.restoreRolloPosition();
89
- this.restoreLight();
34
+ get SonosGroup() {
35
+ return this.groups.get(group_type_1.GroupType.Speaker);
90
36
  }
91
- static startAwayMode() {
92
- sonos_service_1.SonosService.speakOnAll(res_1.Res.alarmArmed(), 40);
93
- if (this._awayModeTimer) {
94
- clearTimeout(this._awayModeTimer);
95
- }
96
- this._awayModeTimer = utils_1.Utils.guardedTimeout(() => {
97
- this.awayModeActive = true;
98
- this._awayModeTimer = undefined;
99
- telegram_service_1.TelegramService.inform(`Alarm ist nun scharf. Gute Reise!`);
100
- }, 60000, this);
37
+ get SmokeGroup() {
38
+ return this.groups.get(group_type_1.GroupType.Smoke);
101
39
  }
102
- static startNightAlarmMode() {
103
- sonos_service_1.SonosService.speakOnAll(res_1.Res.alarmNightModeArmed(), 30);
104
- if (this._nightModeTimer) {
105
- clearTimeout(this._nightModeTimer);
106
- }
107
- this._nightModeTimer = utils_1.Utils.guardedTimeout(() => {
108
- this.nightAlarmActive = true;
109
- this._nightModeTimer = undefined;
110
- telegram_service_1.TelegramService.inform(`Alarm ist nun scharf. Süße Träume!`);
111
- }, 60000, this);
40
+ get WaterGroup() {
41
+ return this.groups.get(group_type_1.GroupType.Water);
112
42
  }
113
- static startIntrusionAlarm(room, device) {
114
- const message = `!Potenzieller Eindringling! Bewegung in ${room.roomName} von ${device.info.fullName} festgestellt`;
115
- log_service_1.ServerLogService.writeLog(logLevel_1.LogLevel.Info, message);
116
- if (!this.awayModeActive && !this.nightAlarmActive) {
117
- this.stopIntrusionAlarm();
118
- return;
119
- }
120
- utils_1.Utils.guardedNewThread(() => {
121
- telegram_service_1.TelegramService.inform(message);
122
- }, this);
123
- if (this._intrusionAlarmActive) {
124
- return;
125
- }
126
- this._intrusionAlarmActive = true;
127
- this.performNextIntrusionLevel();
43
+ get HeatGroup() {
44
+ return this.groups.get(group_type_1.GroupType.Heating);
128
45
  }
129
- static endAlarmModes() {
130
- if (this.awayModeActive) {
131
- telegram_service_1.TelegramService.sendMessage(telegram_service_1.TelegramService.subscribedIDs, `Alarmanalage entschärft`);
132
- sonos_service_1.SonosService.speakOnAll(res_1.Res.welcomeHome(), 35);
133
- }
134
- if (this.nightAlarmActive) {
135
- telegram_service_1.TelegramService.sendMessage(telegram_service_1.TelegramService.subscribedIDs, `Nachtmodus der Alarmanlage entschärft`);
136
- sonos_service_1.SonosService.speakOnAll(res_1.Res.goodMorning(), 30);
137
- }
138
- if (this._nightModeTimer) {
139
- clearTimeout(this._nightModeTimer);
140
- }
141
- if (this._awayModeTimer) {
142
- clearTimeout(this._awayModeTimer);
143
- }
144
- this.awayModeActive = false;
145
- this.nightAlarmActive = false;
146
- this.stopIntrusionAlarm();
46
+ get roomName() {
47
+ return this.info.roomName;
147
48
  }
148
- static getLastMovements() {
149
- return this.movementHistory.readAmount(15).join('\n');
49
+ get etage() {
50
+ return this.info.etage;
150
51
  }
151
52
  initializeBase() {
53
+ var _a, _b, _c;
152
54
  log_service_1.ServerLogService.writeLog(logLevel_1.LogLevel.Debug, `RoomBase Init für ${this.roomName}`);
153
55
  this.recalcTimeCallbacks();
154
- this.PraesenzGroup.initCallbacks();
155
- this.FensterGroup.initCallbacks();
156
- this.TasterGroup.initCallbacks();
56
+ (_a = this.PraesenzGroup) === null || _a === void 0 ? void 0 : _a.initCallbacks();
57
+ (_b = this.FensterGroup) === null || _b === void 0 ? void 0 : _b.initialize();
58
+ (_c = this.TasterGroup) === null || _c === void 0 ? void 0 : _c.initCallbacks();
157
59
  }
158
60
  persist() {
159
61
  persist_1.Persist.addRoom(this);
@@ -180,7 +82,11 @@ class RoomBase {
180
82
  * @param movementDependant Only turn light on if there was a movement in the same room
181
83
  */
182
84
  setLightTimeBased(movementDependant = false) {
183
- if (movementDependant && !this.PraesenzGroup.anyPresent()) {
85
+ var _a, _b;
86
+ if (!this.LampenGroup) {
87
+ return;
88
+ }
89
+ if (movementDependant && this.PraesenzGroup && !((_a = this.PraesenzGroup) === null || _a === void 0 ? void 0 : _a.anyPresent())) {
184
90
  this.LampenGroup.switchAll(false);
185
91
  return;
186
92
  }
@@ -190,111 +96,28 @@ class RoomBase {
190
96
  }
191
97
  let timeOfDay = time_callback_service_1.TimeCallbackService.dayType(this.Einstellungen.lampOffset);
192
98
  if (timeOfDay === time_callback_service_1.TimeOfDay.Daylight &&
193
- ((this.Einstellungen.lightIfNoWindows && this.FensterGroup.fenster.length === 0) ||
194
- this.FensterGroup.fenster.some((f) => {
195
- var _a, _b;
196
- const rolloDown = ((_a = f.rollo) === null || _a === void 0 ? void 0 : _a.currentLevel) === 0;
197
- log_service_1.ServerLogService.writeLog(logLevel_1.LogLevel.Debug, `Rollo ${(_b = f.rollo) === null || _b === void 0 ? void 0 : _b.info.customName} for light in ${this.roomName} is ${rolloDown ? '' : 'not '}down`);
198
- return rolloDown;
199
- }))) {
99
+ ((this.Einstellungen.lightIfNoWindows && (!this.FensterGroup || this.FensterGroup.fenster.length === 0)) ||
100
+ ((_b = this.FensterGroup) === null || _b === void 0 ? void 0 : _b.fenster.some((f) => {
101
+ return ShutterService_1.ShutterService.anyRolloDown(f.getShutter());
102
+ })))) {
200
103
  timeOfDay = time_callback_service_1.TimeOfDay.AfterSunset;
201
104
  }
202
105
  this.LampenGroup.switchTimeConditional(timeOfDay);
203
106
  }
204
107
  isNowLightTime() {
108
+ var _a;
205
109
  if (!this.Einstellungen.lampOffset) {
206
110
  log_service_1.ServerLogService.writeLog(logLevel_1.LogLevel.Alert, `Beim Aufruf von "setLightTimeBased" im Raum ${this.roomName} liegt kein Lampen Offset vor`);
207
111
  return false;
208
112
  }
209
113
  let timeOfDay = time_callback_service_1.TimeCallbackService.dayType(this.Einstellungen.lampOffset);
210
114
  if (timeOfDay === time_callback_service_1.TimeOfDay.Daylight &&
211
- this.FensterGroup.fenster.some((f) => {
212
- var _a;
213
- return ((_a = f.rollo) === null || _a === void 0 ? void 0 : _a.currentLevel) === 0;
214
- })) {
115
+ ((_a = this.FensterGroup) === null || _a === void 0 ? void 0 : _a.fenster.some((f) => {
116
+ return ShutterService_1.ShutterService.anyRolloDown(f.getShutter());
117
+ }))) {
215
118
  timeOfDay = time_callback_service_1.TimeOfDay.AfterSunset;
216
119
  }
217
120
  return time_callback_service_1.TimeCallbackService.darkOutsideOrNight(timeOfDay);
218
121
  }
219
- static stopIntrusionAlarm() {
220
- log_service_1.ServerLogService.writeLog(logLevel_1.LogLevel.Info, `Stoppe Intrusion Alarm`);
221
- if (this._intrusionAlarmTimeout) {
222
- clearTimeout(this._intrusionAlarmTimeout);
223
- }
224
- if (!this._intrusionAlarmActive) {
225
- return;
226
- }
227
- this._intrusionAlarmActive = false;
228
- this._intrusionAlarmLevel = 0;
229
- log_service_1.ServerLogService.writeLog(logLevel_1.LogLevel.Alert, `Alarm wurde beendet --> Fahre Rollos in Ausgangsposition.`);
230
- this.restoreRolloPosition();
231
- this.restoreLight();
232
- }
233
- static performNextIntrusionLevel() {
234
- this._intrusionAlarmTimeout = undefined;
235
- if (!this.awayModeActive && !this._intrusionAlarmActive) {
236
- return;
237
- }
238
- this._intrusionAlarmLevel += 1;
239
- let speakMessage;
240
- let volume = 50;
241
- let newTimeout = 20000;
242
- const alarmAutomaticEnd = 15;
243
- if (this._intrusionAlarmLevel === 1) {
244
- speakMessage = res_1.Res.intruderGreeting();
245
- volume = 40;
246
- }
247
- else if (this._intrusionAlarmLevel === 2) {
248
- speakMessage = res_1.Res.intruderShutterUpPleaseLeave();
249
- utils_1.Utils.guardedNewThread(() => {
250
- this.setAllRolloOfFloor(-1, 100);
251
- this.setAllLampsOfFloor(-1, true);
252
- }, this);
253
- }
254
- else if (this._intrusionAlarmLevel === 3) {
255
- volume = 70;
256
- speakMessage = res_1.Res.intruderLeaveAndOwnerInformed();
257
- }
258
- else if (this._intrusionAlarmLevel <= 5) {
259
- volume = 80;
260
- speakMessage = res_1.Res.intruderAdditionalDefenseWarning();
261
- }
262
- else if (this._intrusionAlarmLevel >= alarmAutomaticEnd) {
263
- this.stopIntrusionAlarm();
264
- return;
265
- }
266
- else {
267
- volume = 90;
268
- speakMessage = res_1.Res.intruderAlarm();
269
- newTimeout = 10000;
270
- }
271
- this._intrusionAlarmTimeout = utils_1.Utils.guardedTimeout(() => {
272
- this.performNextIntrusionLevel();
273
- }, newTimeout, this);
274
- utils_1.Utils.guardedNewThread(() => {
275
- sonos_service_1.SonosService.speakOnAll(speakMessage, volume);
276
- telegram_service_1.TelegramService.inform(`Eindringling erhielt folgende Nachricht: "${speakMessage}"\nAlarmlevel ist ${this._intrusionAlarmLevel}\t Automatisches Ende bei ${alarmAutomaticEnd}`);
277
- }, this);
278
- }
279
- static restoreRolloPosition() {
280
- const rooms = this.allRooms;
281
- for (const room of rooms) {
282
- room.FensterGroup.restoreRolloPosition();
283
- }
284
- }
285
- static restoreLight() {
286
- const rooms = this.allRooms;
287
- for (const room of rooms) {
288
- room.setLightTimeBased(true);
289
- }
290
- }
291
122
  }
292
123
  exports.RoomBase = RoomBase;
293
- RoomBase.Rooms = {};
294
- RoomBase.allRooms = [];
295
- RoomBase.floors = {};
296
- RoomBase.awayModeActive = false;
297
- RoomBase.nightAlarmActive = false;
298
- RoomBase.movementHistory = new ringstorage_1.ringStorage(15);
299
- RoomBase._intrusionAlarmActive = false;
300
- RoomBase._intrusionAlarmLevel = 0;
@@ -2,3 +2,4 @@ export * from './iRoomBase';
2
2
  export * from './RoomBase';
3
3
  export * from './iRoomImportEnforcer';
4
4
  export * from './RoomSettings/index';
5
+ export * from './roomInfo';
@@ -14,3 +14,4 @@ __exportStar(require("./iRoomBase"), exports);
14
14
  __exportStar(require("./RoomBase"), exports);
15
15
  __exportStar(require("./iRoomImportEnforcer"), exports);
16
16
  __exportStar(require("./RoomSettings/index"), exports);
17
+ __exportStar(require("./roomInfo"), exports);
@@ -0,0 +1,6 @@
1
+ import { RoomSettings } from './RoomSettings/RoomSettings';
2
+ export declare class RoomInfo {
3
+ roomName: string;
4
+ etage?: number;
5
+ constructor(roomName: string, settings: RoomSettings);
6
+ }
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.RoomInfo = void 0;
4
+ class RoomInfo {
5
+ constructor(roomName, settings) {
6
+ this.roomName = roomName;
7
+ this.etage = settings.etage;
8
+ }
9
+ }
10
+ exports.RoomInfo = RoomInfo;
@@ -5,7 +5,7 @@ interface iSonosSettings {
5
5
  }
6
6
  export interface iRestSettings {
7
7
  active: boolean;
8
- expressPort?: number;
8
+ port?: number;
9
9
  }
10
10
  export interface iConfig {
11
11
  ioBrokerUrl: string;
@@ -1,13 +1,9 @@
1
1
  import { HmIpGriff } from './hmIPDevices/hmIpGriff';
2
- import { RoomBase } from '../../models/rooms/RoomBase';
3
2
  import { ZigbeeAquaraVibra } from './zigbee/zigbeeAquaraVibra';
4
3
  import { FensterPosition } from './models/FensterPosition';
5
4
  import { iShutter } from './iShutter';
6
- export declare class Fenster {
7
- room: RoomBase;
8
- griffe: HmIpGriff[];
9
- vibration: ZigbeeAquaraVibra[];
10
- rollo: iShutter | undefined;
5
+ import { BaseGroup } from './groups/base-group';
6
+ export declare class Fenster extends BaseGroup {
11
7
  noRolloOnSunrise: boolean;
12
8
  desiredPosition: number;
13
9
  /**
@@ -15,8 +11,12 @@ export declare class Fenster {
15
11
  * @param {number} value
16
12
  */
17
13
  setDesiredPosition(value: number): void;
18
- constructor(room: RoomBase, griffe: HmIpGriff[], vibration: ZigbeeAquaraVibra[], rollo?: iShutter | undefined, noRolloOnSunrise?: boolean);
14
+ constructor(roomName: string, handleIds?: string[], vibrationIds?: string[], shutterIds?: string[], noRolloOnSunrise?: boolean);
15
+ getHandle(): HmIpGriff[];
16
+ getShutter(): iShutter[];
17
+ getVibration(): ZigbeeAquaraVibra[];
19
18
  griffeInPosition(pPosition: FensterPosition): number;
19
+ initialize(): void;
20
20
  rolloPositionChange(pValue: number): void;
21
21
  restoreDesiredPosition(): void;
22
22
  }