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,124 +1,124 @@
1
- import { LogLevel } from '../../models/logLevel';
2
- import { ServerLogService } from '../services/log-service';
3
- import { IOBrokerConnection } from '../ioBroker/connection';
4
- import { DeviceInfo } from './DeviceInfo';
5
-
6
- export class WledDevice {
7
- public on: boolean = false;
8
- public brightness: number = -1;
9
- public linkQuality: number = 0;
10
- public battery: number = -1;
11
- public voltage: string = '';
12
- private _info: DeviceInfo;
13
- private _ioConnection?: IOBrokerConnection;
14
- private _onID: string;
15
- private _brightnessID: string;
16
-
17
- public constructor(pInfo: DeviceInfo) {
18
- this._info = pInfo;
19
- this.addToCorrectRoom();
20
- this._onID = `${this.info.fullID}.on`;
21
- this._brightnessID = `${this.info.fullID}.bri`;
22
- }
23
-
24
- /**
25
- * Getter info
26
- * @return {DeviceInfo}
27
- */
28
- public get info(): DeviceInfo {
29
- return this._info;
30
- }
31
-
32
- /**
33
- * Setter info
34
- * @param {DeviceInfo} value
35
- */
36
- public set info(value: DeviceInfo) {
37
- this._info = value;
38
- }
39
-
40
- /**
41
- * Getter ioConn
42
- * @return {IOBrokerConnection}
43
- */
44
- public get ioConn(): IOBrokerConnection | undefined {
45
- return this._ioConnection;
46
- }
47
-
48
- /**
49
- * Setter ioConn
50
- * @param {IOBrokerConnection} value
51
- */
52
- public set ioConn(value: IOBrokerConnection | undefined) {
53
- this._ioConnection = value;
54
- }
55
-
56
- private addToCorrectRoom(): void {
57
- ServerLogService.writeLog(LogLevel.DeepTrace, `Neues Zigbee Gerät für ${this._info.room}`);
58
- switch (this._info.room) {
59
- case 'Wohnz':
60
- // room1OGWohn.addWLED(this._info);
61
- break;
62
- default:
63
- console.warn(`${this._info.room} ist noch kein bekannter Raum für WLED Geräte`);
64
- }
65
- }
66
-
67
- public update(idSplit: string[], state: ioBroker.State, initial: boolean = false, pOverride: boolean = false): void {
68
- ServerLogService.writeLog(
69
- LogLevel.DeepTrace,
70
- `Wled:Update für "${this.info.customName}": ID: ${idSplit.join('.')} JSON: ${JSON.stringify(state)}`,
71
- );
72
- if (!pOverride) {
73
- ServerLogService.writeLog(
74
- LogLevel.Warn,
75
- `Keine Update Überschreibung für "${this.info.customName}":\n\tID: ${idSplit.join(
76
- '.',
77
- )}\n\tData: ${JSON.stringify(state)}`,
78
- );
79
- }
80
-
81
- switch (idSplit[3]) {
82
- case 'on':
83
- this.on = state.val as boolean;
84
- break;
85
- case 'bri':
86
- this.brightness = state.val as number;
87
- break;
88
- }
89
- }
90
-
91
- public setLight(pValue: boolean, brightness: number = -1): void {
92
- if (this._onID === '') {
93
- ServerLogService.writeLog(LogLevel.Error, `Keine On ID für "${this.info.customName}" bekannt.`);
94
- return;
95
- }
96
-
97
- if (!this.ioConn) {
98
- ServerLogService.writeLog(LogLevel.Error, `Keine Connection für "${this.info.customName}" bekannt.`);
99
- return;
100
- }
101
-
102
- if (pValue && brightness === -1 && this.brightness < 10) {
103
- brightness = 10;
104
- }
105
- ServerLogService.writeLog(
106
- LogLevel.Debug,
107
- `WLED Schalten: "${this.info.customName}" An: ${pValue}\tHelligkeit: ${brightness}%`,
108
- );
109
-
110
- this.ioConn.setState(this._onID, pValue, (err) => {
111
- if (err) {
112
- ServerLogService.writeLog(LogLevel.Error, `WLED schalten ergab Fehler: ${err}`);
113
- }
114
- });
115
-
116
- if (brightness > -1) {
117
- this.ioConn.setState(this._brightnessID, brightness, (err) => {
118
- if (err) {
119
- ServerLogService.writeLog(LogLevel.Error, `Dimmer Helligkeit schalten ergab Fehler: ${err}`);
120
- }
121
- });
122
- }
123
- }
124
- }
1
+ import { LogLevel } from '../../models/logLevel';
2
+ import { ServerLogService } from '../services/log-service';
3
+ import { IOBrokerConnection } from '../ioBroker/connection';
4
+ import { DeviceInfo } from './DeviceInfo';
5
+
6
+ export class WledDevice {
7
+ public on: boolean = false;
8
+ public brightness: number = -1;
9
+ public linkQuality: number = 0;
10
+ public battery: number = -1;
11
+ public voltage: string = '';
12
+ private _info: DeviceInfo;
13
+ private _ioConnection?: IOBrokerConnection;
14
+ private _onID: string;
15
+ private _brightnessID: string;
16
+
17
+ public constructor(pInfo: DeviceInfo) {
18
+ this._info = pInfo;
19
+ this.addToCorrectRoom();
20
+ this._onID = `${this.info.fullID}.on`;
21
+ this._brightnessID = `${this.info.fullID}.bri`;
22
+ }
23
+
24
+ /**
25
+ * Getter info
26
+ * @return {DeviceInfo}
27
+ */
28
+ public get info(): DeviceInfo {
29
+ return this._info;
30
+ }
31
+
32
+ /**
33
+ * Setter info
34
+ * @param {DeviceInfo} value
35
+ */
36
+ public set info(value: DeviceInfo) {
37
+ this._info = value;
38
+ }
39
+
40
+ /**
41
+ * Getter ioConn
42
+ * @return {IOBrokerConnection}
43
+ */
44
+ public get ioConn(): IOBrokerConnection | undefined {
45
+ return this._ioConnection;
46
+ }
47
+
48
+ /**
49
+ * Setter ioConn
50
+ * @param {IOBrokerConnection} value
51
+ */
52
+ public set ioConn(value: IOBrokerConnection | undefined) {
53
+ this._ioConnection = value;
54
+ }
55
+
56
+ private addToCorrectRoom(): void {
57
+ ServerLogService.writeLog(LogLevel.DeepTrace, `Neues Zigbee Gerät für ${this._info.room}`);
58
+ switch (this._info.room) {
59
+ case 'Wohnz':
60
+ // room1OGWohn.addWLED(this._info);
61
+ break;
62
+ default:
63
+ console.warn(`${this._info.room} ist noch kein bekannter Raum für WLED Geräte`);
64
+ }
65
+ }
66
+
67
+ public update(idSplit: string[], state: ioBroker.State, initial: boolean = false, pOverride: boolean = false): void {
68
+ ServerLogService.writeLog(
69
+ LogLevel.DeepTrace,
70
+ `Wled:Update für "${this.info.customName}": ID: ${idSplit.join('.')} JSON: ${JSON.stringify(state)}`,
71
+ );
72
+ if (!pOverride) {
73
+ ServerLogService.writeLog(
74
+ LogLevel.Warn,
75
+ `Keine Update Überschreibung für "${this.info.customName}":\n\tID: ${idSplit.join(
76
+ '.',
77
+ )}\n\tData: ${JSON.stringify(state)}`,
78
+ );
79
+ }
80
+
81
+ switch (idSplit[3]) {
82
+ case 'on':
83
+ this.on = state.val as boolean;
84
+ break;
85
+ case 'bri':
86
+ this.brightness = state.val as number;
87
+ break;
88
+ }
89
+ }
90
+
91
+ public setLight(pValue: boolean, brightness: number = -1): void {
92
+ if (this._onID === '') {
93
+ ServerLogService.writeLog(LogLevel.Error, `Keine On ID für "${this.info.customName}" bekannt.`);
94
+ return;
95
+ }
96
+
97
+ if (!this.ioConn) {
98
+ ServerLogService.writeLog(LogLevel.Error, `Keine Connection für "${this.info.customName}" bekannt.`);
99
+ return;
100
+ }
101
+
102
+ if (pValue && brightness === -1 && this.brightness < 10) {
103
+ brightness = 10;
104
+ }
105
+ ServerLogService.writeLog(
106
+ LogLevel.Debug,
107
+ `WLED Schalten: "${this.info.customName}" An: ${pValue}\tHelligkeit: ${brightness}%`,
108
+ );
109
+
110
+ this.ioConn.setState(this._onID, pValue, (err) => {
111
+ if (err) {
112
+ ServerLogService.writeLog(LogLevel.Error, `WLED schalten ergab Fehler: ${err}`);
113
+ }
114
+ });
115
+
116
+ if (brightness > -1) {
117
+ this.ioConn.setState(this._brightnessID, brightness, (err) => {
118
+ if (err) {
119
+ ServerLogService.writeLog(LogLevel.Error, `Dimmer Helligkeit schalten ergab Fehler: ${err}`);
120
+ }
121
+ });
122
+ }
123
+ }
124
+ }
@@ -1,113 +1,113 @@
1
- import { LogLevel } from '../../../models/logLevel';
2
- import { ZigbeeDevice } from './zigbeeDevice';
3
- import { DeviceInfo } from '../DeviceInfo';
4
- import { ZigbeeDeviceType } from './zigbeeDeviceType';
5
- import { ServerLogService } from '../../services/log-service';
6
- import { Utils } from '../../services/utils/utils';
7
- import { LampSettings } from '../../../models/lampSettings';
8
-
9
- export class ZigbeeActuator extends ZigbeeDevice {
10
- public settings: LampSettings = new LampSettings();
11
- protected readonly actuatorOnSwitchID: string;
12
- protected queuedValue: boolean | null = null;
13
- protected actuatorOn: boolean = false;
14
- private turnOffTimeout: NodeJS.Timeout | undefined = undefined;
15
- private turnOffTime: number = 0;
16
-
17
- public constructor(pInfo: DeviceInfo, type: ZigbeeDeviceType, actuatorOnSwitchID: string) {
18
- super(pInfo, type);
19
- this.actuatorOnSwitchID = actuatorOnSwitchID;
20
- }
21
-
22
- public update(
23
- idSplit: string[],
24
- state: ioBroker.State,
25
- initial: boolean = false,
26
- handledByChildObject: boolean = false,
27
- ): void {
28
- if (!handledByChildObject) {
29
- ServerLogService.writeLog(
30
- LogLevel.DeepTrace,
31
- `Aktuator Update für "${this.info.customName}": ID: ${idSplit.join('.')} JSON: ${JSON.stringify(state)}`,
32
- );
33
- }
34
- this.queuedValue = null;
35
- super.update(idSplit, state, initial, true);
36
- switch (idSplit[3]) {
37
- case 'state':
38
- !handledByChildObject &&
39
- ServerLogService.writeLog(LogLevel.Trace, `Aktor Update für ${this.info.customName} auf ${state.val}`);
40
- this.actuatorOn = state.val as boolean;
41
- break;
42
- }
43
- }
44
-
45
- public setActuator(pValue: boolean, timeout: number = -1, force: boolean = false): void {
46
- if (this.actuatorOnSwitchID === '') {
47
- ServerLogService.writeLog(LogLevel.Error, `Keine Switch ID für "${this.info.customName}" bekannt.`);
48
- return;
49
- }
50
-
51
- if (!force && Utils.nowMS() < this.turnOffTime) {
52
- ServerLogService.writeLog(
53
- LogLevel.Debug,
54
- `Skip automatic command for "${this.info.customName}" to ${pValue} as it is locked until ${new Date(
55
- this.turnOffTime,
56
- ).toLocaleTimeString()}`,
57
- );
58
- return;
59
- }
60
-
61
- if (!this.ioConn) {
62
- ServerLogService.writeLog(LogLevel.Error, `Keine Connection für "${this.info.customName}" bekannt.`);
63
- return;
64
- }
65
-
66
- if (!force && pValue === this.actuatorOn && this.queuedValue === null) {
67
- ServerLogService.writeLog(
68
- LogLevel.Debug,
69
- `Skip actuator command for "${this.info.customName}" as it is already ${pValue}`,
70
- );
71
- return;
72
- }
73
-
74
- ServerLogService.writeLog(LogLevel.Debug, `Stecker schalten: "${this.info.customName}" Wert: ${pValue}`);
75
- this.ioConn.setState(this.actuatorOnSwitchID, pValue, (err) => {
76
- if (err) {
77
- console.log(`Stecker schalten ergab Fehler: ${err}`);
78
- }
79
- });
80
- this.queuedValue = pValue;
81
-
82
- if (this.turnOffTimeout !== undefined) {
83
- clearTimeout(this.turnOffTimeout);
84
- this.turnOffTimeout = undefined;
85
- }
86
-
87
- if (timeout < 0 || !pValue) {
88
- return;
89
- }
90
-
91
- this.turnOffTime = Utils.nowMS() + timeout;
92
- this.turnOffTimeout = Utils.guardedTimeout(
93
- () => {
94
- ServerLogService.writeLog(LogLevel.Debug, `Delayed Turnoff for "${this.info.customName}" initiated`);
95
- this.turnOffTimeout = undefined;
96
- if (!this.room) {
97
- this.setActuator(false, -1, true);
98
- } else {
99
- this.room.setLightTimeBased(true);
100
- }
101
- },
102
- timeout,
103
- this,
104
- );
105
- }
106
-
107
- public toggleActuator(force: boolean = false): boolean {
108
- const newVal = this.queuedValue !== null ? !this.queuedValue : !this.actuatorOn;
109
- const timeout: number = newVal && force ? 30 * 60 * 1000 : -1;
110
- this.setActuator(newVal, timeout, force);
111
- return newVal;
112
- }
113
- }
1
+ import { LogLevel } from '../../../models/logLevel';
2
+ import { ZigbeeDevice } from './zigbeeDevice';
3
+ import { DeviceInfo } from '../DeviceInfo';
4
+ import { ZigbeeDeviceType } from './zigbeeDeviceType';
5
+ import { ServerLogService } from '../../services/log-service';
6
+ import { Utils } from '../../services/utils/utils';
7
+ import { LampSettings } from '../../../models/lampSettings';
8
+
9
+ export class ZigbeeActuator extends ZigbeeDevice {
10
+ public settings: LampSettings = new LampSettings();
11
+ protected readonly actuatorOnSwitchID: string;
12
+ protected queuedValue: boolean | null = null;
13
+ protected actuatorOn: boolean = false;
14
+ private turnOffTimeout: NodeJS.Timeout | undefined = undefined;
15
+ private turnOffTime: number = 0;
16
+
17
+ public constructor(pInfo: DeviceInfo, type: ZigbeeDeviceType, actuatorOnSwitchID: string) {
18
+ super(pInfo, type);
19
+ this.actuatorOnSwitchID = actuatorOnSwitchID;
20
+ }
21
+
22
+ public update(
23
+ idSplit: string[],
24
+ state: ioBroker.State,
25
+ initial: boolean = false,
26
+ handledByChildObject: boolean = false,
27
+ ): void {
28
+ if (!handledByChildObject) {
29
+ ServerLogService.writeLog(
30
+ LogLevel.DeepTrace,
31
+ `Aktuator Update für "${this.info.customName}": ID: ${idSplit.join('.')} JSON: ${JSON.stringify(state)}`,
32
+ );
33
+ }
34
+ this.queuedValue = null;
35
+ super.update(idSplit, state, initial, true);
36
+ switch (idSplit[3]) {
37
+ case 'state':
38
+ !handledByChildObject &&
39
+ ServerLogService.writeLog(LogLevel.Trace, `Aktor Update für ${this.info.customName} auf ${state.val}`);
40
+ this.actuatorOn = state.val as boolean;
41
+ break;
42
+ }
43
+ }
44
+
45
+ public setActuator(pValue: boolean, timeout: number = -1, force: boolean = false): void {
46
+ if (this.actuatorOnSwitchID === '') {
47
+ ServerLogService.writeLog(LogLevel.Error, `Keine Switch ID für "${this.info.customName}" bekannt.`);
48
+ return;
49
+ }
50
+
51
+ if (!force && Utils.nowMS() < this.turnOffTime) {
52
+ ServerLogService.writeLog(
53
+ LogLevel.Debug,
54
+ `Skip automatic command for "${this.info.customName}" to ${pValue} as it is locked until ${new Date(
55
+ this.turnOffTime,
56
+ ).toLocaleTimeString()}`,
57
+ );
58
+ return;
59
+ }
60
+
61
+ if (!this.ioConn) {
62
+ ServerLogService.writeLog(LogLevel.Error, `Keine Connection für "${this.info.customName}" bekannt.`);
63
+ return;
64
+ }
65
+
66
+ if (!force && pValue === this.actuatorOn && this.queuedValue === null) {
67
+ ServerLogService.writeLog(
68
+ LogLevel.Debug,
69
+ `Skip actuator command for "${this.info.customName}" as it is already ${pValue}`,
70
+ );
71
+ return;
72
+ }
73
+
74
+ ServerLogService.writeLog(LogLevel.Debug, `Stecker schalten: "${this.info.customName}" Wert: ${pValue}`);
75
+ this.ioConn.setState(this.actuatorOnSwitchID, pValue, (err) => {
76
+ if (err) {
77
+ console.log(`Stecker schalten ergab Fehler: ${err}`);
78
+ }
79
+ });
80
+ this.queuedValue = pValue;
81
+
82
+ if (this.turnOffTimeout !== undefined) {
83
+ clearTimeout(this.turnOffTimeout);
84
+ this.turnOffTimeout = undefined;
85
+ }
86
+
87
+ if (timeout < 0 || !pValue) {
88
+ return;
89
+ }
90
+
91
+ this.turnOffTime = Utils.nowMS() + timeout;
92
+ this.turnOffTimeout = Utils.guardedTimeout(
93
+ () => {
94
+ ServerLogService.writeLog(LogLevel.Debug, `Delayed Turnoff for "${this.info.customName}" initiated`);
95
+ this.turnOffTimeout = undefined;
96
+ if (!this.room) {
97
+ this.setActuator(false, -1, true);
98
+ } else {
99
+ this.room.setLightTimeBased(true);
100
+ }
101
+ },
102
+ timeout,
103
+ this,
104
+ );
105
+ }
106
+
107
+ public toggleActuator(force: boolean = false): boolean {
108
+ const newVal = this.queuedValue !== null ? !this.queuedValue : !this.actuatorOn;
109
+ const timeout: number = newVal && force ? 30 * 60 * 1000 : -1;
110
+ this.setActuator(newVal, timeout, force);
111
+ return newVal;
112
+ }
113
+ }