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.
Files changed (113) hide show
  1. package/.eslintrc.js +27 -27
  2. package/.github/workflows/npm-publish.yml +50 -0
  3. package/.prettierrc.js +9 -9
  4. package/LICENSE +21 -21
  5. package/index.js +1 -1
  6. package/models/connectionCallbacks.ts +13 -13
  7. package/models/daytime.ts +3 -3
  8. package/models/deviceConfig.ts +8 -8
  9. package/models/dimmerSettings.ts +5 -5
  10. package/models/iTemperaturDataPoint.ts +9 -9
  11. package/models/lampSettings.ts +5 -5
  12. package/models/ledSettings.ts +19 -19
  13. package/models/logLevel.ts +9 -9
  14. package/models/persistence/BasicRoomInfo.ts +3 -3
  15. package/models/persistence/DailyMovementCount.ts +3 -3
  16. package/models/persistence/RoomDetailInfo.ts +4 -4
  17. package/models/persistence/temperaturDataPoint.ts +12 -12
  18. package/models/persistence/todaysCount.ts +3 -3
  19. package/models/rooms/RoomBase.ts +357 -357
  20. package/models/rooms/RoomSettings/RoomSettings.ts +159 -159
  21. package/models/rooms/RoomSettings/hmIPRoomSettings.ts +53 -53
  22. package/models/rooms/RoomSettings/iRoomDefaultSettings.ts +17 -17
  23. package/models/rooms/RoomSettings/readme.md +17 -17
  24. package/models/rooms/RoomSettings/zigbeeRoomSettings.ts +51 -51
  25. package/models/rooms/iRoomImportEnforcer.ts +3 -3
  26. package/models/rooms/readme.md +11 -11
  27. package/models/temperaturSettings.ts +22 -22
  28. package/models/timeCallback.ts +90 -90
  29. package/package.json +1 -1
  30. package/server/config/config-readme.md +19 -19
  31. package/server/config/iConfig.ts +53 -53
  32. package/server/config/private/mainConfig.json +64 -64
  33. package/server/devices/DeviceInfo.ts +66 -66
  34. package/server/devices/Griffe.ts +31 -31
  35. package/server/devices/Heizgruppen.ts +91 -91
  36. package/server/devices/Rollos.ts +48 -48
  37. package/server/devices/deviceUpdater.ts +72 -72
  38. package/server/devices/devices.ts +189 -189
  39. package/server/devices/groups/fensterGroup.ts +175 -175
  40. package/server/devices/groups/heatGroup.ts +32 -32
  41. package/server/devices/groups/lampenGroup.ts +88 -88
  42. package/server/devices/groups/praesenzGroup.ts +182 -182
  43. package/server/devices/groups/smokeGroup.ts +16 -16
  44. package/server/devices/groups/sonosGroup.ts +33 -33
  45. package/server/devices/groups/tasterGroup.ts +48 -48
  46. package/server/devices/groups/waterGroup.ts +16 -16
  47. package/server/devices/hmIPDevices/Fenster.ts +114 -114
  48. package/server/devices/hmIPDevices/FensterPosition.ts +5 -5
  49. package/server/devices/hmIPDevices/TuerPosition.ts +4 -4
  50. package/server/devices/hmIPDevices/hmIpBewegung.ts +126 -126
  51. package/server/devices/hmIPDevices/hmIpDevice.ts +90 -90
  52. package/server/devices/hmIPDevices/hmIpDeviceType.ts +14 -14
  53. package/server/devices/hmIPDevices/hmIpGriff.ts +143 -143
  54. package/server/devices/hmIPDevices/hmIpHeizgruppe.ts +172 -172
  55. package/server/devices/hmIPDevices/hmIpHeizung.ts +69 -69
  56. package/server/devices/hmIPDevices/hmIpLampe.ts +119 -119
  57. package/server/devices/hmIPDevices/hmIpPraezenz.ts +99 -99
  58. package/server/devices/hmIPDevices/hmIpRoll.ts +133 -133
  59. package/server/devices/hmIPDevices/hmIpTaster.ts +82 -73
  60. package/server/devices/hmIPDevices/hmIpTherm.ts +19 -19
  61. package/server/devices/hmIPDevices/hmIpTuer.ts +115 -115
  62. package/server/devices/hmIPDevices/hmIpWippe.ts +55 -55
  63. package/server/devices/iDeviceUpdater.ts +4 -4
  64. package/server/devices/iIoBrokerDevice.ts +44 -44
  65. package/server/devices/iTaster.ts +6 -0
  66. package/server/devices/{hmIPDevices/hmIpTaste.ts → taste.ts} +84 -72
  67. package/server/devices/wledDevice.ts +124 -124
  68. package/server/devices/zigbee/ZigbeeActuator.ts +113 -113
  69. package/server/devices/zigbee/zigbeeAquaraVibra.ts +171 -171
  70. package/server/devices/zigbee/zigbeeAquaraWater.ts +94 -94
  71. package/server/devices/zigbee/zigbeeBlitzShp.ts +77 -77
  72. package/server/devices/zigbee/zigbeeDevice.ts +115 -115
  73. package/server/devices/zigbee/zigbeeDeviceType.ts +13 -13
  74. package/server/devices/zigbee/zigbeeHeimanSmoke.ts +99 -99
  75. package/server/devices/zigbee/zigbeeIkeaSteckdose.ts +31 -31
  76. package/server/devices/zigbee/zigbeeIlluActuator.ts +37 -37
  77. package/server/devices/zigbee/zigbeeIlluDimmer.ts +165 -165
  78. package/server/devices/zigbee/zigbeeIlluLampe.ts +33 -33
  79. package/server/devices/zigbee/zigbeeIlluLedRGBCCT.ts +137 -137
  80. package/server/ioBroker/connection.ts +1655 -1655
  81. package/server/ioBroker/ioBroker.main.ts +99 -99
  82. package/server/ioBroker/socketIOAuthInfo.ts +5 -5
  83. package/server/ioBroker/socketIOConnectOptions.ts +6 -6
  84. package/server/ioBroker/socketIOLogging.ts +29 -29
  85. package/server/ioBroker/socketIOVisCommand.ts +11 -11
  86. package/server/services/HTTPSOptions.ts +14 -14
  87. package/server/services/Sonos/OwnSonosDevices.ts +9 -0
  88. package/server/services/Sonos/mp3-server.ts +75 -75
  89. package/server/services/Sonos/polly-service.ts +100 -100
  90. package/server/services/Sonos/sonos-service.ts +194 -199
  91. package/server/services/Telegram/telegram-Commands.ts +237 -215
  92. package/server/services/Telegram/telegram-service.ts +171 -171
  93. package/server/services/Telegram/telegramMessageCalback.ts +11 -11
  94. package/server/services/calendar/muell-tonne.ts +82 -83
  95. package/server/services/calendar/m/303/274ll-service.ts +147 -146
  96. package/server/services/dbo/persist.ts +125 -125
  97. package/server/services/https-service.ts +71 -71
  98. package/server/services/log-service.ts +69 -69
  99. package/server/services/news-service.ts +81 -81
  100. package/server/services/settings-service.ts +15 -15
  101. package/server/services/time-callback-service.ts +223 -223
  102. package/server/services/utils/ringstorage.ts +24 -24
  103. package/server/services/utils/utils.ts +52 -52
  104. package/server/services/weather/weather-alert.ts +7 -7
  105. package/server/services/weather/weather-current.ts +26 -26
  106. package/server/services/weather/weather-daily.ts +22 -22
  107. package/server/services/weather/weather-feelsLike.ts +6 -6
  108. package/server/services/weather/weather-hourly.ts +17 -17
  109. package/server/services/weather/weather-item.ts +6 -6
  110. package/server/services/weather/weather-minutes.ts +4 -4
  111. package/server/services/weather/weather-service.ts +277 -277
  112. package/server/services/weather/weather-temp.ts +8 -8
  113. 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
+ }