hoffmation-base 0.1.30-5 → 0.1.30-9
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.
- package/lib/index.d.ts +1 -4
- package/lib/index.js +1 -11
- package/lib/models/rooms/RoomBase.d.ts +16 -53
- package/lib/models/rooms/RoomBase.js +45 -221
- package/lib/models/rooms/index.d.ts +1 -0
- package/lib/models/rooms/index.js +1 -0
- package/lib/models/rooms/roomInfo.d.ts +6 -0
- package/lib/models/rooms/roomInfo.js +10 -0
- package/lib/server/config/iConfig.d.ts +5 -1
- package/lib/server/devices/Fenster.d.ts +6 -7
- package/lib/server/devices/Fenster.js +49 -37
- package/lib/server/devices/IoBrokerBaseDevice.d.ts +1 -0
- package/lib/server/devices/IoBrokerBaseDevice.js +3 -0
- package/lib/server/devices/device-cluster-type.d.ts +16 -0
- package/lib/server/devices/device-cluster-type.js +20 -0
- package/lib/server/devices/device-cluster.d.ts +10 -0
- package/lib/server/devices/device-cluster.js +20 -0
- package/lib/server/devices/device-list.d.ts +8 -0
- package/lib/server/devices/device-list.js +31 -0
- package/lib/server/devices/groups/base-group.d.ts +11 -0
- package/lib/server/devices/groups/base-group.js +20 -0
- package/lib/server/devices/groups/fensterGroup.d.ts +3 -4
- package/lib/server/devices/groups/fensterGroup.js +52 -46
- package/lib/server/devices/groups/group-type.d.ts +11 -0
- package/lib/server/devices/groups/group-type.js +15 -0
- package/lib/server/devices/groups/heatGroup.d.ts +4 -5
- package/lib/server/devices/groups/heatGroup.js +18 -14
- package/lib/server/devices/groups/index.d.ts +6 -4
- package/lib/server/devices/groups/index.js +6 -4
- package/lib/server/devices/groups/lampenGroup.d.ts +7 -8
- package/lib/server/devices/groups/lampenGroup.js +53 -44
- package/lib/server/devices/groups/praesenzGroup.d.ts +5 -6
- package/lib/server/devices/groups/praesenzGroup.js +54 -44
- package/lib/server/devices/groups/smokeGroup.d.ts +4 -5
- package/lib/server/devices/groups/smokeGroup.js +12 -8
- package/lib/server/devices/groups/sonosGroup.d.ts +4 -5
- package/lib/server/devices/groups/sonosGroup.js +13 -9
- package/lib/server/devices/groups/tasterGroup.d.ts +4 -5
- package/lib/server/devices/groups/tasterGroup.js +27 -13
- package/lib/server/devices/groups/waterGroup.d.ts +4 -5
- package/lib/server/devices/groups/waterGroup.js +12 -8
- package/lib/server/devices/hmIPDevices/hmIpBewegung.js +2 -2
- package/lib/server/devices/hmIPDevices/hmIpGriff.js +5 -3
- package/lib/server/devices/hmIPDevices/hmIpLampe.d.ts +2 -0
- package/lib/server/devices/hmIPDevices/hmIpLampe.js +8 -0
- package/lib/server/devices/hmIPDevices/hmIpPraezenz.js +2 -2
- package/lib/server/devices/iLamp.d.ts +4 -1
- package/lib/server/devices/index.d.ts +3 -0
- package/lib/server/devices/index.js +3 -0
- package/lib/server/devices/zigbee/zigbeeAquaraMotion.js +2 -2
- package/lib/server/devices/zigbee/zigbeeHeimanSmoke.js +2 -2
- package/lib/server/devices/zigbee/zigbeeIlluDimmer.js +1 -1
- package/lib/server/devices/zigbee/zigbeeIlluLampe.d.ts +4 -1
- package/lib/server/devices/zigbee/zigbeeIlluLampe.js +8 -0
- package/lib/server/services/ShutterService.js +10 -8
- package/lib/server/services/Telegram/telegram-Commands.js +7 -7
- package/lib/server/services/api/api-service.d.ts +10 -0
- package/lib/server/services/api/api-service.js +20 -0
- package/lib/server/services/api/index.d.ts +1 -0
- package/lib/server/services/api/index.js +13 -0
- package/lib/server/services/dbo/persist.js +5 -2
- package/lib/server/services/index.d.ts +2 -0
- package/lib/server/services/index.js +2 -0
- package/lib/server/services/room-service/room-service.d.ts +41 -0
- package/lib/server/services/room-service/room-service.js +198 -0
- package/lib/server/services/utils/utils.d.ts +1 -0
- package/lib/server/services/utils/utils.js +9 -0
- package/lib/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -3
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
|
-
|
|
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
|
@@ -16,9 +16,8 @@ const server_1 = require("./server");
|
|
|
16
16
|
__exportStar(require("./models/index"), exports);
|
|
17
17
|
__exportStar(require("./server/index"), exports);
|
|
18
18
|
class HoffmationInitializationObject {
|
|
19
|
-
constructor(config
|
|
19
|
+
constructor(config) {
|
|
20
20
|
this.config = config;
|
|
21
|
-
this.app = app;
|
|
22
21
|
}
|
|
23
22
|
}
|
|
24
23
|
exports.HoffmationInitializationObject = HoffmationInitializationObject;
|
|
@@ -36,7 +35,6 @@ class HoffmationBase {
|
|
|
36
35
|
else {
|
|
37
36
|
server_1.Persist.turnOff();
|
|
38
37
|
}
|
|
39
|
-
this._app = initObject.app;
|
|
40
38
|
if (server_1.SettingsService.settings.mp3Server) {
|
|
41
39
|
server_1.ServerLogService.writeLog(models_1.LogLevel.Info, `Mp3Server settings detected --> initializing`);
|
|
42
40
|
new server_1.MP3Server(server_1.SettingsService.settings.mp3Server);
|
|
@@ -76,14 +74,6 @@ class HoffmationBase {
|
|
|
76
74
|
});
|
|
77
75
|
if (server_1.SettingsService.TelegramActive)
|
|
78
76
|
server_1.TelegramService.publishCommands();
|
|
79
|
-
if (server_1.SettingsService.settings.expressPort) {
|
|
80
|
-
this._app.get('/isAlive', (_req, res) => {
|
|
81
|
-
res.send(`Hoffmation-Base active ${new Date()}`);
|
|
82
|
-
});
|
|
83
|
-
this._app.listen(server_1.SettingsService.settings.expressPort, () => {
|
|
84
|
-
console.log(`Example app listening at http://localhost:${server_1.SettingsService.settings.expressPort}`);
|
|
85
|
-
});
|
|
86
|
-
}
|
|
87
77
|
server_1.ServerLogService.writeLog(models_1.LogLevel.Info, `Hoffmation-Base Post ioBrokerInitializations finished`);
|
|
88
78
|
}
|
|
89
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
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
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
|
-
|
|
41
|
-
|
|
42
|
-
|
|
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,60 @@
|
|
|
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
|
|
19
|
-
const
|
|
20
|
-
const
|
|
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");
|
|
21
11
|
class RoomBase {
|
|
22
|
-
constructor(roomName, Einstellungen) {
|
|
23
|
-
this.roomName = roomName;
|
|
12
|
+
constructor(roomName, Einstellungen, groups) {
|
|
24
13
|
this.Einstellungen = Einstellungen;
|
|
25
|
-
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, []);
|
|
14
|
+
this.groups = groups;
|
|
33
15
|
this.skipNextRolloUp = false;
|
|
34
|
-
|
|
35
|
-
const level = Einstellungen.etage;
|
|
36
|
-
if (RoomBase.floors[level] === undefined) {
|
|
37
|
-
RoomBase.floors[level] = [];
|
|
38
|
-
}
|
|
39
|
-
RoomBase.floors[level].push(this);
|
|
40
|
-
}
|
|
16
|
+
this.info = new roomInfo_1.RoomInfo(roomName, Einstellungen);
|
|
41
17
|
Einstellungen.room = this;
|
|
42
18
|
this.Settings = Einstellungen;
|
|
43
|
-
|
|
19
|
+
room_service_1.RoomService.addToRoomList(this);
|
|
44
20
|
}
|
|
45
|
-
|
|
46
|
-
|
|
21
|
+
get FensterGroup() {
|
|
22
|
+
return this.groups.get(group_type_1.GroupType.Window);
|
|
47
23
|
}
|
|
48
|
-
|
|
49
|
-
return this.
|
|
24
|
+
get PraesenzGroup() {
|
|
25
|
+
return this.groups.get(group_type_1.GroupType.Presence);
|
|
50
26
|
}
|
|
51
|
-
|
|
52
|
-
|
|
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
|
-
}
|
|
27
|
+
get LampenGroup() {
|
|
28
|
+
return this.groups.get(group_type_1.GroupType.Light);
|
|
62
29
|
}
|
|
63
|
-
|
|
64
|
-
|
|
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
|
-
}
|
|
30
|
+
get TasterGroup() {
|
|
31
|
+
return this.groups.get(group_type_1.GroupType.Buttons);
|
|
77
32
|
}
|
|
78
|
-
|
|
79
|
-
|
|
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();
|
|
33
|
+
get SonosGroup() {
|
|
34
|
+
return this.groups.get(group_type_1.GroupType.Speaker);
|
|
90
35
|
}
|
|
91
|
-
|
|
92
|
-
|
|
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);
|
|
36
|
+
get SmokeGroup() {
|
|
37
|
+
return this.groups.get(group_type_1.GroupType.Smoke);
|
|
101
38
|
}
|
|
102
|
-
|
|
103
|
-
|
|
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);
|
|
39
|
+
get WaterGroup() {
|
|
40
|
+
return this.groups.get(group_type_1.GroupType.Water);
|
|
112
41
|
}
|
|
113
|
-
|
|
114
|
-
|
|
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();
|
|
42
|
+
get HeatGroup() {
|
|
43
|
+
return this.groups.get(group_type_1.GroupType.Heating);
|
|
128
44
|
}
|
|
129
|
-
|
|
130
|
-
|
|
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();
|
|
45
|
+
get roomName() {
|
|
46
|
+
return this.info.roomName;
|
|
147
47
|
}
|
|
148
|
-
|
|
149
|
-
return this.
|
|
48
|
+
get etage() {
|
|
49
|
+
return this.info.etage;
|
|
150
50
|
}
|
|
151
51
|
initializeBase() {
|
|
52
|
+
var _a, _b, _c;
|
|
152
53
|
log_service_1.ServerLogService.writeLog(logLevel_1.LogLevel.Debug, `RoomBase Init für ${this.roomName}`);
|
|
153
54
|
this.recalcTimeCallbacks();
|
|
154
|
-
this.PraesenzGroup.initCallbacks();
|
|
155
|
-
this.FensterGroup.initCallbacks();
|
|
156
|
-
this.TasterGroup.initCallbacks();
|
|
55
|
+
(_a = this.PraesenzGroup) === null || _a === void 0 ? void 0 : _a.initCallbacks();
|
|
56
|
+
(_b = this.FensterGroup) === null || _b === void 0 ? void 0 : _b.initCallbacks();
|
|
57
|
+
(_c = this.TasterGroup) === null || _c === void 0 ? void 0 : _c.initCallbacks();
|
|
157
58
|
}
|
|
158
59
|
persist() {
|
|
159
60
|
persist_1.Persist.addRoom(this);
|
|
@@ -180,7 +81,11 @@ class RoomBase {
|
|
|
180
81
|
* @param movementDependant Only turn light on if there was a movement in the same room
|
|
181
82
|
*/
|
|
182
83
|
setLightTimeBased(movementDependant = false) {
|
|
183
|
-
|
|
84
|
+
var _a, _b;
|
|
85
|
+
if (!this.LampenGroup) {
|
|
86
|
+
return;
|
|
87
|
+
}
|
|
88
|
+
if (movementDependant && this.PraesenzGroup && !((_a = this.PraesenzGroup) === null || _a === void 0 ? void 0 : _a.anyPresent())) {
|
|
184
89
|
this.LampenGroup.switchAll(false);
|
|
185
90
|
return;
|
|
186
91
|
}
|
|
@@ -190,111 +95,30 @@ class RoomBase {
|
|
|
190
95
|
}
|
|
191
96
|
let timeOfDay = time_callback_service_1.TimeCallbackService.dayType(this.Einstellungen.lampOffset);
|
|
192
97
|
if (timeOfDay === time_callback_service_1.TimeOfDay.Daylight &&
|
|
193
|
-
((this.Einstellungen.lightIfNoWindows && this.FensterGroup.fenster.length === 0) ||
|
|
194
|
-
this.FensterGroup.fenster.some((f) => {
|
|
195
|
-
|
|
196
|
-
|
|
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`);
|
|
98
|
+
((this.Einstellungen.lightIfNoWindows && (!this.FensterGroup || this.FensterGroup.fenster.length === 0)) ||
|
|
99
|
+
((_b = this.FensterGroup) === null || _b === void 0 ? void 0 : _b.fenster.some((f) => {
|
|
100
|
+
const rolloDown = f.getShutter()[0].currentLevel === 0;
|
|
101
|
+
log_service_1.ServerLogService.writeLog(logLevel_1.LogLevel.Debug, `Rollo ${f.getShutter()[0].info.customName} for light in ${this.roomName} is ${rolloDown ? '' : 'not '}down`);
|
|
198
102
|
return rolloDown;
|
|
199
|
-
}))) {
|
|
103
|
+
})))) {
|
|
200
104
|
timeOfDay = time_callback_service_1.TimeOfDay.AfterSunset;
|
|
201
105
|
}
|
|
202
106
|
this.LampenGroup.switchTimeConditional(timeOfDay);
|
|
203
107
|
}
|
|
204
108
|
isNowLightTime() {
|
|
109
|
+
var _a;
|
|
205
110
|
if (!this.Einstellungen.lampOffset) {
|
|
206
111
|
log_service_1.ServerLogService.writeLog(logLevel_1.LogLevel.Alert, `Beim Aufruf von "setLightTimeBased" im Raum ${this.roomName} liegt kein Lampen Offset vor`);
|
|
207
112
|
return false;
|
|
208
113
|
}
|
|
209
114
|
let timeOfDay = time_callback_service_1.TimeCallbackService.dayType(this.Einstellungen.lampOffset);
|
|
210
115
|
if (timeOfDay === time_callback_service_1.TimeOfDay.Daylight &&
|
|
211
|
-
this.FensterGroup.fenster.some((f) => {
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
})) {
|
|
116
|
+
((_a = this.FensterGroup) === null || _a === void 0 ? void 0 : _a.fenster.some((f) => {
|
|
117
|
+
return f.getShutter()[0].currentLevel === 0;
|
|
118
|
+
}))) {
|
|
215
119
|
timeOfDay = time_callback_service_1.TimeOfDay.AfterSunset;
|
|
216
120
|
}
|
|
217
121
|
return time_callback_service_1.TimeCallbackService.darkOutsideOrNight(timeOfDay);
|
|
218
122
|
}
|
|
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
123
|
}
|
|
292
124
|
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;
|
|
@@ -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;
|
|
@@ -3,8 +3,11 @@ import { iRoomDefaultSettings } from '../../models/rooms/RoomSettings/iRoomDefau
|
|
|
3
3
|
interface iSonosSettings {
|
|
4
4
|
active: boolean;
|
|
5
5
|
}
|
|
6
|
+
export interface iRestSettings {
|
|
7
|
+
active: boolean;
|
|
8
|
+
port?: number;
|
|
9
|
+
}
|
|
6
10
|
export interface iConfig {
|
|
7
|
-
expressPort?: number;
|
|
8
11
|
ioBrokerUrl: string;
|
|
9
12
|
logSettings?: iLogSettings;
|
|
10
13
|
translationSettings: iTranslationSettings;
|
|
@@ -12,6 +15,7 @@ export interface iConfig {
|
|
|
12
15
|
muell?: iMuellSettings;
|
|
13
16
|
persistence?: iPersistenceSettings;
|
|
14
17
|
polly?: iPollySettings;
|
|
18
|
+
restServer?: iRestSettings;
|
|
15
19
|
roomDefault: iRoomDefaultSettings;
|
|
16
20
|
sonos?: iSonosSettings;
|
|
17
21
|
telegram?: iTelegramSettings;
|
|
@@ -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
|
-
|
|
7
|
-
|
|
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,7 +11,10 @@ export declare class Fenster {
|
|
|
15
11
|
* @param {number} value
|
|
16
12
|
*/
|
|
17
13
|
setDesiredPosition(value: number): void;
|
|
18
|
-
constructor(
|
|
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;
|
|
20
19
|
rolloPositionChange(pValue: number): void;
|
|
21
20
|
restoreDesiredPosition(): void;
|