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,119 +1,119 @@
1
- import { LogLevel } from '../../../models/logLevel';
2
- import { HmIPDevice } from './hmIpDevice';
3
- import { HmIpDeviceType } from './hmIpDeviceType';
4
- import { DeviceInfo } from '../DeviceInfo';
5
- import { ServerLogService } from '../../services/log-service';
6
- import { LampSettings } from '../../../models/lampSettings';
7
- import { Utils } from '../../services/utils/utils';
8
-
9
- export class HmIpLampe extends HmIPDevice {
10
- public lightOn: boolean | undefined = undefined;
11
- public queuedLightValue: boolean | null = null;
12
- public isStromStoss: boolean = false;
13
- public settings: LampSettings = new LampSettings();
14
- private lightOnSwitchID: string = '';
15
- private turnOffTimeout: NodeJS.Timeout | undefined = undefined;
16
- private turnOffTime: number = 0;
17
-
18
- public constructor(pInfo: DeviceInfo) {
19
- super(pInfo, HmIpDeviceType.HmIpLampe);
20
- this.lightOnSwitchID = `${this.info.fullID}.2.STATE`;
21
- }
22
-
23
- public update(idSplit: string[], state: ioBroker.State, initial: boolean = false): void {
24
- ServerLogService.writeLog(
25
- LogLevel.DeepTrace,
26
- `Lampen Update für "${this.info.customName}": ID: ${idSplit.join('.')} JSON: ${JSON.stringify(state)}`,
27
- );
28
- super.update(idSplit, state, initial, true);
29
- this.queuedLightValue = null;
30
- switch (idSplit[3]) {
31
- case '1':
32
- if (idSplit[4] === 'STATE') {
33
- this.lightOn = state.val as boolean;
34
- }
35
- break;
36
- }
37
- }
38
-
39
- /**
40
- * This function thats the light to a specific value
41
- * @param pValue The desired value
42
- * @param timeout A chosen Timeout after which the light should be reset
43
- */
44
- public setLight(pValue: boolean, timeout: number = -1, force: boolean = false): void {
45
- if (!force && pValue === this.lightOn && this.queuedLightValue === null) {
46
- ServerLogService.writeLog(
47
- LogLevel.DeepTrace,
48
- `Skip light command for "${this.info.customName}" as it is already ${pValue}`,
49
- );
50
- return;
51
- }
52
- if (this.lightOnSwitchID === '') {
53
- ServerLogService.writeLog(LogLevel.Error, `Keine Switch ID für "${this.info.customName}" bekannt.`);
54
- return;
55
- }
56
-
57
- if (!this.ioConn) {
58
- ServerLogService.writeLog(LogLevel.Error, `Keine Connection für "${this.info.customName}" bekannt.`);
59
- return;
60
- }
61
-
62
- if (!force && Utils.nowMS() < this.turnOffTime) {
63
- ServerLogService.writeLog(
64
- LogLevel.Debug,
65
- `Skip automatic command for "${this.info.customName}" to ${pValue} as it is locked until ${new Date(
66
- this.turnOffTime,
67
- ).toLocaleString()}`,
68
- );
69
- return;
70
- }
71
-
72
- ServerLogService.writeLog(LogLevel.Debug, `Lampe schalten: "${this.info.customName}" Wert: ${pValue}`);
73
- this.ioConn.setState(this.lightOnSwitchID, pValue, (err) => {
74
- if (err) {
75
- ServerLogService.writeLog(LogLevel.Error, `Lampe schalten ergab Fehler: ${err}`);
76
- }
77
- });
78
- this.queuedLightValue = pValue;
79
-
80
- if (this.isStromStoss) {
81
- timeout = 5000;
82
- }
83
-
84
- if (this.turnOffTimeout !== undefined) {
85
- clearTimeout(this.turnOffTimeout);
86
- this.turnOffTimeout = undefined;
87
- }
88
-
89
- if (timeout < 0 || !pValue) {
90
- return;
91
- }
92
-
93
- this.turnOffTime = Utils.nowMS() + timeout;
94
- this.turnOffTimeout = Utils.guardedTimeout(
95
- () => {
96
- ServerLogService.writeLog(LogLevel.Debug, `Delayed Turnoff for "${this.info.customName}" initiated`);
97
- this.turnOffTimeout = undefined;
98
- if (!this.room) {
99
- this.setLight(false, -1, true);
100
- } else {
101
- this.room.setLightTimeBased(true);
102
- }
103
- },
104
- timeout,
105
- this,
106
- );
107
- }
108
-
109
- /**
110
- * Switch the current condition of the light
111
- * @param force Whether this is a forcing action skipping delays and locks
112
- */
113
- public toggleLight(force: boolean = false): boolean {
114
- const newVal = this.queuedLightValue !== null ? !this.queuedLightValue : !this.lightOn;
115
- const timeout: number = newVal && force ? 30 * 60 * 1000 : -1;
116
- this.setLight(newVal, timeout, force);
117
- return newVal;
118
- }
119
- }
1
+ import { LogLevel } from '../../../models/logLevel';
2
+ import { HmIPDevice } from './hmIpDevice';
3
+ import { HmIpDeviceType } from './hmIpDeviceType';
4
+ import { DeviceInfo } from '../DeviceInfo';
5
+ import { ServerLogService } from '../../services/log-service';
6
+ import { LampSettings } from '../../../models/lampSettings';
7
+ import { Utils } from '../../services/utils/utils';
8
+
9
+ export class HmIpLampe extends HmIPDevice {
10
+ public lightOn: boolean | undefined = undefined;
11
+ public queuedLightValue: boolean | null = null;
12
+ public isStromStoss: boolean = false;
13
+ public settings: LampSettings = new LampSettings();
14
+ private lightOnSwitchID: string = '';
15
+ private turnOffTimeout: NodeJS.Timeout | undefined = undefined;
16
+ private turnOffTime: number = 0;
17
+
18
+ public constructor(pInfo: DeviceInfo) {
19
+ super(pInfo, HmIpDeviceType.HmIpLampe);
20
+ this.lightOnSwitchID = `${this.info.fullID}.2.STATE`;
21
+ }
22
+
23
+ public update(idSplit: string[], state: ioBroker.State, initial: boolean = false): void {
24
+ ServerLogService.writeLog(
25
+ LogLevel.DeepTrace,
26
+ `Lampen Update für "${this.info.customName}": ID: ${idSplit.join('.')} JSON: ${JSON.stringify(state)}`,
27
+ );
28
+ super.update(idSplit, state, initial, true);
29
+ this.queuedLightValue = null;
30
+ switch (idSplit[3]) {
31
+ case '1':
32
+ if (idSplit[4] === 'STATE') {
33
+ this.lightOn = state.val as boolean;
34
+ }
35
+ break;
36
+ }
37
+ }
38
+
39
+ /**
40
+ * This function thats the light to a specific value
41
+ * @param pValue The desired value
42
+ * @param timeout A chosen Timeout after which the light should be reset
43
+ */
44
+ public setLight(pValue: boolean, timeout: number = -1, force: boolean = false): void {
45
+ if (!force && pValue === this.lightOn && this.queuedLightValue === null) {
46
+ ServerLogService.writeLog(
47
+ LogLevel.DeepTrace,
48
+ `Skip light command for "${this.info.customName}" as it is already ${pValue}`,
49
+ );
50
+ return;
51
+ }
52
+ if (this.lightOnSwitchID === '') {
53
+ ServerLogService.writeLog(LogLevel.Error, `Keine Switch ID für "${this.info.customName}" bekannt.`);
54
+ return;
55
+ }
56
+
57
+ if (!this.ioConn) {
58
+ ServerLogService.writeLog(LogLevel.Error, `Keine Connection für "${this.info.customName}" bekannt.`);
59
+ return;
60
+ }
61
+
62
+ if (!force && Utils.nowMS() < this.turnOffTime) {
63
+ ServerLogService.writeLog(
64
+ LogLevel.Debug,
65
+ `Skip automatic command for "${this.info.customName}" to ${pValue} as it is locked until ${new Date(
66
+ this.turnOffTime,
67
+ ).toLocaleString()}`,
68
+ );
69
+ return;
70
+ }
71
+
72
+ ServerLogService.writeLog(LogLevel.Debug, `Lampe schalten: "${this.info.customName}" Wert: ${pValue}`);
73
+ this.ioConn.setState(this.lightOnSwitchID, pValue, (err) => {
74
+ if (err) {
75
+ ServerLogService.writeLog(LogLevel.Error, `Lampe schalten ergab Fehler: ${err}`);
76
+ }
77
+ });
78
+ this.queuedLightValue = pValue;
79
+
80
+ if (this.isStromStoss) {
81
+ timeout = 5000;
82
+ }
83
+
84
+ if (this.turnOffTimeout !== undefined) {
85
+ clearTimeout(this.turnOffTimeout);
86
+ this.turnOffTimeout = undefined;
87
+ }
88
+
89
+ if (timeout < 0 || !pValue) {
90
+ return;
91
+ }
92
+
93
+ this.turnOffTime = Utils.nowMS() + timeout;
94
+ this.turnOffTimeout = Utils.guardedTimeout(
95
+ () => {
96
+ ServerLogService.writeLog(LogLevel.Debug, `Delayed Turnoff for "${this.info.customName}" initiated`);
97
+ this.turnOffTimeout = undefined;
98
+ if (!this.room) {
99
+ this.setLight(false, -1, true);
100
+ } else {
101
+ this.room.setLightTimeBased(true);
102
+ }
103
+ },
104
+ timeout,
105
+ this,
106
+ );
107
+ }
108
+
109
+ /**
110
+ * Switch the current condition of the light
111
+ * @param force Whether this is a forcing action skipping delays and locks
112
+ */
113
+ public toggleLight(force: boolean = false): boolean {
114
+ const newVal = this.queuedLightValue !== null ? !this.queuedLightValue : !this.lightOn;
115
+ const timeout: number = newVal && force ? 30 * 60 * 1000 : -1;
116
+ this.setLight(newVal, timeout, force);
117
+ return newVal;
118
+ }
119
+ }
@@ -1,99 +1,99 @@
1
- import { HmIPDevice } from './hmIpDevice';
2
- import { HmIpDeviceType } from './hmIpDeviceType';
3
- import { DeviceInfo } from '../DeviceInfo';
4
- import { LogLevel } from '../../../models/logLevel';
5
- import { ServerLogService } from '../../services/log-service';
6
- import { Persist } from '../../services/dbo/persist';
7
- import { CountToday } from '../../../models/persistence/todaysCount';
8
- import { Utils } from '../../services/utils/utils';
9
-
10
- export class HmIpPraezenz extends HmIPDevice {
11
- public excludeFromNightAlarm: boolean = false;
12
- public presenceDetected: boolean = false;
13
- private _detectionsToday: number = 0;
14
- private _presenceDetectedCallback: Array<(pValue: boolean) => void> = [];
15
- private static PRESENCE_DETECTION: string = 'PRESENCE_DETECTION_STATE';
16
- private presenceStateID: string;
17
- private initialized: boolean = false;
18
-
19
- public get detectionsToday(): number {
20
- return this._detectionsToday;
21
- }
22
-
23
- public set detectionsToday(pVal: number) {
24
- const oldVal: number = this._detectionsToday;
25
- this._detectionsToday = pVal;
26
- Persist.persistTodayCount(this, pVal, oldVal);
27
- }
28
-
29
- public constructor(pInfo: DeviceInfo) {
30
- super(pInfo, HmIpDeviceType.HmIpPraezenz);
31
- this.presenceStateID = `${this.info.fullID}.1.${HmIpPraezenz.PRESENCE_DETECTION}`;
32
- Persist.getCount(this).then((todayCount: CountToday) => {
33
- this.detectionsToday = todayCount.counter;
34
- ServerLogService.writeLog(
35
- LogLevel.Debug,
36
- `Präsenzcounter "${this.info.customName}" vorinitialisiert mit ${this.detectionsToday}`,
37
- );
38
- this.initialized = true;
39
- });
40
- }
41
-
42
- public addPresenceCallback(pCallback: (pValue: boolean) => void): void {
43
- this._presenceDetectedCallback.push(pCallback);
44
- }
45
-
46
- public update(idSplit: string[], state: ioBroker.State, initial: boolean = false): void {
47
- ServerLogService.writeLog(LogLevel.Trace, `Präzens Update: JSON: ${JSON.stringify(state)}ID: ${idSplit.join('.')}`);
48
- super.update(idSplit, state, initial, true);
49
-
50
- if (idSplit[3] !== '1') {
51
- // Nur die Infos in Kanal 1 sind relevant
52
- return;
53
- }
54
-
55
- switch (idSplit[4]) {
56
- case HmIpPraezenz.PRESENCE_DETECTION:
57
- this.updatePresence(state.val as boolean);
58
- break;
59
- }
60
- }
61
-
62
- public updatePresence(pVal: boolean): void {
63
- if (!this.initialized && pVal) {
64
- ServerLogService.writeLog(
65
- LogLevel.Debug,
66
- `Präsenz für "${this.info.customName}" erkannt aber die Initialisierung aus der DB ist noch nicht erfolgt --> verzögern`,
67
- );
68
- Utils.guardedTimeout(
69
- () => {
70
- this.updatePresence(pVal);
71
- },
72
- 1000,
73
- this,
74
- );
75
- return;
76
- }
77
- if (pVal === this.presenceDetected) {
78
- ServerLogService.writeLog(
79
- LogLevel.Debug,
80
- `Überspringe Präsenz für "${this.info.customName}" da bereits der Wert ${pVal} vorliegt`,
81
- );
82
- return;
83
- }
84
-
85
- this.presenceDetected = pVal;
86
- ServerLogService.writeLog(LogLevel.Debug, `Neuer Präsenzstatus Wert für "${this.info.customName}": ${pVal}`);
87
-
88
- if (pVal) {
89
- this.detectionsToday++;
90
- ServerLogService.writeLog(
91
- LogLevel.Trace,
92
- `Dies ist die ${this.detectionsToday} Bewegung für "${this.info.customName}"`,
93
- );
94
- }
95
- for (const c of this._presenceDetectedCallback) {
96
- c(pVal);
97
- }
98
- }
99
- }
1
+ import { HmIPDevice } from './hmIpDevice';
2
+ import { HmIpDeviceType } from './hmIpDeviceType';
3
+ import { DeviceInfo } from '../DeviceInfo';
4
+ import { LogLevel } from '../../../models/logLevel';
5
+ import { ServerLogService } from '../../services/log-service';
6
+ import { Persist } from '../../services/dbo/persist';
7
+ import { CountToday } from '../../../models/persistence/todaysCount';
8
+ import { Utils } from '../../services/utils/utils';
9
+
10
+ export class HmIpPraezenz extends HmIPDevice {
11
+ public excludeFromNightAlarm: boolean = false;
12
+ public presenceDetected: boolean = false;
13
+ private _detectionsToday: number = 0;
14
+ private _presenceDetectedCallback: Array<(pValue: boolean) => void> = [];
15
+ private static PRESENCE_DETECTION: string = 'PRESENCE_DETECTION_STATE';
16
+ private presenceStateID: string;
17
+ private initialized: boolean = false;
18
+
19
+ public get detectionsToday(): number {
20
+ return this._detectionsToday;
21
+ }
22
+
23
+ public set detectionsToday(pVal: number) {
24
+ const oldVal: number = this._detectionsToday;
25
+ this._detectionsToday = pVal;
26
+ Persist.persistTodayCount(this, pVal, oldVal);
27
+ }
28
+
29
+ public constructor(pInfo: DeviceInfo) {
30
+ super(pInfo, HmIpDeviceType.HmIpPraezenz);
31
+ this.presenceStateID = `${this.info.fullID}.1.${HmIpPraezenz.PRESENCE_DETECTION}`;
32
+ Persist.getCount(this).then((todayCount: CountToday) => {
33
+ this.detectionsToday = todayCount.counter;
34
+ ServerLogService.writeLog(
35
+ LogLevel.Debug,
36
+ `Präsenzcounter "${this.info.customName}" vorinitialisiert mit ${this.detectionsToday}`,
37
+ );
38
+ this.initialized = true;
39
+ });
40
+ }
41
+
42
+ public addPresenceCallback(pCallback: (pValue: boolean) => void): void {
43
+ this._presenceDetectedCallback.push(pCallback);
44
+ }
45
+
46
+ public update(idSplit: string[], state: ioBroker.State, initial: boolean = false): void {
47
+ ServerLogService.writeLog(LogLevel.Trace, `Präzens Update: JSON: ${JSON.stringify(state)}ID: ${idSplit.join('.')}`);
48
+ super.update(idSplit, state, initial, true);
49
+
50
+ if (idSplit[3] !== '1') {
51
+ // Nur die Infos in Kanal 1 sind relevant
52
+ return;
53
+ }
54
+
55
+ switch (idSplit[4]) {
56
+ case HmIpPraezenz.PRESENCE_DETECTION:
57
+ this.updatePresence(state.val as boolean);
58
+ break;
59
+ }
60
+ }
61
+
62
+ public updatePresence(pVal: boolean): void {
63
+ if (!this.initialized && pVal) {
64
+ ServerLogService.writeLog(
65
+ LogLevel.Debug,
66
+ `Präsenz für "${this.info.customName}" erkannt aber die Initialisierung aus der DB ist noch nicht erfolgt --> verzögern`,
67
+ );
68
+ Utils.guardedTimeout(
69
+ () => {
70
+ this.updatePresence(pVal);
71
+ },
72
+ 1000,
73
+ this,
74
+ );
75
+ return;
76
+ }
77
+ if (pVal === this.presenceDetected) {
78
+ ServerLogService.writeLog(
79
+ LogLevel.Debug,
80
+ `Überspringe Präsenz für "${this.info.customName}" da bereits der Wert ${pVal} vorliegt`,
81
+ );
82
+ return;
83
+ }
84
+
85
+ this.presenceDetected = pVal;
86
+ ServerLogService.writeLog(LogLevel.Debug, `Neuer Präsenzstatus Wert für "${this.info.customName}": ${pVal}`);
87
+
88
+ if (pVal) {
89
+ this.detectionsToday++;
90
+ ServerLogService.writeLog(
91
+ LogLevel.Trace,
92
+ `Dies ist die ${this.detectionsToday} Bewegung für "${this.info.customName}"`,
93
+ );
94
+ }
95
+ for (const c of this._presenceDetectedCallback) {
96
+ c(pVal);
97
+ }
98
+ }
99
+ }