hoffmation-base 0.1.1 → 0.1.5
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/.eslintrc.js +27 -27
- package/.github/workflows/npm-publish.yml +50 -0
- package/.prettierrc.js +9 -9
- package/LICENSE +21 -21
- package/index.js +1 -1
- package/models/connectionCallbacks.ts +13 -13
- package/models/daytime.ts +3 -3
- package/models/deviceConfig.ts +8 -8
- package/models/dimmerSettings.ts +5 -5
- package/models/iTemperaturDataPoint.ts +9 -9
- package/models/lampSettings.ts +5 -5
- package/models/ledSettings.ts +19 -19
- package/models/logLevel.ts +9 -9
- package/models/persistence/BasicRoomInfo.ts +3 -3
- package/models/persistence/DailyMovementCount.ts +3 -3
- package/models/persistence/RoomDetailInfo.ts +4 -4
- package/models/persistence/temperaturDataPoint.ts +12 -12
- package/models/persistence/todaysCount.ts +3 -3
- package/models/rooms/RoomBase.ts +357 -357
- package/models/rooms/RoomSettings/RoomSettings.ts +159 -159
- package/models/rooms/RoomSettings/hmIPRoomSettings.ts +53 -53
- package/models/rooms/RoomSettings/iRoomDefaultSettings.ts +17 -17
- package/models/rooms/RoomSettings/readme.md +17 -17
- package/models/rooms/RoomSettings/zigbeeRoomSettings.ts +51 -51
- package/models/rooms/iRoomImportEnforcer.ts +3 -3
- package/models/rooms/readme.md +11 -11
- package/models/temperaturSettings.ts +22 -22
- package/models/timeCallback.ts +90 -90
- package/package.json +1 -1
- package/server/config/config-readme.md +19 -19
- package/server/config/iConfig.ts +53 -53
- package/server/config/private/mainConfig.json +64 -64
- package/server/devices/DeviceInfo.ts +66 -66
- package/server/devices/Griffe.ts +31 -31
- package/server/devices/Heizgruppen.ts +91 -91
- package/server/devices/Rollos.ts +48 -48
- package/server/devices/deviceUpdater.ts +72 -72
- package/server/devices/devices.ts +189 -189
- package/server/devices/groups/fensterGroup.ts +175 -175
- package/server/devices/groups/heatGroup.ts +32 -32
- package/server/devices/groups/lampenGroup.ts +88 -88
- package/server/devices/groups/praesenzGroup.ts +182 -182
- package/server/devices/groups/smokeGroup.ts +16 -16
- package/server/devices/groups/sonosGroup.ts +33 -33
- package/server/devices/groups/tasterGroup.ts +48 -48
- package/server/devices/groups/waterGroup.ts +16 -16
- package/server/devices/hmIPDevices/Fenster.ts +114 -114
- package/server/devices/hmIPDevices/FensterPosition.ts +5 -5
- package/server/devices/hmIPDevices/TuerPosition.ts +4 -4
- package/server/devices/hmIPDevices/hmIpBewegung.ts +126 -126
- package/server/devices/hmIPDevices/hmIpDevice.ts +90 -90
- package/server/devices/hmIPDevices/hmIpDeviceType.ts +14 -14
- package/server/devices/hmIPDevices/hmIpGriff.ts +143 -143
- package/server/devices/hmIPDevices/hmIpHeizgruppe.ts +172 -172
- package/server/devices/hmIPDevices/hmIpHeizung.ts +69 -69
- package/server/devices/hmIPDevices/hmIpLampe.ts +119 -119
- package/server/devices/hmIPDevices/hmIpPraezenz.ts +99 -99
- package/server/devices/hmIPDevices/hmIpRoll.ts +133 -133
- package/server/devices/hmIPDevices/hmIpTaster.ts +82 -73
- package/server/devices/hmIPDevices/hmIpTherm.ts +19 -19
- package/server/devices/hmIPDevices/hmIpTuer.ts +115 -115
- package/server/devices/hmIPDevices/hmIpWippe.ts +55 -55
- package/server/devices/iDeviceUpdater.ts +4 -4
- package/server/devices/iIoBrokerDevice.ts +44 -44
- package/server/devices/iTaster.ts +6 -0
- package/server/devices/{hmIPDevices/hmIpTaste.ts → taste.ts} +84 -72
- package/server/devices/wledDevice.ts +124 -124
- package/server/devices/zigbee/ZigbeeActuator.ts +113 -113
- package/server/devices/zigbee/zigbeeAquaraVibra.ts +171 -171
- package/server/devices/zigbee/zigbeeAquaraWater.ts +94 -94
- package/server/devices/zigbee/zigbeeBlitzShp.ts +77 -77
- package/server/devices/zigbee/zigbeeDevice.ts +115 -115
- package/server/devices/zigbee/zigbeeDeviceType.ts +13 -13
- package/server/devices/zigbee/zigbeeHeimanSmoke.ts +99 -99
- package/server/devices/zigbee/zigbeeIkeaSteckdose.ts +31 -31
- package/server/devices/zigbee/zigbeeIlluActuator.ts +37 -37
- package/server/devices/zigbee/zigbeeIlluDimmer.ts +165 -165
- package/server/devices/zigbee/zigbeeIlluLampe.ts +33 -33
- package/server/devices/zigbee/zigbeeIlluLedRGBCCT.ts +137 -137
- package/server/ioBroker/connection.ts +1655 -1655
- package/server/ioBroker/ioBroker.main.ts +99 -99
- package/server/ioBroker/socketIOAuthInfo.ts +5 -5
- package/server/ioBroker/socketIOConnectOptions.ts +6 -6
- package/server/ioBroker/socketIOLogging.ts +29 -29
- package/server/ioBroker/socketIOVisCommand.ts +11 -11
- package/server/services/HTTPSOptions.ts +14 -14
- package/server/services/Sonos/OwnSonosDevices.ts +9 -0
- package/server/services/Sonos/mp3-server.ts +75 -75
- package/server/services/Sonos/polly-service.ts +100 -100
- package/server/services/Sonos/sonos-service.ts +194 -199
- package/server/services/Telegram/telegram-Commands.ts +237 -215
- package/server/services/Telegram/telegram-service.ts +171 -171
- package/server/services/Telegram/telegramMessageCalback.ts +11 -11
- package/server/services/calendar/muell-tonne.ts +82 -83
- package/server/services/calendar/m/303/274ll-service.ts +147 -146
- package/server/services/dbo/persist.ts +125 -125
- package/server/services/https-service.ts +71 -71
- package/server/services/log-service.ts +69 -69
- package/server/services/news-service.ts +81 -81
- package/server/services/settings-service.ts +15 -15
- package/server/services/time-callback-service.ts +223 -223
- package/server/services/utils/ringstorage.ts +24 -24
- package/server/services/utils/utils.ts +52 -52
- package/server/services/weather/weather-alert.ts +7 -7
- package/server/services/weather/weather-current.ts +26 -26
- package/server/services/weather/weather-daily.ts +22 -22
- package/server/services/weather/weather-feelsLike.ts +6 -6
- package/server/services/weather/weather-hourly.ts +17 -17
- package/server/services/weather/weather-item.ts +6 -6
- package/server/services/weather/weather-minutes.ts +4 -4
- package/server/services/weather/weather-service.ts +277 -277
- package/server/services/weather/weather-temp.ts +8 -8
- package/tsconfig.json +58 -58
|
@@ -1,182 +1,182 @@
|
|
|
1
|
-
import { HmIpPraezenz } from '../hmIPDevices/hmIpPraezenz';
|
|
2
|
-
import { HmIpBewegung } from '../hmIPDevices/hmIpBewegung';
|
|
3
|
-
import { RoomBase } from '../../../models/rooms/RoomBase';
|
|
4
|
-
import { TimeCallback, TimeCallbackType } from '../../../models/timeCallback';
|
|
5
|
-
import { ServerLogService } from '../../services/log-service';
|
|
6
|
-
import { LogLevel } from '../../../models/logLevel';
|
|
7
|
-
import { TimeCallbackService } from '../../services/time-callback-service';
|
|
8
|
-
import { Utils } from '../../services/utils/utils';
|
|
9
|
-
|
|
10
|
-
export class PraesenzGroup {
|
|
11
|
-
private _lastMovement: Date = new Date(0);
|
|
12
|
-
|
|
13
|
-
public constructor(private _room: RoomBase, public Prasenzen: HmIpPraezenz[], public Bewegungen: HmIpBewegung[]) {
|
|
14
|
-
for (const b of [...Prasenzen, ...Bewegungen]) {
|
|
15
|
-
b.room = this._room;
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
public initCallbacks(): void {
|
|
20
|
-
this.Prasenzen.forEach((p) => {
|
|
21
|
-
p.addPresenceCallback((val) => {
|
|
22
|
-
if (!val) {
|
|
23
|
-
return;
|
|
24
|
-
}
|
|
25
|
-
if (RoomBase.awayModeActive || (RoomBase.nightAlarmActive && !p.excludeFromNightAlarm)) {
|
|
26
|
-
RoomBase.startIntrusionAlarm(this._room, p);
|
|
27
|
-
}
|
|
28
|
-
RoomBase.movementHistory.add(`${Utils.nowString()}: Raum "${this._room.roomName}" Gerät "${p.info.fullName}"`);
|
|
29
|
-
});
|
|
30
|
-
});
|
|
31
|
-
this.Bewegungen.forEach((b) => {
|
|
32
|
-
b.addMovementCallback((val) => {
|
|
33
|
-
if (!val) {
|
|
34
|
-
return;
|
|
35
|
-
}
|
|
36
|
-
if (RoomBase.awayModeActive || (RoomBase.nightAlarmActive && !b.excludeFromNightAlarm)) {
|
|
37
|
-
RoomBase.startIntrusionAlarm(this._room, b);
|
|
38
|
-
}
|
|
39
|
-
RoomBase.movementHistory.add(`${Utils.nowString()}: Raum "${this._room.roomName}" Gerät "${b.info.fullName}"`);
|
|
40
|
-
});
|
|
41
|
-
});
|
|
42
|
-
if (this._room.Einstellungen.lichtSonnenAufgangAus && this._room.Einstellungen.lampOffset) {
|
|
43
|
-
this._room.sonnenAufgangLichtCallback = new TimeCallback(
|
|
44
|
-
`${this._room.roomName} Morgens Lampe aus`,
|
|
45
|
-
TimeCallbackType.Sunrise,
|
|
46
|
-
() => {
|
|
47
|
-
ServerLogService.writeLog(
|
|
48
|
-
LogLevel.Info,
|
|
49
|
-
`Es ist hell genug --> Schalte Lampen im ${this._room.roomName} aus`,
|
|
50
|
-
);
|
|
51
|
-
this._room.LampenGroup.switchAll(false);
|
|
52
|
-
},
|
|
53
|
-
this._room.Einstellungen.lampOffset.sunrise,
|
|
54
|
-
);
|
|
55
|
-
TimeCallbackService.addCallback(this._room.sonnenAufgangLichtCallback);
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
this.addLastLeftCallback(() => {
|
|
59
|
-
this._room.LampenGroup.switchAll(false);
|
|
60
|
-
});
|
|
61
|
-
|
|
62
|
-
if (this._room.Einstellungen.lampenBeiBewegung) {
|
|
63
|
-
this.addFirstEnterCallback(() => {
|
|
64
|
-
ServerLogService.writeLog(
|
|
65
|
-
LogLevel.DeepTrace,
|
|
66
|
-
`Bewegung im Raum ${this._room.roomName} festgestellt --> Licht einschalten`,
|
|
67
|
-
);
|
|
68
|
-
this._room.setLightTimeBased();
|
|
69
|
-
});
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
public presentAmount(): number {
|
|
74
|
-
let count = 0;
|
|
75
|
-
for (let i = 0; i < this.Prasenzen.length; i++) {
|
|
76
|
-
if (this.Prasenzen[i].presenceDetected) {
|
|
77
|
-
count++;
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
for (let i = 0; i < this.Bewegungen.length; i++) {
|
|
81
|
-
if (this.Bewegungen[i].movementDetected) {
|
|
82
|
-
count++;
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
return count;
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
public anyPresent(): boolean {
|
|
90
|
-
for (let i = 0; i < this.Prasenzen.length; i++) {
|
|
91
|
-
if (this.Prasenzen[i].presenceDetected) {
|
|
92
|
-
return true;
|
|
93
|
-
}
|
|
94
|
-
}
|
|
95
|
-
for (let i = 0; i < this.Bewegungen.length; i++) {
|
|
96
|
-
if (this.Bewegungen[i].movementDetected) {
|
|
97
|
-
return true;
|
|
98
|
-
}
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
return false;
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
public lastLeftCB(val: boolean, cb: () => void): void {
|
|
105
|
-
if (val) {
|
|
106
|
-
return;
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
if (this.anyPresent()) {
|
|
110
|
-
return;
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
let timeAfterReset: number =
|
|
114
|
-
Utils.nowMS() - this._lastMovement.getTime() - this._room.Einstellungen.movementResetTimer * 1000;
|
|
115
|
-
if (timeAfterReset > 0) {
|
|
116
|
-
ServerLogService.writeLog(
|
|
117
|
-
LogLevel.Debug,
|
|
118
|
-
`Movement reset in ${
|
|
119
|
-
this._room.roomName
|
|
120
|
-
}.\nActive Motions: ${this.presentAmount()}\nTime after Last Movement including Reset: ${timeAfterReset}`,
|
|
121
|
-
);
|
|
122
|
-
cb();
|
|
123
|
-
return;
|
|
124
|
-
}
|
|
125
|
-
ServerLogService.writeLog(LogLevel.Debug, `Movement reset in ${this._room.roomName} delayed.`);
|
|
126
|
-
Utils.guardedTimeout(
|
|
127
|
-
() => {
|
|
128
|
-
timeAfterReset =
|
|
129
|
-
Utils.nowMS() - this._lastMovement.getTime() - this._room.Einstellungen.movementResetTimer * 1000;
|
|
130
|
-
ServerLogService.writeLog(
|
|
131
|
-
LogLevel.Debug,
|
|
132
|
-
`Delayed Movement reset in ${
|
|
133
|
-
this._room.roomName
|
|
134
|
-
}.\nActive Motions: ${this.presentAmount()}\nTime after Last Movement including Reset: ${timeAfterReset}`,
|
|
135
|
-
);
|
|
136
|
-
if (!this.anyPresent() && timeAfterReset > 0) {
|
|
137
|
-
cb();
|
|
138
|
-
}
|
|
139
|
-
},
|
|
140
|
-
Math.abs(timeAfterReset) + 500,
|
|
141
|
-
this,
|
|
142
|
-
);
|
|
143
|
-
}
|
|
144
|
-
|
|
145
|
-
public addLastLeftCallback(cb: () => void): void {
|
|
146
|
-
this.Prasenzen.forEach((p) => {
|
|
147
|
-
p.addPresenceCallback((val) => {
|
|
148
|
-
this.lastLeftCB(val, cb);
|
|
149
|
-
});
|
|
150
|
-
});
|
|
151
|
-
this.Bewegungen.forEach((b) => {
|
|
152
|
-
b.addMovementCallback((val) => {
|
|
153
|
-
this.lastLeftCB(val, cb);
|
|
154
|
-
});
|
|
155
|
-
});
|
|
156
|
-
}
|
|
157
|
-
|
|
158
|
-
private firstEnterCallback(val: boolean, cb: () => void): void {
|
|
159
|
-
if (!val) {
|
|
160
|
-
return;
|
|
161
|
-
}
|
|
162
|
-
this._lastMovement = new Date();
|
|
163
|
-
if (this.presentAmount() > 1) {
|
|
164
|
-
return;
|
|
165
|
-
}
|
|
166
|
-
|
|
167
|
-
cb();
|
|
168
|
-
}
|
|
169
|
-
|
|
170
|
-
public addFirstEnterCallback(cb: () => void): void {
|
|
171
|
-
this.Prasenzen.forEach((p) => {
|
|
172
|
-
p.addPresenceCallback((val) => {
|
|
173
|
-
this.firstEnterCallback(val, cb);
|
|
174
|
-
});
|
|
175
|
-
});
|
|
176
|
-
this.Bewegungen.forEach((b) => {
|
|
177
|
-
b.addMovementCallback((val) => {
|
|
178
|
-
this.firstEnterCallback(val, cb);
|
|
179
|
-
});
|
|
180
|
-
});
|
|
181
|
-
}
|
|
182
|
-
}
|
|
1
|
+
import { HmIpPraezenz } from '../hmIPDevices/hmIpPraezenz';
|
|
2
|
+
import { HmIpBewegung } from '../hmIPDevices/hmIpBewegung';
|
|
3
|
+
import { RoomBase } from '../../../models/rooms/RoomBase';
|
|
4
|
+
import { TimeCallback, TimeCallbackType } from '../../../models/timeCallback';
|
|
5
|
+
import { ServerLogService } from '../../services/log-service';
|
|
6
|
+
import { LogLevel } from '../../../models/logLevel';
|
|
7
|
+
import { TimeCallbackService } from '../../services/time-callback-service';
|
|
8
|
+
import { Utils } from '../../services/utils/utils';
|
|
9
|
+
|
|
10
|
+
export class PraesenzGroup {
|
|
11
|
+
private _lastMovement: Date = new Date(0);
|
|
12
|
+
|
|
13
|
+
public constructor(private _room: RoomBase, public Prasenzen: HmIpPraezenz[], public Bewegungen: HmIpBewegung[]) {
|
|
14
|
+
for (const b of [...Prasenzen, ...Bewegungen]) {
|
|
15
|
+
b.room = this._room;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
public initCallbacks(): void {
|
|
20
|
+
this.Prasenzen.forEach((p) => {
|
|
21
|
+
p.addPresenceCallback((val) => {
|
|
22
|
+
if (!val) {
|
|
23
|
+
return;
|
|
24
|
+
}
|
|
25
|
+
if (RoomBase.awayModeActive || (RoomBase.nightAlarmActive && !p.excludeFromNightAlarm)) {
|
|
26
|
+
RoomBase.startIntrusionAlarm(this._room, p);
|
|
27
|
+
}
|
|
28
|
+
RoomBase.movementHistory.add(`${Utils.nowString()}: Raum "${this._room.roomName}" Gerät "${p.info.fullName}"`);
|
|
29
|
+
});
|
|
30
|
+
});
|
|
31
|
+
this.Bewegungen.forEach((b) => {
|
|
32
|
+
b.addMovementCallback((val) => {
|
|
33
|
+
if (!val) {
|
|
34
|
+
return;
|
|
35
|
+
}
|
|
36
|
+
if (RoomBase.awayModeActive || (RoomBase.nightAlarmActive && !b.excludeFromNightAlarm)) {
|
|
37
|
+
RoomBase.startIntrusionAlarm(this._room, b);
|
|
38
|
+
}
|
|
39
|
+
RoomBase.movementHistory.add(`${Utils.nowString()}: Raum "${this._room.roomName}" Gerät "${b.info.fullName}"`);
|
|
40
|
+
});
|
|
41
|
+
});
|
|
42
|
+
if (this._room.Einstellungen.lichtSonnenAufgangAus && this._room.Einstellungen.lampOffset) {
|
|
43
|
+
this._room.sonnenAufgangLichtCallback = new TimeCallback(
|
|
44
|
+
`${this._room.roomName} Morgens Lampe aus`,
|
|
45
|
+
TimeCallbackType.Sunrise,
|
|
46
|
+
() => {
|
|
47
|
+
ServerLogService.writeLog(
|
|
48
|
+
LogLevel.Info,
|
|
49
|
+
`Es ist hell genug --> Schalte Lampen im ${this._room.roomName} aus`,
|
|
50
|
+
);
|
|
51
|
+
this._room.LampenGroup.switchAll(false);
|
|
52
|
+
},
|
|
53
|
+
this._room.Einstellungen.lampOffset.sunrise,
|
|
54
|
+
);
|
|
55
|
+
TimeCallbackService.addCallback(this._room.sonnenAufgangLichtCallback);
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
this.addLastLeftCallback(() => {
|
|
59
|
+
this._room.LampenGroup.switchAll(false);
|
|
60
|
+
});
|
|
61
|
+
|
|
62
|
+
if (this._room.Einstellungen.lampenBeiBewegung) {
|
|
63
|
+
this.addFirstEnterCallback(() => {
|
|
64
|
+
ServerLogService.writeLog(
|
|
65
|
+
LogLevel.DeepTrace,
|
|
66
|
+
`Bewegung im Raum ${this._room.roomName} festgestellt --> Licht einschalten`,
|
|
67
|
+
);
|
|
68
|
+
this._room.setLightTimeBased();
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
public presentAmount(): number {
|
|
74
|
+
let count = 0;
|
|
75
|
+
for (let i = 0; i < this.Prasenzen.length; i++) {
|
|
76
|
+
if (this.Prasenzen[i].presenceDetected) {
|
|
77
|
+
count++;
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
for (let i = 0; i < this.Bewegungen.length; i++) {
|
|
81
|
+
if (this.Bewegungen[i].movementDetected) {
|
|
82
|
+
count++;
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
return count;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
public anyPresent(): boolean {
|
|
90
|
+
for (let i = 0; i < this.Prasenzen.length; i++) {
|
|
91
|
+
if (this.Prasenzen[i].presenceDetected) {
|
|
92
|
+
return true;
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
for (let i = 0; i < this.Bewegungen.length; i++) {
|
|
96
|
+
if (this.Bewegungen[i].movementDetected) {
|
|
97
|
+
return true;
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
return false;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
public lastLeftCB(val: boolean, cb: () => void): void {
|
|
105
|
+
if (val) {
|
|
106
|
+
return;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
if (this.anyPresent()) {
|
|
110
|
+
return;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
let timeAfterReset: number =
|
|
114
|
+
Utils.nowMS() - this._lastMovement.getTime() - this._room.Einstellungen.movementResetTimer * 1000;
|
|
115
|
+
if (timeAfterReset > 0) {
|
|
116
|
+
ServerLogService.writeLog(
|
|
117
|
+
LogLevel.Debug,
|
|
118
|
+
`Movement reset in ${
|
|
119
|
+
this._room.roomName
|
|
120
|
+
}.\nActive Motions: ${this.presentAmount()}\nTime after Last Movement including Reset: ${timeAfterReset}`,
|
|
121
|
+
);
|
|
122
|
+
cb();
|
|
123
|
+
return;
|
|
124
|
+
}
|
|
125
|
+
ServerLogService.writeLog(LogLevel.Debug, `Movement reset in ${this._room.roomName} delayed.`);
|
|
126
|
+
Utils.guardedTimeout(
|
|
127
|
+
() => {
|
|
128
|
+
timeAfterReset =
|
|
129
|
+
Utils.nowMS() - this._lastMovement.getTime() - this._room.Einstellungen.movementResetTimer * 1000;
|
|
130
|
+
ServerLogService.writeLog(
|
|
131
|
+
LogLevel.Debug,
|
|
132
|
+
`Delayed Movement reset in ${
|
|
133
|
+
this._room.roomName
|
|
134
|
+
}.\nActive Motions: ${this.presentAmount()}\nTime after Last Movement including Reset: ${timeAfterReset}`,
|
|
135
|
+
);
|
|
136
|
+
if (!this.anyPresent() && timeAfterReset > 0) {
|
|
137
|
+
cb();
|
|
138
|
+
}
|
|
139
|
+
},
|
|
140
|
+
Math.abs(timeAfterReset) + 500,
|
|
141
|
+
this,
|
|
142
|
+
);
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
public addLastLeftCallback(cb: () => void): void {
|
|
146
|
+
this.Prasenzen.forEach((p) => {
|
|
147
|
+
p.addPresenceCallback((val) => {
|
|
148
|
+
this.lastLeftCB(val, cb);
|
|
149
|
+
});
|
|
150
|
+
});
|
|
151
|
+
this.Bewegungen.forEach((b) => {
|
|
152
|
+
b.addMovementCallback((val) => {
|
|
153
|
+
this.lastLeftCB(val, cb);
|
|
154
|
+
});
|
|
155
|
+
});
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
private firstEnterCallback(val: boolean, cb: () => void): void {
|
|
159
|
+
if (!val) {
|
|
160
|
+
return;
|
|
161
|
+
}
|
|
162
|
+
this._lastMovement = new Date();
|
|
163
|
+
if (this.presentAmount() > 1) {
|
|
164
|
+
return;
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
cb();
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
public addFirstEnterCallback(cb: () => void): void {
|
|
171
|
+
this.Prasenzen.forEach((p) => {
|
|
172
|
+
p.addPresenceCallback((val) => {
|
|
173
|
+
this.firstEnterCallback(val, cb);
|
|
174
|
+
});
|
|
175
|
+
});
|
|
176
|
+
this.Bewegungen.forEach((b) => {
|
|
177
|
+
b.addMovementCallback((val) => {
|
|
178
|
+
this.firstEnterCallback(val, cb);
|
|
179
|
+
});
|
|
180
|
+
});
|
|
181
|
+
}
|
|
182
|
+
}
|
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import { ZigbeeHeimanSmoke } from '../zigbee/zigbeeHeimanSmoke';
|
|
2
|
-
import { RoomBase } from '../../../models/rooms/RoomBase';
|
|
3
|
-
|
|
4
|
-
export class SmokeGroup {
|
|
5
|
-
public constructor(private _room: RoomBase, public Rauchmelder: Array<ZigbeeHeimanSmoke>) {
|
|
6
|
-
for (const s of [...this.Rauchmelder]) {
|
|
7
|
-
s.room = this._room;
|
|
8
|
-
}
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
public stopAlarm(): void {
|
|
12
|
-
for (const d of this.Rauchmelder) {
|
|
13
|
-
d.stopAlarm(true);
|
|
14
|
-
}
|
|
15
|
-
}
|
|
16
|
-
}
|
|
1
|
+
import { ZigbeeHeimanSmoke } from '../zigbee/zigbeeHeimanSmoke';
|
|
2
|
+
import { RoomBase } from '../../../models/rooms/RoomBase';
|
|
3
|
+
|
|
4
|
+
export class SmokeGroup {
|
|
5
|
+
public constructor(private _room: RoomBase, public Rauchmelder: Array<ZigbeeHeimanSmoke>) {
|
|
6
|
+
for (const s of [...this.Rauchmelder]) {
|
|
7
|
+
s.room = this._room;
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
public stopAlarm(): void {
|
|
12
|
+
for (const d of this.Rauchmelder) {
|
|
13
|
+
d.stopAlarm(true);
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
}
|
|
@@ -1,33 +1,33 @@
|
|
|
1
|
-
import { OwnSonosDevice } from '../../services/Sonos/sonos-service';
|
|
2
|
-
import { Utils } from '../../services/utils/utils';
|
|
3
|
-
import { RoomBase } from '../../../models/rooms/RoomBase';
|
|
4
|
-
|
|
5
|
-
export class SonosGroup {
|
|
6
|
-
private _playing: boolean = false;
|
|
7
|
-
public constructor(private _room: RoomBase, public ownSonosDevices: OwnSonosDevice[]) {}
|
|
8
|
-
|
|
9
|
-
public playRadio(radioUrl: string): void {
|
|
10
|
-
this.ownSonosDevices.forEach((s) => {
|
|
11
|
-
Utils.guardedTimeout(() => {
|
|
12
|
-
s.device?.SetAVTransportURI(radioUrl);
|
|
13
|
-
}, 1500);
|
|
14
|
-
});
|
|
15
|
-
this._playing = true;
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
public turnOff(): void {
|
|
19
|
-
this.ownSonosDevices.forEach((s) => {
|
|
20
|
-
s.device?.Stop();
|
|
21
|
-
});
|
|
22
|
-
this._playing = false;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
public trigger(track: string): void {
|
|
26
|
-
if (this._playing) {
|
|
27
|
-
this.turnOff();
|
|
28
|
-
return;
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
this.playRadio(track);
|
|
32
|
-
}
|
|
33
|
-
}
|
|
1
|
+
import { OwnSonosDevice } from '../../services/Sonos/sonos-service';
|
|
2
|
+
import { Utils } from '../../services/utils/utils';
|
|
3
|
+
import { RoomBase } from '../../../models/rooms/RoomBase';
|
|
4
|
+
|
|
5
|
+
export class SonosGroup {
|
|
6
|
+
private _playing: boolean = false;
|
|
7
|
+
public constructor(private _room: RoomBase, public ownSonosDevices: OwnSonosDevice[]) {}
|
|
8
|
+
|
|
9
|
+
public playRadio(radioUrl: string): void {
|
|
10
|
+
this.ownSonosDevices.forEach((s) => {
|
|
11
|
+
Utils.guardedTimeout(() => {
|
|
12
|
+
s.device?.SetAVTransportURI(radioUrl);
|
|
13
|
+
}, 1500);
|
|
14
|
+
});
|
|
15
|
+
this._playing = true;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
public turnOff(): void {
|
|
19
|
+
this.ownSonosDevices.forEach((s) => {
|
|
20
|
+
s.device?.Stop();
|
|
21
|
+
});
|
|
22
|
+
this._playing = false;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
public trigger(track: string): void {
|
|
26
|
+
if (this._playing) {
|
|
27
|
+
this.turnOff();
|
|
28
|
+
return;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
this.playRadio(track);
|
|
32
|
+
}
|
|
33
|
+
}
|
|
@@ -1,48 +1,48 @@
|
|
|
1
|
-
import { HmIpTaster } from '../hmIPDevices/hmIpTaster';
|
|
2
|
-
import { RoomBase } from '../../../models/rooms/RoomBase';
|
|
3
|
-
|
|
4
|
-
export class TasterGroup {
|
|
5
|
-
public constructor(private _room: RoomBase, public Taster: HmIpTaster[]) {
|
|
6
|
-
for (const t of [...Taster]) {
|
|
7
|
-
t.room = this._room;
|
|
8
|
-
}
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
public initCallbacks(): void {
|
|
12
|
-
this.Taster.forEach((t) => {
|
|
13
|
-
t.tasten.ObenLinks.addLongCallback((pValue) => {
|
|
14
|
-
pValue && this._room.FensterGroup.allRolloDown(false, true);
|
|
15
|
-
});
|
|
16
|
-
|
|
17
|
-
t.tasten.ObenLinks.addShortCallback((pValue) => {
|
|
18
|
-
pValue && this._room.FensterGroup.allRolloToLevel(25, true);
|
|
19
|
-
});
|
|
20
|
-
|
|
21
|
-
t.tasten.ObenRechts.addLongCallback((pValue) => {
|
|
22
|
-
if (!pValue) {
|
|
23
|
-
return;
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
this._room.FensterGroup.allRolloUp(true);
|
|
27
|
-
});
|
|
28
|
-
|
|
29
|
-
t.tasten.ObenRechts.addShortCallback((pValue) => {
|
|
30
|
-
pValue && this._room.FensterGroup.allRolloToLevel(50, true);
|
|
31
|
-
});
|
|
32
|
-
|
|
33
|
-
t.tasten.MitteLinks.addLongCallback((pValue) => {
|
|
34
|
-
pValue && this._room.LampenGroup.switchAll(true, true);
|
|
35
|
-
});
|
|
36
|
-
|
|
37
|
-
t.tasten.MitteRechts.addLongCallback((pValue) => {
|
|
38
|
-
pValue && this._room.LampenGroup.switchAll(false, true);
|
|
39
|
-
});
|
|
40
|
-
|
|
41
|
-
if (this._room.SonosGroup.ownSonosDevices.length > 0) {
|
|
42
|
-
t.tasten.UntenRechts.addLongCallback(() => {
|
|
43
|
-
this._room.SonosGroup.trigger(this._room.Einstellungen.radioUrl);
|
|
44
|
-
});
|
|
45
|
-
}
|
|
46
|
-
});
|
|
47
|
-
}
|
|
48
|
-
}
|
|
1
|
+
import { HmIpTaster } from '../hmIPDevices/hmIpTaster';
|
|
2
|
+
import { RoomBase } from '../../../models/rooms/RoomBase';
|
|
3
|
+
|
|
4
|
+
export class TasterGroup {
|
|
5
|
+
public constructor(private _room: RoomBase, public Taster: HmIpTaster[]) {
|
|
6
|
+
for (const t of [...Taster]) {
|
|
7
|
+
t.room = this._room;
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
public initCallbacks(): void {
|
|
12
|
+
this.Taster.forEach((t) => {
|
|
13
|
+
t.tasten.ObenLinks.addLongCallback((pValue) => {
|
|
14
|
+
pValue && this._room.FensterGroup.allRolloDown(false, true);
|
|
15
|
+
}, `Close all Rollos in this room`);
|
|
16
|
+
|
|
17
|
+
t.tasten.ObenLinks.addShortCallback((pValue) => {
|
|
18
|
+
pValue && this._room.FensterGroup.allRolloToLevel(25, true);
|
|
19
|
+
}, `Nearly closes all Rollos in this room`);
|
|
20
|
+
|
|
21
|
+
t.tasten.ObenRechts.addLongCallback((pValue) => {
|
|
22
|
+
if (!pValue) {
|
|
23
|
+
return;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
this._room.FensterGroup.allRolloUp(true);
|
|
27
|
+
}, `Open all Rollos in this room`);
|
|
28
|
+
|
|
29
|
+
t.tasten.ObenRechts.addShortCallback((pValue) => {
|
|
30
|
+
pValue && this._room.FensterGroup.allRolloToLevel(50, true);
|
|
31
|
+
}, `All Rollos in this room to middle`);
|
|
32
|
+
|
|
33
|
+
t.tasten.MitteLinks.addLongCallback((pValue) => {
|
|
34
|
+
pValue && this._room.LampenGroup.switchAll(true, true);
|
|
35
|
+
}, `Turn all Lights in this room on`);
|
|
36
|
+
|
|
37
|
+
t.tasten.MitteRechts.addLongCallback((pValue) => {
|
|
38
|
+
pValue && this._room.LampenGroup.switchAll(false, true);
|
|
39
|
+
}, `Turn all Lights in this room off`);
|
|
40
|
+
|
|
41
|
+
if (this._room.SonosGroup.ownSonosDevices.length > 0) {
|
|
42
|
+
t.tasten.UntenRechts.addLongCallback(() => {
|
|
43
|
+
this._room.SonosGroup.trigger(this._room.Einstellungen.radioUrl);
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
}
|
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import { ZigbeeAquaraWater } from '../zigbee/zigbeeAquaraWater';
|
|
2
|
-
import { RoomBase } from '../../../models/rooms/RoomBase';
|
|
3
|
-
|
|
4
|
-
export class WaterGroup {
|
|
5
|
-
public constructor(private _room: RoomBase, public WaterDetectors: Array<ZigbeeAquaraWater>) {
|
|
6
|
-
for (const w of [...WaterDetectors]) {
|
|
7
|
-
w.room = this._room;
|
|
8
|
-
}
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
public stopAlarm(): void {
|
|
12
|
-
for (const d of this.WaterDetectors) {
|
|
13
|
-
d.stopAlarm(true);
|
|
14
|
-
}
|
|
15
|
-
}
|
|
16
|
-
}
|
|
1
|
+
import { ZigbeeAquaraWater } from '../zigbee/zigbeeAquaraWater';
|
|
2
|
+
import { RoomBase } from '../../../models/rooms/RoomBase';
|
|
3
|
+
|
|
4
|
+
export class WaterGroup {
|
|
5
|
+
public constructor(private _room: RoomBase, public WaterDetectors: Array<ZigbeeAquaraWater>) {
|
|
6
|
+
for (const w of [...WaterDetectors]) {
|
|
7
|
+
w.room = this._room;
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
public stopAlarm(): void {
|
|
12
|
+
for (const d of this.WaterDetectors) {
|
|
13
|
+
d.stopAlarm(true);
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
}
|