iobroker.luxtronik2-controller 0.7.0 → 0.7.2

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/README.md CHANGED
@@ -79,6 +79,32 @@ Bug reports, compatibility notes for specific firmware versions, or feature requ
79
79
  ## Changelog
80
80
 
81
81
  // ### **WORK IN PROGRESS**
82
+ ### 0.7.2 (2026-09-07)
83
+
84
+ **Bugfixes**
85
+
86
+ - (Fixed) Unintended Configuration Overwrites: Fixed a critical architectural flaw where the adapter blindly forced default values (e.g., hot water target temperature, heating curve) to the heat pump on every startup. The adapter is now 100% passive (read-only) upon installation until features are explicitly enabled.
87
+
88
+ - (Fixed) Strict Opt-In Logic: All internal condition checks for background automations (cycle optimization, ZIP optimization, idle resets) were refactored to strict opt-in logic (=== true), preventing unintended actions when settings have never been saved.
89
+
90
+ - (Fixed) Live Toggle for Cycle Optimization: Fixed an issue where the ioBroker switch Actions.Regelung_Aktiv was ignored during runtime. The optimization loop now evaluates this switch dynamically, allowing users to toggle the feature live via their dashboard.
91
+
92
+ - (Fixed) Hardware ZIP Timer Disable: Fixed a bug where a mismatched configuration key (zip_hardware_timer_disable instead of zip_lWP_aktiv) prevented the adapter from correctly disabling the hardware circulation pump timer for flash memory protection.
93
+
94
+ - (Fixed) "Heating after hot water" Reset: Restored missing logic that properly resets the "Heating after water" status back to false at the end of a cycle, preventing the system from getting stuck in this mode.
95
+
96
+ **Features & Change**
97
+
98
+ - (Changed) Forced DHW Safety Limit: Reduced the internal safety limit for temporary hot water target adjustments during forced DHW runs from 75°C to 70°C to better protect the system's high-pressure switch.
99
+
100
+ ### 0.7.1 (2026-09-07)
101
+
102
+ **Bugfixes**
103
+
104
+ - (Fixed) Status Display: Fixed a logical evaluation bug where the operating state "Heating" (Code 0) was incorrectly overwritten and displayed as "No demand" (Code 5). Thanks to @michiproep for reporting!
105
+
106
+ - (Fixed) Temperature Values: Fixed a related issue where temperature readings of exactly 0 °C (e.g., average temperature, return target temperature, cooling release) were incorrectly replaced by internal fallback values (e.g., 1.5 °C).
107
+
82
108
  ### 0.7.0 (2026-09-04)
83
109
 
84
110
  **Features & Changes**
@@ -103,48 +129,6 @@ Bug reports, compatibility notes for specific firmware versions, or feature requ
103
129
 
104
130
  - review / fix findings reported by claude based checker.
105
131
 
106
- ### 0.6.4 (2026-07-23)
107
-
108
- - Refactoring
109
-
110
- ### 0.6.3 (2026-07-23)
111
-
112
- **Features & Enhancements**
113
-
114
- - **External Actor Support for ZIP (100% Flash Safe):** Added the ultimate hardware protection feature. Users can now configure a list of external actors (e.g., Shelly or Zigbee relays) via their object IDs in the Admin UI. When motion is detected, the adapter switches these relays directly, completely bypassing the heat pump and reducing Luxtronik EEPROM write cycles to absolute zero.
115
- - **External Actor Schedule Compliance:** External ZIP actors now dynamically respect the Luxtronik ZIP time tables (Week, 5+2, or Individual days). Motion triggers will be cleanly ignored if they occur outside the permitted time windows, unless the user explicitly checks the "Disable Hardware ZIP Timers" option in the configuration.
116
- - **Hot Water Sync for External Actors:** The adapter now automatically activates external circulation pump relays when the heat pump begins a hot water generation cycle, maximizing comfort at the tap with zero impact on flash memory wear.
117
- - **Global EEPROM Flash Protection (Read-Before-Write):** Implemented a global interceptor for all hardware write commands (`writePumpSafe`). The adapter now caches the current heat pump parameters in real-time and strictly blocks any duplicate or redundant write requests before they are sent over the network.
118
- - **Automated Hardware-Safe ZIP Defaults:** The adapter can now automatically enforce hardware-safe circulation pump schedules upon startup. Accounts for Luxtronik firmware behavior by intelligently setting the first start block to `00:01:00` (60 seconds) to prevent invalid zero-run rejections, while keeping ON-time at `0 min` and OFF-time at `60 min`.
119
- - **Admin UI - Flash Wear Statistics & Guidance:** Expanded the ZIP configuration page with detailed educational information. Added hard data explaining that internal ZIP control causes between 4 and 14 physical write operations per activation, highly recommending the new external actor setup.
120
- - **Write Cycle Monitoring:** Introduced two new virtual data points under System Info (`write_cycles_today` and `write_cycles_total`) to transparently track physical write operations sent to the heat pump. The daily counter automatically resets every night at midnight.
121
- - **Cooling Extension & Intelligent Status:** Comprehensive integration of new cooling data points (e.g., `cooling_status`, `cooling_configured`, `opStateCooling`). Added the dynamically calculated `opStateCoolingString`.
122
- - **Admin UI - Notification Testing:** Added a dedicated "Send Test Message" button to the configuration interface to easily verify Telegram and ioBroker Notification Center setups directly from the UI.
123
- - **Hardened ZIP Macro Execution:** Reaffirmed and secured the ZIP demand-driven macro to exclusively use the deaeration program (Entlüftungsprogramm).
124
- - **New Flow Rate Datapoints:** Added flow rate tracking for the heat source (`flow_rate_heat_source`, ID 173) and cooling (`flow_rate_cooling`, ID 254) to the state mapping.
125
- - **Extended Admin UI:** All newly added cooling data points and the heat source flow rate can now be individually enabled or disabled via new checkboxes in the adapter configuration (`jsonConfig.json`).
126
- - **New Hardware Supported:** Officially added the MSW2-9S heat pump to the model recognition (`HP_TYPES`).
127
-
128
- **Bugfixes**
129
-
130
- - **Motion Sensor Cooldown Logic:** Fixed an issue where the 10-minute anti-cycling cooldown for motion sensors was perpetually stuck when using external relays. The logic now correctly monitors the virtual `Activate_Zip` state's timestamp instead of the bypassed internal `ZIPout` state.
131
- - **Virtual State Reset:** Fixed a bug where the `Activate_Zip` button/state remained `true` after an external relay timer expired, which broke subsequent cooldown calculations. It now cleanly resets to `false` when the run cycle finishes.
132
- - **External Actor State Detection:** Fixed a logic flaw where the adapter incorrectly checked the internal heat pump state (`ZIPout`) instead of the external relay state to determine if the circulation pump was already running. It now dynamically checks `getForeignStateAsync` for configured actors, cleanly preventing redundant switch commands and allowing silent timer extensions if motion is re-detected.
133
- - **Timer Formatting in Objects:** Fixed a bug where timer schedules (Heating, Hot Water, Circulation) were incorrectly displayed as raw seconds (e.g., `60` or `0`). Applied the internal duration formatter (`isDurationFormat: true`) globally so all time tables natively and persistently display as `HH:MM:SS` (e.g., `00:01:00`) in the ioBroker object tree.
134
- - **Admin UI i18n Compliance:** Fixed missing language definitions (E5611) in the `jsonConfig.json` dropdown menus to strictly comply with the latest ioBroker repository checks.
135
- - **TypeScript/Linter Strictness:** Fixed strictly typed linter errors (e.g., `@typescript-eslint/no-floating-promises`, `no-redundant-type-constituents`, and template literal typings) by correctly handling asynchronous database calls, replacing `any` with `unknown`, and strictly casting types.
136
- - **Missing Imports:** Resolved compilation errors regarding missing helper functions (e.g., `getDpPath`) during module refactoring.
137
- - **Cooling Operating Hours:** Fixed the `hours_cooling` datapoint. The value is now correctly read from real-time telemetry data (`raw_value`), resolving an issue where the timestamp "Jan 1, 1970" was incorrectly shown.
138
- - **Config Cleanup:** Fixed an incorrect identifier in the admin UI (changed `sync_Gerätezeit` to `sync_deviceTime`) and removed unused/dead checkboxes.
139
-
140
- **Technical Changes (Under the Hood)**
141
-
142
- - **Separation of Concerns (zipManager):** Completely refactored the motion sensor and circulation pump logic. Extracted the event handling and startup initialization out of `main.ts` into `zipManager.ts`. It now also dynamically handles iterations over arrays of external actors.
143
- - **Network Queue Isolation:** Extracted the core transmission queue (`queueWrite`, `processQueue`) from the main adapter class into `rawFunctions.ts`, achieving 100% isolation of TCP/WebSocket network logic from ioBroker state management.
144
- - **Comprehensive Code Refactoring (DRY):** Created dedicated `convert.ts` and `utils.ts` modules to centralize time string formatting (`timeStringToSeconds`, `formatTimerSecondsToTime`) and generic helper functions (`getNumber`, `delay`).
145
- - **Global Time Refactoring:** Centralized the duration and time calculation for status texts in the `updateStatusStrings` function.
146
- - **i18n Support for State Names:** Updated the internal state definition (`name: string | { en: string; de?: string }`) to fully support translation objects, allowing natively translated datapoint names in the ioBroker object tree.
147
-
148
132
  ## License
149
133
 
150
134
  MIT License
package/build/main.js CHANGED
@@ -107,17 +107,10 @@ class Luxtronik2Controller extends utils.Adapter {
107
107
  await (0, import_objectManager.cleanupEmptyFolders)(this);
108
108
  await (0, import_objectManager.ensureAllObjectsExist)(this);
109
109
  await (0, import_objectManager.ensureCustomObjectsExist)(this);
110
- await this.setState((0, import_stateMapping.getDpPath)("Regelung_Aktiv"), { val: config.regelung_aktiv !== false, ack: true });
110
+ await this.setState((0, import_stateMapping.getDpPath)("Regelung_Aktiv"), { val: config.regelung_aktiv === true, ack: true });
111
111
  const debugState = await this.getStateAsync((0, import_stateMapping.getDpPath)("Schreibe_Debug_Log"));
112
112
  this.isDebugLogActive = (debugState == null ? void 0 : debugState.val) === true;
113
113
  (0, import_logger.setCustomDebug)(this.isDebugLogActive);
114
- if (this.isDebugLogActive) {
115
- (0, import_logger.writeLog)("Synchronizing configuration values with the heat pump...", "info");
116
- }
117
- await this.setIdleDefaults();
118
- if (this.isDebugLogActive) {
119
- (0, import_logger.writeLog)("Synchronizing configuration values with the heat pump...", "info");
120
- }
121
114
  await (0, import_zipManager.disableHardwareZipTimer)(this);
122
115
  const cycleTodayState = await this.getStateAsync((0, import_stateMapping.getDpPath)("write_cycles_today"));
123
116
  this.writeCyclesToday = cycleTodayState && typeof cycleTodayState.val === "number" ? cycleTodayState.val : 0;
@@ -291,6 +284,8 @@ class Luxtronik2Controller extends utils.Adapter {
291
284
  const config = this.config;
292
285
  const bzState = await this.getStateAsync((0, import_stateMapping.getDpPath)("WP_BZ_akt"));
293
286
  const bzVal = bzState && bzState.val !== null ? String(bzState.val).trim() : "";
287
+ const regelungAktivState = await this.getStateAsync((0, import_stateMapping.getDpPath)("Regelung_Aktiv"));
288
+ const isRegelungAktiv = (regelungAktivState == null ? void 0 : regelungAktivState.val) === true;
294
289
  const istHeizen = bzVal === "0";
295
290
  const istWarmwasser = bzVal === "1";
296
291
  const istAbtauen = bzVal === "4";
@@ -300,11 +295,11 @@ class Luxtronik2Controller extends utils.Adapter {
300
295
  }
301
296
  if (bzVal !== this.lastBzVal) {
302
297
  if (istLeerlauf) {
303
- if (config.idle_defaults_aktiv !== false) {
298
+ if (config.idle_defaults_aktiv === true) {
304
299
  await this.setIdleDefaults();
305
300
  }
306
301
  } else if (istHeizen) {
307
- if (config.zip_optimierung_aktiv !== false) {
302
+ if (config.zip_optimierung_aktiv === true) {
308
303
  await this.syncConfigValue("zip_aktiv", (_a = config.zip_aktiv) != null ? _a : 0);
309
304
  await this.syncConfigValue(
310
305
  "heating_system_circ_pump_voltage_minimal",
@@ -315,11 +310,11 @@ class Luxtronik2Controller extends utils.Adapter {
315
310
  (_c = config.sync_heating_system_circ_pump_voltage_nominal_heating) != null ? _c : 7
316
311
  );
317
312
  }
318
- if (config.regelung_aktiv !== false) {
313
+ if (isRegelungAktiv) {
319
314
  await this.syncConfigValue("Heizen_nach_Wasser", (_d = config.Heating_after_warmwater) != null ? _d : false);
320
315
  }
321
316
  } else if (istWarmwasser) {
322
- if (config.zip_optimierung_aktiv !== false) {
317
+ if (config.zip_optimierung_aktiv === true) {
323
318
  const actors = config.actors || [];
324
319
  const validActors = actors.filter(
325
320
  (a) => a.zip_external_relay_id && a.zip_external_relay_id.trim() !== ""
@@ -342,7 +337,6 @@ class Luxtronik2Controller extends utils.Adapter {
342
337
  (_g = config.sync_heating_system_circ_pump_voltage_nominal_water) != null ? _g : 10
343
338
  );
344
339
  }
345
- } else if (istAbtauen) {
346
340
  }
347
341
  this.lastBzVal = bzVal;
348
342
  }
@@ -394,14 +388,14 @@ class Luxtronik2Controller extends utils.Adapter {
394
388
  const heatingLimit = (_r = heatingLimitState == null ? void 0 : heatingLimitState.val) != null ? _r : 0;
395
389
  const nachWasser = nachWasserState == null ? void 0 : nachWasserState.val;
396
390
  if (istHeizen) {
397
- if (config.regelung_aktiv !== false && aelterAls10 && vd1) {
391
+ if (isRegelungAktiv && aelterAls10 && vd1) {
398
392
  const fusspunkt = (_s = await this.getStateAsync((0, import_stateMapping.getDpPath)("heating_curve_parallel_offset"))) == null ? void 0 : _s.val;
399
393
  if (fusspunkt === 35) {
400
394
  const fallbackFusspunkt = (_t = config.fusspunkt) != null ? _t : 21.7;
401
395
  await this.syncConfigValue("heating_curve_parallel_offset", fallbackFusspunkt);
402
396
  }
403
397
  }
404
- if (config.zip_optimierung_aktiv !== false) {
398
+ if (config.zip_optimierung_aktiv === true) {
405
399
  const now = Date.now();
406
400
  if (now - this.lastPumpOptimization > 6e5) {
407
401
  if (spreizung < 6.5 && hupAktiv > 5.5) {
@@ -421,11 +415,18 @@ class Luxtronik2Controller extends utils.Adapter {
421
415
  }
422
416
  }
423
417
  }
424
- if (config.regelung_aktiv !== false) {
418
+ if (isRegelungAktiv) {
419
+ if (ruecklauf >= ruecklaufSoll + heizenHysterese - 0.1) {
420
+ if (aelterAls10) {
421
+ await this.syncConfigValue("Heizen_nach_Wasser", false);
422
+ }
423
+ } else if (!nachWasser && config.Heating_after_warmwater === true) {
424
+ await this.syncConfigValue("Heizen_nach_Wasser", true);
425
+ }
425
426
  if (wwSoll - wwIst > 2 && ruecklauf >= ruecklaufSoll + heizenHysterese - 0.1) {
426
427
  let forceSoll = wwIst + wwHysterese + 1.5;
427
- if (forceSoll > 75) {
428
- forceSoll = 75;
428
+ if (forceSoll > 70) {
429
+ forceSoll = 70;
429
430
  }
430
431
  forceSoll = Math.round(forceSoll * 10) / 10;
431
432
  await this.syncConfigValue("warmwater_temperature", forceSoll);
@@ -433,19 +434,19 @@ class Luxtronik2Controller extends utils.Adapter {
433
434
  }
434
435
  }
435
436
  if (istWarmwasser && nachWasser) {
436
- if (config.regelung_aktiv !== false) {
437
+ if (isRegelungAktiv) {
437
438
  if (heatingLimit === 1 && mitteltemperatur < thresholdHeatingLimit || heatingLimit === 0) {
438
439
  await this.syncConfigValue("heating_curve_parallel_offset", 35);
439
440
  }
440
441
  }
441
442
  }
442
443
  if (istLeerlauf) {
443
- if (config.zip_optimierung_aktiv !== false) {
444
+ if (config.zip_optimierung_aktiv === true) {
444
445
  if (wwIst <= wwSoll - wwHysterese || ruecklauf <= ruecklaufSoll - heizenHysterese) {
445
446
  await (0, import_zipManager.stopZipAndDeaeration)(this);
446
447
  }
447
448
  }
448
- if (config.regelung_aktiv !== false) {
449
+ if (isRegelungAktiv) {
449
450
  if (wwSoll - wwIst >= wwHysterese - 1.5 && ruecklauf <= ruecklaufSoll && heatingStateStr !== "Heating limit") {
450
451
  await this.syncConfigValue("heating_curve_parallel_offset", 35);
451
452
  }
package/build/main.js.map CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../src/main.ts"],
4
- "sourcesContent": ["/*\n * Created with @iobroker/create-adapter v3.1.5\n */\nimport * as utils from '@iobroker/adapter-core';\nimport { handleZwangsheizen, handleZwangswarmwasser } from './actionHandlers';\nimport { formatTimerSecondsToTime } from './convert';\nimport { initLogger, setCustomDebug, writeLog } from './logger';\nimport { checkAndSendErrorNotifications, handleTestMessage, sendTelegramNotification } from './notificationManager';\nimport {\n\tcleanupCustomStates,\n\tcleanupEmptyFolders,\n\tcleanupStates,\n\tensureAllObjectsExist,\n\tensureCustomObjectsExist,\n\tisStateEnabled,\n} from './objectManager';\nimport { dumpAllRawToLog, queueWrite, readAllRaw } from './rawFunctions';\nimport { STATE_MAPPING, getDpPath } from './stateMapping';\nimport {\n\tcalculateTemperatureSpread,\n\tcalculateTotalEnergy,\n\tcalculateTotalThermalEnergy,\n\tupdateCustomStates,\n\tupdateErrorHistory,\n\tupdateOutageHistory,\n\tupdateStatusStrings,\n\tupdateSystemInfos,\n\tupdateTimerTables,\n} from './virtualStates';\nimport {\n\tcheckAndHandleMotionSensor,\n\tdisableHardwareZipTimer,\n\thandleActivateZip,\n\tstopZipAndDeaeration,\n\tsubscribeMotionSensors,\n} from './zipManager';\n/**\n * Main class for the Luxtronik2 Controller ioBroker Adapter.\n */\nclass Luxtronik2Controller extends utils.Adapter {\n\t/** Set of all active namespaced state IDs created or managed by the adapter */\n\tpublic createdStates: Set<string> = new Set<string>();\n\t/** ioBroker timeout handle for the hot water circulation pump macro */\n\tpublic zipTimer?: ioBroker.Timeout;\n\t/** Cached copy of the original circulation pump settings before macro activation */\n\tpublic originalZipConfig: Record<string, any> | null = null;\n\t/** Unix timestamp of the last error dispatched to prevent duplicate notification triggers */\n\tpublic lastKnownErrorTimestamp: number | null = null;\n\t/** Determines whether verbose debugging output is enabled */\n\tpublic isDebugLogActive: boolean = false;\n\t// Cache f\u00FCr den globalen Schreibschutz\n\tpublic currentRawParams: number[] = [];\n\t/** ioBroker interval handle for the main data polling loop */\n\tprivate pollingInterval: ioBroker.Interval | undefined;\n\t/** Cache for the last evaluated heat pump operating state code */\n\tprivate lastBzVal: string = '';\n\t/** Lock flag preventing concurrent execution of the polling updates */\n\tprivate updateRunning: boolean = false;\n\t/** Timestamp tracking the last dynamic pump voltage optimization execution */\n\tprivate lastPumpOptimization: number = 0;\n\n\t/** Internal array storing pending serial hardware write tasks */\n\tpublic writeQueue: (() => Promise<void>)[] = [];\n\t/** Lock flag indicating that the write queue is currently being processed */\n\tpublic isWriting: boolean = false;\n\t/** Counter tracking sequential communication timeouts/failures */\n\tprivate errorCount: number = 0;\n\t/** Maximum allowed sequential request failures before connection is flagged as interrupted */\n\tprivate readonly MAX_ERRORS: number = 3;\n\tpublic writeCyclesToday: number = 0;\n\tpublic writeCyclesTotal: number = 0;\n\tprivate midnightTimer?: ioBroker.Timeout;\n\t/**\n\t * Initializes a new instance of the Luxtronik2Controller class.\n\t *\n\t * @param options - Optional core configuration overrides passed by the ioBroker host.\n\t */\n\tpublic constructor(options: Partial<utils.AdapterOptions> = {}) {\n\t\tsuper({\n\t\t\t...options,\n\t\t\tname: 'luxtronik2-controller',\n\t\t});\n\t\tinitLogger(this);\n\n\t\tthis.on('ready', this.onReady.bind(this));\n\t\tthis.on('stateChange', this.onStateChange.bind(this));\n\t\tthis.on('unload', this.onUnload.bind(this));\n\t\tthis.on('message', this.onMessage.bind(this));\n\t}\n\n\t/**\n\t * Processes incoming inter-adapter messages or commands dispatched from the Admin UI.\n\t *\n\t * @param obj - The standardized ioBroker message structure containing parameters and optional callbacks.\n\t * @returns A promise that resolves once the message has been processed.\n\t */\n\tprivate async onMessage(obj: ioBroker.Message): Promise<void> {\n\t\tif (obj.command === 'testTelegram') {\n\t\t\tawait handleTestMessage(this, obj);\n\t\t}\n\t}\n\n\t/**\n\t * Callback executed once the ioBroker host framework completely initializes the adapter subsystem.\n\t * Sets up database objects, applies configurations, subscribes to states, and triggers the polling loop.\n\t *\n\t * @returns A promise that resolves when initialization completes.\n\t */\n\tprivate async onReady(): Promise<void> {\n\t\tconst config = this.config as Record<string, any>;\n\t\tconst ip = config.host;\n\t\tconst port = config.port || 8889;\n\n\t\tawait this.setState('info.connection', { val: false, ack: true });\n\t\twriteLog(`Connecting to heat pump at ${ip}:${port}...`, 'info');\n\n\t\tawait cleanupStates(this);\n\t\tawait cleanupCustomStates(this);\n\t\tawait cleanupEmptyFolders(this);\n\t\tawait ensureAllObjectsExist(this);\n\t\tawait ensureCustomObjectsExist(this);\n\n\t\tawait this.setState(getDpPath('Regelung_Aktiv'), { val: config.regelung_aktiv !== false, ack: true });\n\n\t\tconst debugState = await this.getStateAsync(getDpPath('Schreibe_Debug_Log'));\n\t\tthis.isDebugLogActive = debugState?.val === true;\n\t\tsetCustomDebug(this.isDebugLogActive);\n\n\t\tif (this.isDebugLogActive) {\n\t\t\twriteLog('Synchronizing configuration values with the heat pump...', 'info');\n\t\t}\n\t\tawait this.setIdleDefaults();\n\t\tif (this.isDebugLogActive) {\n\t\t\twriteLog('Synchronizing configuration values with the heat pump...', 'info');\n\t\t}\n\t\tawait disableHardwareZipTimer(this);\n\t\t// Schreib-Z\u00E4hler aus ioBroker laden (sichert den Stand bei einem Adapter-Neustart)\n\t\tconst cycleTodayState = await this.getStateAsync(getDpPath('write_cycles_today'));\n\t\tthis.writeCyclesToday = cycleTodayState && typeof cycleTodayState.val === 'number' ? cycleTodayState.val : 0;\n\n\t\tconst cycleTotalState = await this.getStateAsync(getDpPath('write_cycles_total'));\n\t\tthis.writeCyclesTotal = cycleTotalState && typeof cycleTotalState.val === 'number' ? cycleTotalState.val : 0;\n\n\t\tthis.scheduleMidnightReset(); // Startet den 00:00 Uhr Timer (nur f\u00FCr den Tagesz\u00E4hler!)\n\t\tsubscribeMotionSensors(this);\n\n\t\tthis.subscribeStates('*');\n\n\t\ttry {\n\t\t\tawait this.updateData();\n\t\t} catch (error: any) {\n\t\t\tthis.log.error(`Initial data retrieval failed (device offline?): ${error.message}`);\n\t\t}\n\n\t\tlet intervalSeconds = this.config.interval ? Number(this.config.interval) : 45;\n\t\tif (intervalSeconds < 10) {\n\t\t\tintervalSeconds = 10;\n\t\t\twriteLog(\n\t\t\t\t'Configured polling interval was too short. Forced to minimum threshold of 10 seconds for protection.',\n\t\t\t\t'warn',\n\t\t\t);\n\t\t}\n\t\tif (intervalSeconds > 3600) {\n\t\t\tintervalSeconds = 3600;\n\t\t\twriteLog(\n\t\t\t\t'Configured polling interval exceeded maximum boundary. Restricted to 3600 seconds to prevent overflow issues.',\n\t\t\t\t'warn',\n\t\t\t);\n\t\t}\n\n\t\tthis.pollingInterval = this.setInterval(async () => {\n\t\t\ttry {\n\t\t\t\tawait this.updateData();\n\t\t\t} catch (error: any) {\n\t\t\t\tthis.log.error(`Error during cyclic data retrieval loop: ${error.message}`);\n\t\t\t}\n\t\t}, intervalSeconds * 1000);\n\n\t\tawait this.setState('info.connection', true, true);\n\t}\n\n\t/**\n\t * Berechnet die Zeit bis Mitternacht und setzt NUR den heutigen Schreibz\u00E4hler auf 0 zur\u00FCck.\n\t */\n\tprivate scheduleMidnightReset(): void {\n\t\tconst now = new Date();\n\t\tconst night = new Date(now.getFullYear(), now.getMonth(), now.getDate() + 1, 0, 0, 0);\n\t\tconst msToMidnight = night.getTime() - now.getTime();\n\n\t\tthis.midnightTimer = this.setTimeout(() => {\n\t\t\tthis.writeCyclesToday = 0;\n\t\t\tvoid this.setState(getDpPath('write_cycles_today'), { val: 0, ack: true });\n\n\t\t\t// Timer f\u00FCr den n\u00E4chsten Tag neu aufziehen\n\t\t\tthis.scheduleMidnightReset();\n\t\t}, msToMidnight);\n\t}\n\n\t/**\n\t * Synchronizes a single state configuration parameter with the Luxtronik physical controller.\n\t *\n\t * @param mappingKey - The unique key identifier within the STATE_MAPPING structure.\n\t * @param val - The raw or parsed value to apply.\n\t * @returns A promise that resolves when the synchronization task finishes.\n\t */\n\tpublic async syncConfigValue(mappingKey: keyof typeof STATE_MAPPING, val: any): Promise<void> {\n\t\tif (val === undefined || val === null) {\n\t\t\treturn;\n\t\t}\n\t\tconst id = getDpPath(mappingKey);\n\t\tconst state = await this.getStateAsync(id);\n\n\t\tif (!state || state.val !== val) {\n\t\t\tconst definition = STATE_MAPPING[mappingKey];\n\t\t\tif (!definition) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tawait this.setState(id, { val: val, ack: true });\n\n\t\t\tif (this.isDebugLogActive) {\n\t\t\t\twriteLog(`Writing value directly into heat pump controller: ${mappingKey} = ${val}`, 'info');\n\t\t\t}\n\n\t\t\tif (definition.write === true && !definition.isVirtual && definition.luxWriteId) {\n\t\t\t\tlet valueToWrite: any = val;\n\t\t\t\tif (definition.factor && typeof val === 'number') {\n\t\t\t\t\tvalueToWrite = val * definition.factor;\n\t\t\t\t}\n\n\t\t\t\tconst isRawWrite =\n\t\t\t\t\tdefinition.dataSource === 'raw_parameter' ||\n\t\t\t\t\tdefinition.dataSource === 'raw_value' ||\n\t\t\t\t\t(!definition.dataSource && /^\\d+$/.test(definition.luxWriteId || ''));\n\t\t\t\tif (isRawWrite && definition.unit === '\u00B0C' && typeof val === 'number' && !definition.factor) {\n\t\t\t\t\tvalueToWrite = val * 10;\n\t\t\t\t}\n\n\t\t\t\ttry {\n\t\t\t\t\tconst targetWriteId = definition.luxWriteId;\n\t\t\t\t\tconst writeId = isRawWrite ? parseInt(targetWriteId, 10) : targetWriteId;\n\t\t\t\t\tawait queueWrite(this, writeId, valueToWrite);\n\t\t\t\t\tawait new Promise(r => global.setTimeout(r, 200));\n\t\t\t\t} catch (err: any) {\n\t\t\t\t\twriteLog(\n\t\t\t\t\t\t`Failed to transmit ${mappingKey} to the heat pump hardware interface: ${err.message}`,\n\t\t\t\t\t\t'error',\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\t/**\n\t * Safely updates an internal database state value only if the newly supplied value differs from the existing entry.\n\t *\n\t * @param id - The relative state path ID.\n\t * @param val - The updated value to process.\n\t * @param ack - Explicit acknowledgment flag status to set.\n\t * @returns A promise that resolves when the verification and write operation completes.\n\t */\n\tpublic async setOwnStateIfDifferent(id: string, val: any, ack = false): Promise<void> {\n\t\ttry {\n\t\t\tif (val === undefined) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tconst state = await this.getStateAsync(id);\n\t\t\tif (!state || state.val !== val) {\n\t\t\t\tawait this.setState(id, { val: val, ack: ack });\n\t\t\t\tif (this.isDebugLogActive) {\n\t\t\t\t\twriteLog(`Applying specific update for local state ${id}: ${val}`, 'debug');\n\t\t\t\t}\n\t\t\t}\n\t\t} catch (err: any) {\n\t\t\twriteLog(`Error occurred during setOwnStateIfDifferent operation for state ${id}: ${err.message}`, 'error');\n\t\t}\n\t}\n\n\t/**\n\t * Configures fallback factory parameter baselines for the heat pump when in an idle state.\n\t *\n\t * @returns A promise that resolves when all default configuration tasks resolve.\n\t */\n\tprivate async setIdleDefaults(): Promise<void> {\n\t\ttry {\n\t\t\tconst config = this.config as Record<string, any>;\n\t\t\tawait this.syncConfigValue('heating_curve_end_point', config.endpunkt ?? 23);\n\t\t\tawait this.syncConfigValue('heating_curve_parallel_offset', config.fusspunkt ?? 21.7);\n\t\t\tawait this.syncConfigValue(\n\t\t\t\t'heating_system_circ_pump_voltage_minimal',\n\t\t\t\tconfig.sync_heating_system_circ_pump_voltage_minimal_heating ?? 3,\n\t\t\t);\n\t\t\tawait this.syncConfigValue(\n\t\t\t\t'heating_system_circ_pump_voltage_nominal',\n\t\t\t\tconfig.sync_heating_system_circ_pump_voltage_nominal_heating ?? 7,\n\t\t\t);\n\t\t\tawait this.syncConfigValue('warmwater_temperature', config.sync_warmwater_target_temperature ?? 54);\n\t\t\t// await this.syncConfigValue(\n\t\t\t// \t'hotWaterTemperatureHysteresis',\n\t\t\t// \tconfig.sync_hotwater_temperature_hysteresis ?? 10,\n\t\t\t// );\n\t\t\tawait this.syncConfigValue('returnTemperatureHysteresis', config.sync_return_temperature_hysteresis ?? 1.5);\n\t\t\tawait this.syncConfigValue('zip_aktiv', config.zip_aktiv ?? 0);\n\t\t\tawait this.syncConfigValue('Heizen_nach_Wasser', config.Heating_after_warmwater ?? false);\n\t\t} catch (err: any) {\n\t\t\twriteLog(`Failed to apply the baseline idle configuration defaults: ${err.message}`, 'error');\n\t\t}\n\t}\n\n\t/**\n\t * Evaluates whether the current active operating state timestamp is older than ten minutes.\n\t *\n\t * @returns A promise that resolves to true if the state has remained unaltered for at least 10 minutes.\n\t */\n\tprivate async istBetriebszustandAelterAls10Min(): Promise<boolean> {\n\t\ttry {\n\t\t\tconst state = await this.getStateAsync(getDpPath('WP_BZ_akt'));\n\t\t\tconst lastChange = state?.lc ?? 0;\n\t\t\treturn (Date.now() - lastChange) / 60000 >= 10;\n\t\t} catch {\n\t\t\treturn false;\n\t\t}\n\t}\n\n\t/**\n\t * Primary intelligent engine analyzing live telemetry values to execute continuous performance optimizations.\n\t * Manages dynamic heating curves, anti-cycling protective delays, and voltage scaling algorithms.\n\t *\n\t * @returns A promise that resolves when the execution cycle finishes.\n\t */\n\tprivate async runOptimizationSchedule(): Promise<void> {\n\t\ttry {\n\t\t\tconst config = this.config as Record<string, any>;\n\t\t\tconst bzState = await this.getStateAsync(getDpPath('WP_BZ_akt'));\n\t\t\tconst bzVal = bzState && bzState.val !== null ? String(bzState.val).trim() : '';\n\n\t\t\tconst istHeizen = bzVal === '0';\n\t\t\tconst istWarmwasser = bzVal === '1';\n\t\t\tconst istAbtauen = bzVal === '4';\n\t\t\tconst istLeerlauf = bzVal === '5';\n\n\t\t\tif (!istHeizen && !istWarmwasser && !istLeerlauf && !istAbtauen) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\t// =========================================================\n\t\t\t// 1. DYNAMIC PARAMETER ADJUSTMENT UPON STATE SWITCH\n\t\t\t// =========================================================\n\t\t\tif (bzVal !== this.lastBzVal) {\n\t\t\t\tif (istLeerlauf) {\n\t\t\t\t\tif (config.idle_defaults_aktiv !== false) {\n\t\t\t\t\t\tawait this.setIdleDefaults();\n\t\t\t\t\t}\n\t\t\t\t} else if (istHeizen) {\n\t\t\t\t\tif (config.zip_optimierung_aktiv !== false) {\n\t\t\t\t\t\tawait this.syncConfigValue('zip_aktiv', config.zip_aktiv ?? 0);\n\t\t\t\t\t\tawait this.syncConfigValue(\n\t\t\t\t\t\t\t'heating_system_circ_pump_voltage_minimal',\n\t\t\t\t\t\t\tconfig.sync_heating_system_circ_pump_voltage_minimal_heating ?? 3,\n\t\t\t\t\t\t);\n\t\t\t\t\t\tawait this.syncConfigValue(\n\t\t\t\t\t\t\t'heating_system_circ_pump_voltage_nominal',\n\t\t\t\t\t\t\tconfig.sync_heating_system_circ_pump_voltage_nominal_heating ?? 7,\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\t\t\t\t\tif (config.regelung_aktiv !== false) {\n\t\t\t\t\t\tawait this.syncConfigValue('Heizen_nach_Wasser', config.Heating_after_warmwater ?? false);\n\t\t\t\t\t}\n\t\t\t\t} else if (istWarmwasser) {\n\t\t\t\t\tif (config.zip_optimierung_aktiv !== false) {\n\t\t\t\t\t\t// await this.syncConfigValue(\n\t\t\t\t\t\t// \t'hotWaterTemperatureHysteresis',\n\t\t\t\t\t\t// \tconfig.sync_hotwater_temperature_hysteresis ?? 2,\n\t\t\t\t\t\t// );\n\n\t\t\t\t\t\t// Pr\u00FCfen, ob externe Aktoren konfiguriert sind\n\t\t\t\t\t\tconst actors = config.actors || [];\n\t\t\t\t\t\tconst validActors = actors.filter(\n\t\t\t\t\t\t\t(a: any) => a.zip_external_relay_id && a.zip_external_relay_id.trim() !== '',\n\t\t\t\t\t\t);\n\n\t\t\t\t\t\t// Wenn Aktoren da sind, k\u00F6nnen wir die Zirkulation bedenkenlos starten (0 Flash-Schreibvorg\u00E4nge!)\n\t\t\t\t\t\tif (validActors.length > 0) {\n\t\t\t\t\t\t\tif (this.isDebugLogActive) {\n\t\t\t\t\t\t\t\tthis.log.debug(\n\t\t\t\t\t\t\t\t\t'[ZIP] Externe Aktoren gefunden. Starte Zirkulation synchron zur Warmwasserbereitung.',\n\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t// Dauer aus der Config holen (mit einem sinnvollen Fallback von z.B. 120 Sekunden)\n\t\t\t\t\t\t\tawait this.syncConfigValue('zip_aktiv', config.zip_aktiv_ww ?? 120);\n\t\t\t\t\t\t\t// Makro \u00FCber den Trigger-Datenpunkt ausl\u00F6sen\n\t\t\t\t\t\t\tawait this.setOwnStateIfDifferent(getDpPath('Activate_Zip'), true, false);\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tawait this.syncConfigValue(\n\t\t\t\t\t\t\t'heating_system_circ_pump_voltage_minimal',\n\t\t\t\t\t\t\tconfig.sync_heating_system_circ_pump_voltage_minimal_water ?? 3,\n\t\t\t\t\t\t);\n\t\t\t\t\t\tawait this.syncConfigValue(\n\t\t\t\t\t\t\t'heating_system_circ_pump_voltage_nominal',\n\t\t\t\t\t\t\tconfig.sync_heating_system_circ_pump_voltage_nominal_water ?? 10,\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\t\t\t\t} else if (istAbtauen) {\n\t\t\t\t\t// if (config.zip_optimierung_aktiv !== false) {\n\t\t\t\t\t// \tawait this.syncConfigValue('heating_system_circ_pump_voltage_nominal', 10);\n\t\t\t\t\t// }\n\t\t\t\t}\n\t\t\t\tthis.lastBzVal = bzVal;\n\t\t\t}\n\n\t\t\tconst [\n\t\t\t\twwSollState,\n\t\t\t\twwIstState,\n\t\t\t\truecklaufState,\n\t\t\t\tspreizungState,\n\t\t\t\theatingStateStrState,\n\t\t\t\tvd1State,\n\t\t\t\twwHystereseState,\n\t\t\t\truecklaufSollState,\n\t\t\t\thupAktivState,\n\t\t\t\theizenHystereseState,\n\t\t\t\tnachWasserState,\n\t\t\t\tmitteltempState,\n\t\t\t\tthresholdHeatingLimitstate,\n\t\t\t\theatingLimitState,\n\t\t\t\taelterAls10,\n\t\t\t] = await Promise.all([\n\t\t\t\tthis.getStateAsync(getDpPath('Wamwassertemperatur_Soll')),\n\t\t\t\tthis.getStateAsync(getDpPath('Wamwassertemperatur_Ist')),\n\t\t\t\tthis.getStateAsync(getDpPath('temperature_return')),\n\t\t\t\tthis.getStateAsync(getDpPath('spreizung_vorlauf_ruecklauf')),\n\t\t\t\tthis.getStateAsync(getDpPath('opStateHeatingString')),\n\t\t\t\tthis.getStateAsync(getDpPath('VD1out')),\n\t\t\t\tthis.getStateAsync(getDpPath('hotWaterTemperatureHysteresis')),\n\t\t\t\tthis.getStateAsync(getDpPath('temperature_target_return')),\n\t\t\t\tthis.getStateAsync(getDpPath('HUPout')),\n\t\t\t\tthis.getStateAsync(getDpPath('returnTemperatureHysteresis')),\n\t\t\t\tthis.getStateAsync(getDpPath('Heizen_nach_Wasser')),\n\t\t\t\tthis.getStateAsync(getDpPath('Mitteltemperatur')),\n\t\t\t\tthis.getStateAsync(getDpPath('thresholdHeatingLimit')),\n\t\t\t\tthis.getStateAsync(getDpPath('heatingLimit')),\n\t\t\t\tthis.istBetriebszustandAelterAls10Min(),\n\t\t\t]);\n\n\t\t\tconst wwSoll = (wwSollState?.val as number) ?? 0;\n\t\t\tconst wwIst = (wwIstState?.val as number) ?? 0;\n\t\t\tconst ruecklauf = (ruecklaufState?.val as number) ?? 0;\n\t\t\tconst spreizung = (spreizungState?.val as number) ?? 0;\n\t\t\tconst heatingStateStr = String(heatingStateStrState?.val || '').trim();\n\t\t\tconst vd1 = vd1State?.val === 1;\n\t\t\tconst wwHysterese = (wwHystereseState?.val as number) ?? 0;\n\t\t\tconst ruecklaufSoll = (ruecklaufSollState?.val as number) ?? 0;\n\t\t\tconst hupAktiv = (hupAktivState?.val as number) ?? 0;\n\t\t\tconst heizenHysterese = (heizenHystereseState?.val as number) ?? 0;\n\t\t\tconst mitteltemperatur = (mitteltempState?.val as number) ?? 0;\n\t\t\tconst thresholdHeatingLimit = (thresholdHeatingLimitstate?.val as number) ?? 0;\n\t\t\tconst heatingLimit = (heatingLimitState?.val as number) ?? 0;\n\t\t\tconst nachWasser = nachWasserState?.val;\n\n\t\t\t// =========================================================\n\t\t\t// 2. CONTINUOUS IN-SERVICE TELEMETRY EVALUATION\n\t\t\t// =========================================================\n\t\t\tif (istHeizen) {\n\t\t\t\tif (config.regelung_aktiv !== false && aelterAls10 && vd1) {\n\t\t\t\t\tconst fusspunkt = (await this.getStateAsync(getDpPath('heating_curve_parallel_offset')))?.val;\n\t\t\t\t\tif (fusspunkt === 35) {\n\t\t\t\t\t\tconst fallbackFusspunkt = config.fusspunkt ?? 21.7;\n\t\t\t\t\t\tawait this.syncConfigValue('heating_curve_parallel_offset', fallbackFusspunkt);\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tif (config.zip_optimierung_aktiv !== false) {\n\t\t\t\t\tconst now = Date.now();\n\t\t\t\t\tif (now - this.lastPumpOptimization > 600000) {\n\t\t\t\t\t\tif (spreizung < 6.5 && hupAktiv > 5.5) {\n\t\t\t\t\t\t\tawait this.syncConfigValue('heating_system_circ_pump_voltage_nominal', hupAktiv - 0.25);\n\t\t\t\t\t\t\tthis.lastPumpOptimization = now;\n\t\t\t\t\t\t\twriteLog(\n\t\t\t\t\t\t\t\t`Temperature spread too low (${spreizung}K). Scaling down HUP nominal target to ${hupAktiv - 0.25}V.`,\n\t\t\t\t\t\t\t\t'info',\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t} else if (spreizung > 7.5 && hupAktiv < 10) {\n\t\t\t\t\t\t\tawait this.syncConfigValue('heating_system_circ_pump_voltage_nominal', hupAktiv + 0.25);\n\t\t\t\t\t\t\tthis.lastPumpOptimization = now;\n\t\t\t\t\t\t\twriteLog(\n\t\t\t\t\t\t\t\t`Temperature spread too high (${spreizung}K). Scaling up HUP nominal target to ${hupAktiv + 0.25}V.`,\n\t\t\t\t\t\t\t\t'info',\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tif (config.regelung_aktiv !== false) {\n\t\t\t\t\tif (wwSoll - wwIst > 2 && ruecklauf >= ruecklaufSoll + heizenHysterese - 0.1) {\n\t\t\t\t\t\t// Neuen Sollwert berechnen: Ist-Wert + aktuelle Hysterese + 1.5K Puffer\n\t\t\t\t\t\tlet forceSoll = wwIst + wwHysterese + 1.5;\n\n\t\t\t\t\t\t// Sicherheitspr\u00FCfung: Maximaltemperatur kappen\n\t\t\t\t\t\tif (forceSoll > 75) {\n\t\t\t\t\t\t\tforceSoll = 75;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tforceSoll = Math.round(forceSoll * 10) / 10;\n\n\t\t\t\t\t\t// Statt Hysterese wird nun der Sollwert tempor\u00E4r erh\u00F6ht, um den WW-Takt k\u00FCnstlich anzusto\u00DFen\n\t\t\t\t\t\tawait this.syncConfigValue('warmwater_temperature', forceSoll);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (istWarmwasser && nachWasser) {\n\t\t\t\tif (config.regelung_aktiv !== false) {\n\t\t\t\t\tif ((heatingLimit === 1 && mitteltemperatur < thresholdHeatingLimit) || heatingLimit === 0) {\n\t\t\t\t\t\tawait this.syncConfigValue('heating_curve_parallel_offset', 35);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (istLeerlauf) {\n\t\t\t\tif (config.zip_optimierung_aktiv !== false) {\n\t\t\t\t\tif (wwIst <= wwSoll - wwHysterese || ruecklauf <= ruecklaufSoll - heizenHysterese) {\n\t\t\t\t\t\tawait stopZipAndDeaeration(this);\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tif (config.regelung_aktiv !== false) {\n\t\t\t\t\tif (\n\t\t\t\t\t\twwSoll - wwIst >= wwHysterese - 1.5 &&\n\t\t\t\t\t\truecklauf <= ruecklaufSoll &&\n\t\t\t\t\t\theatingStateStr !== 'Heating limit'\n\t\t\t\t\t) {\n\t\t\t\t\t\tawait this.syncConfigValue('heating_curve_parallel_offset', 35);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t} catch (err: any) {\n\t\t\twriteLog(`Error occurred during runOptimizationSchedule loop execution: ${err.message}`, 'error');\n\t\t}\n\t}\n\n\t/**\n\t * Fetches, parses, converts types, and populates live data registries over the configured TCP socket.\n\t * Dispatches calculation and history logging subroutines accordingly.\n\t *\n\t * @returns A promise that resolves when the internal update registers conclude.\n\t */\n\tprivate async updateData(): Promise<void> {\n\t\tif (this.updateRunning) {\n\t\t\treturn;\n\t\t}\n\t\tthis.updateRunning = true;\n\t\ttry {\n\t\t\tconst delayHelper = (ms: number): Promise<void> => new Promise(resolve => this.setTimeout(resolve, ms));\n\n\t\t\tlet rawParams: number[] = [];\n\t\t\tlet rawValues: number[] = [];\n\n\t\t\ttry {\n\t\t\t\trawParams = await readAllRaw(this, 3003);\n\t\t\t\tthis.currentRawParams = rawParams; //Cache f\u00FCr Schreibschutz aktuell halten\n\t\t\t} catch (err: unknown) {\n\t\t\t\tthis.log.debug(\n\t\t\t\t\t`Raw parameter acquisition response error (Command 3003): ${err instanceof Error ? err.message : String(err)}`,\n\t\t\t\t);\n\t\t\t}\n\n\t\t\tawait delayHelper(200);\n\n\t\t\ttry {\n\t\t\t\trawValues = await readAllRaw(this, 3004);\n\t\t\t} catch (err: unknown) {\n\t\t\t\tthis.log.debug(\n\t\t\t\t\t`Raw telemetry value acquisition response error (Command 3004): ${err instanceof Error ? err.message : String(err)}`,\n\t\t\t\t);\n\t\t\t}\n\n\t\t\tthis.errorCount = 0;\n\t\t\tawait this.setState('info.connection', { val: true, ack: true });\n\n\t\t\tconst statePromises: Promise<any>[] = [];\n\t\t\tconst config = this.config as Record<string, any>;\n\n\t\t\tfor (const [key, definition] of Object.entries(STATE_MAPPING)) {\n\t\t\t\tif (definition.isVirtual) {\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\n\t\t\t\tif (!isStateEnabled(key, definition, config)) {\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\n\t\t\t\tconst luxId = definition.luxWriteId || key;\n\t\t\t\tlet value: any = undefined;\n\n\t\t\t\tif (definition.dataSource) {\n\t\t\t\t\tswitch (definition.dataSource) {\n\t\t\t\t\t\tcase 'raw_parameter':\n\t\t\t\t\t\t\tvalue = rawParams?.[parseInt(luxId, 10)];\n\t\t\t\t\t\t\tif (value !== undefined && definition.factor) {\n\t\t\t\t\t\t\t\tvalue /= definition.factor;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\tcase 'raw_value':\n\t\t\t\t\t\t\tvalue = rawValues?.[parseInt(luxId, 10)];\n\t\t\t\t\t\t\tif (value !== undefined && definition.factor) {\n\t\t\t\t\t\t\t\tvalue /= definition.factor;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\tcase 'parameter':\n\t\t\t\t\t\tcase 'value':\n\t\t\t\t\t\tcase 'additional':\n\t\t\t\t\t\t\tvalue = undefined;\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\tif (/^\\d+$/.test(luxId)) {\n\t\t\t\t\t\tconst idx = parseInt(luxId, 10);\n\t\t\t\t\t\tvalue = definition.folder.startsWith('Settings') ? rawParams?.[idx] : rawValues?.[idx];\n\t\t\t\t\t\tif (value !== undefined && definition.factor) {\n\t\t\t\t\t\t\tvalue /= definition.factor;\n\t\t\t\t\t\t}\n\t\t\t\t\t} else {\n\t\t\t\t\t\tvalue = undefined;\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tif (value !== undefined) {\n\t\t\t\t\tif (definition.type === 'number' && typeof value === 'string') {\n\t\t\t\t\t\tvalue =\n\t\t\t\t\t\t\tvalue.toLowerCase() === 'ein' ? 1 : value.toLowerCase() === 'aus' ? 0 : parseFloat(value);\n\t\t\t\t\t} else if (definition.type === 'boolean') {\n\t\t\t\t\t\tvalue =\n\t\t\t\t\t\t\tvalue === true ||\n\t\t\t\t\t\t\tvalue === 1 ||\n\t\t\t\t\t\t\tString(value).toLowerCase() === 'ein' ||\n\t\t\t\t\t\t\tString(value).toLowerCase() === 'true';\n\t\t\t\t\t} else if (definition.type === 'json' && typeof value === 'object') {\n\t\t\t\t\t\tvalue = JSON.stringify(value);\n\t\t\t\t\t}\n\n\t\t\t\t\t// INTERNER HACK F\u00DCR DEN LUXTRONIK ANZEIGEFEHLER (1 Sekunde -> 0 Sekunden)\n\t\t\t\t\tlet finalSeconds = Number(value);\n\t\t\t\t\tif (definition.isDurationFormat && key === 'Time_WPein_akt' && finalSeconds === 1) {\n\t\t\t\t\t\tfinalSeconds = 0;\n\t\t\t\t\t}\n\n\t\t\t\t\tif (definition.isDurationFormat) {\n\t\t\t\t\t\tvalue = formatTimerSecondsToTime(finalSeconds);\n\t\t\t\t\t} else if (definition.role && ['value.datetime', 'value.time', 'date'].includes(definition.role)) {\n\t\t\t\t\t\tconst totalSeconds = typeof value === 'number' ? value : parseInt(value as string, 10);\n\t\t\t\t\t\tif (!isNaN(totalSeconds) && totalSeconds >= 0) {\n\t\t\t\t\t\t\tif (totalSeconds < 86400) {\n\t\t\t\t\t\t\t\tconst h = Math.floor(totalSeconds / 3600)\n\t\t\t\t\t\t\t\t\t.toString()\n\t\t\t\t\t\t\t\t\t.padStart(2, '0');\n\t\t\t\t\t\t\t\tconst m = Math.floor((totalSeconds % 3600) / 60)\n\t\t\t\t\t\t\t\t\t.toString()\n\t\t\t\t\t\t\t\t\t.padStart(2, '0');\n\t\t\t\t\t\t\t\tvalue = `${h}:${m}`;\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\tvalue = new Date(totalSeconds * 1000).toISOString().replace('T', ' ').substring(0, 19);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\tlet targetIoBrokerType = definition.type === 'json' ? 'string' : definition.type;\n\n\t\t\t\t\tif (definition.role && ['value.datetime', 'value.time', 'date'].includes(definition.role)) {\n\t\t\t\t\t\ttargetIoBrokerType = 'string';\n\t\t\t\t\t}\n\n\t\t\t\t\tif (targetIoBrokerType === 'string' && typeof value !== 'string') {\n\t\t\t\t\t\tvalue = String(value);\n\t\t\t\t\t} else if (targetIoBrokerType === 'number' && typeof value !== 'number') {\n\t\t\t\t\t\tvalue = Number(value);\n\t\t\t\t\t} else if (targetIoBrokerType === 'boolean' && typeof value !== 'boolean') {\n\t\t\t\t\t\tvalue = Boolean(value);\n\t\t\t\t\t}\n\n\t\t\t\t\tconst stateId = `${definition.folder}.${key}`;\n\t\t\t\t\tstatePromises.push(this.setState(stateId, { val: value, ack: true }));\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tawait Promise.all(statePromises);\n\t\t\tawait calculateTotalThermalEnergy(this);\n\t\t\tawait calculateTotalEnergy(this);\n\n\t\t\tconst fehlerDp = getDpPath('Fehlerspeicher');\n\t\t\tconst oldFehlerState = await this.getStateAsync(fehlerDp);\n\t\t\tconst oldFehlerVal = oldFehlerState?.val as string | undefined;\n\n\t\t\tawait updateErrorHistory(this, rawValues);\n\n\t\t\tconst newFehlerState = await this.getStateAsync(fehlerDp);\n\t\t\tconst newFehlerVal = newFehlerState?.val as string | undefined;\n\n\t\t\tawait checkAndSendErrorNotifications(this, oldFehlerVal, newFehlerVal);\n\n\t\t\tawait updateOutageHistory(this, rawValues);\n\t\t\tawait calculateTemperatureSpread(this);\n\t\t\tawait updateStatusStrings(this, rawValues, rawParams);\n\t\t\tawait updateCustomStates(this, rawValues, rawParams);\n\t\t\tawait updateTimerTables(this);\n\t\t\tawait updateSystemInfos(this, rawValues);\n\t\t\tawait this.runOptimizationSchedule();\n\t\t} catch (err: any) {\n\t\t\tthis.errorCount++;\n\t\t\twriteLog(\n\t\t\t\t`Communication error encountered (${this.errorCount}/${this.MAX_ERRORS}): ${err.message}`,\n\t\t\t\t'error',\n\t\t\t);\n\n\t\t\tif (this.errorCount >= this.MAX_ERRORS) {\n\t\t\t\tawait this.setState('info.connection', { val: false, ack: true });\n\t\t\t\twriteLog('Heat pump controller unreachable. Flagging connection status as disconnected.', 'warn');\n\t\t\t\tsendTelegramNotification(\n\t\t\t\t\tthis,\n\t\t\t\t\t'Heat pump controller unreachable. Flagging connection status as disconnected.',\n\t\t\t\t);\n\t\t\t}\n\t\t} finally {\n\t\t\tthis.updateRunning = false;\n\t\t}\n\t}\n\n\t/**\n\t * Callback issued by the ioBroker framework during adapter shutdown sequences.\n\t *\n\t * @param callback - Termination completion trigger function.\n\t */\n\tprivate onUnload(callback: () => void): void {\n\t\ttry {\n\t\t\tif (this.pollingInterval) {\n\t\t\t\tclearInterval(this.pollingInterval);\n\t\t\t}\n\t\t\tif (this.zipTimer) {\n\t\t\t\tclearTimeout(this.zipTimer);\n\t\t\t}\n\n\t\t\tif (this.midnightTimer) {\n\t\t\t\tthis.clearTimeout(this.midnightTimer);\n\t\t\t}\n\n\t\t\tvoid this.setState('info.connection', { val: false, ack: true });\n\n\t\t\twriteLog(\n\t\t\t\t'Adapter is shutting down. Cleared all active intervals and terminated open socket configurations cleanly.',\n\t\t\t\t'info',\n\t\t\t);\n\t\t\tcallback();\n\t\t} catch {\n\t\t\tcallback();\n\t\t}\n\t}\n\n\t/**\n\t * Central observer callback executed whenever a subscribed state receives an update.\n\t *\n\t * @param id - The explicit full namespaced state identifier path.\n\t * @param state - The newly applied state context or null context if dropped.\n\t * @returns A promise that resolves when operations complete.\n\t */\n\tprivate async onStateChange(id: string, state: ioBroker.State | null | undefined): Promise<void> {\n\t\tif (!state) {\n\t\t\treturn;\n\t\t}\n\n\t\t// Bewegungsmelder an den Manager auslagern\n\t\tconst isMotionSensor = await checkAndHandleMotionSensor(this, id, state);\n\t\tif (isMotionSensor) {\n\t\t\treturn; // Der zipManager hat das Event verarbeitet, wir sind hier fertig\n\t\t}\n\n\t\tif (state.ack) {\n\t\t\treturn;\n\t\t}\n\n\t\tif (id.startsWith(`${this.namespace}.Custom.`)) {\n\t\t\ttry {\n\t\t\t\tconst obj = await this.getObjectAsync(id);\n\n\t\t\t\tif (obj && obj.native && obj.native.source === 'parameter') {\n\t\t\t\t\tconst relativeId = id.replace(`${this.namespace}.`, '');\n\t\t\t\t\tawait this.setState(relativeId, { val: state.val, ack: true });\n\n\t\t\t\t\tlet valueToWrite: any = state.val;\n\n\t\t\t\t\tif (obj.native.customType === 'boolean') {\n\t\t\t\t\t\tvalueToWrite = state.val ? 1 : 0;\n\t\t\t\t\t} else if (obj.native.customType === 'number' && typeof state.val === 'number') {\n\t\t\t\t\t\tif (obj.native.factor) {\n\t\t\t\t\t\t\tvalueToWrite = Math.round(state.val / obj.native.factor);\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tvalueToWrite = Math.round(state.val);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\tconst targetWriteId = parseInt(obj.native.luxId, 10);\n\t\t\t\t\tif (!isNaN(targetWriteId)) {\n\t\t\t\t\t\tif (this.isDebugLogActive) {\n\t\t\t\t\t\t\twriteLog(\n\t\t\t\t\t\t\t\t`Transmitting modified custom configuration parameter ${targetWriteId} to hardware layer with payload value ${valueToWrite}`,\n\t\t\t\t\t\t\t\t'info',\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t}\n\t\t\t\t\t\tawait queueWrite(this, targetWriteId, valueToWrite);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t} catch (err: any) {\n\t\t\t\twriteLog(`Failed to compile custom value parameter adjustment payload write: ${err.message}`, 'error');\n\t\t\t}\n\t\t\treturn;\n\t\t}\n\n\t\tconst mappingKey = id.split('.').pop();\n\t\tif (!mappingKey) {\n\t\t\treturn;\n\t\t}\n\t\tconst definition = STATE_MAPPING[mappingKey];\n\t\tif (!definition) {\n\t\t\treturn;\n\t\t}\n\n\t\ttry {\n\t\t\tconst relativeId = id.replace(`${this.namespace}.`, '');\n\n\t\t\tif (mappingKey === 'Schreibe_Debug_Log') {\n\t\t\t\tawait this.setState(relativeId, { val: state.val, ack: true });\n\n\t\t\t\tthis.isDebugLogActive = state.val === true;\n\t\t\t\tsetCustomDebug(this.isDebugLogActive);\n\t\t\t\twriteLog(\n\t\t\t\t\t`Extended debugging telemetry logging mode has been ${this.isDebugLogActive ? 'enabled' : 'disabled'}.`,\n\t\t\t\t\t'info',\n\t\t\t\t);\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tif (mappingKey === 'Regelung_Aktiv' || mappingKey === 'zip_aktiv') {\n\t\t\t\tawait this.setState(relativeId, { val: state.val, ack: true });\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tif (mappingKey === 'Setze_Vorgabewerte' && state.val === true) {\n\t\t\t\tawait this.setState(relativeId, { val: false, ack: true });\n\t\t\t\tawait this.setIdleDefaults();\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tif (mappingKey === 'Dump_Raw_To_Log' && state.val === true) {\n\t\t\t\tawait this.setState(relativeId, { val: false, ack: true });\n\t\t\t\tawait dumpAllRawToLog(this);\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tif (mappingKey === 'Zwangswarmwasser') {\n\t\t\t\tif (state.val === true) {\n\t\t\t\t\tawait handleZwangswarmwasser(this, id);\n\t\t\t\t}\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tif (mappingKey === 'Zwangsheizen') {\n\t\t\t\tif (state.val === true) {\n\t\t\t\t\tawait handleZwangsheizen(this, id);\n\t\t\t\t}\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tif (mappingKey === 'Activate_Zip') {\n\t\t\t\tif (state.val === true) {\n\t\t\t\t\tconst durationState = await this.getStateAsync(getDpPath('zip_aktiv'));\n\t\t\t\t\tconst durationSeconds =\n\t\t\t\t\t\tdurationState && typeof durationState.val === 'number' ? durationState.val : 120;\n\t\t\t\t\tawait handleActivateZip(this, id, durationSeconds);\n\t\t\t\t} else {\n\t\t\t\t\tawait this.setState(relativeId, { val: false, ack: true });\n\t\t\t\t\tawait stopZipAndDeaeration(this);\n\t\t\t\t}\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tif (!definition.luxWriteId || definition.write !== true) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tawait this.setState(relativeId, { val: state.val, ack: true });\n\n\t\t\tlet valueToWrite: any = state.val;\n\n\t\t\tif (definition.role === 'value.datetime') {\n\t\t\t\tconst valStr = String(state.val).trim();\n\t\t\t\tconst timeMatch = valStr.match(/^(\\d{1,2}):(\\d{1,2})/);\n\t\t\t\tif (timeMatch) {\n\t\t\t\t\tvalueToWrite = parseInt(timeMatch[1], 10) * 3600 + parseInt(timeMatch[2], 10) * 60;\n\t\t\t\t}\n\t\t\t} else if (definition.factor && typeof state.val === 'number') {\n\t\t\t\tvalueToWrite = state.val * definition.factor;\n\t\t\t}\n\n\t\t\tif (definition.unit === '\u00B0C' && typeof state.val === 'number' && !definition.factor) {\n\t\t\t\tvalueToWrite = state.val * 10;\n\t\t\t}\n\n\t\t\tconst targetWriteId = definition.luxWriteId;\n\t\t\tawait queueWrite(this, parseInt(targetWriteId, 10), valueToWrite);\n\t\t} catch (err: any) {\n\t\t\twriteLog(\n\t\t\t\t`Failed to finalize downstream state change command event pipeline execution loop: ${err.message}`,\n\t\t\t\t'error',\n\t\t\t);\n\t\t}\n\t}\n}\n\nif (require.main !== module) {\n\tmodule.exports = (options: Partial<utils.AdapterOptions> | undefined) => new Luxtronik2Controller(options);\n} else {\n\t(() => new Luxtronik2Controller())();\n}\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;AAGA,YAAuB;AACvB,4BAA2D;AAC3D,qBAAyC;AACzC,oBAAqD;AACrD,iCAA4F;AAC5F,2BAOO;AACP,0BAAwD;AACxD,0BAAyC;AACzC,2BAUO;AACP,wBAMO;AAIP,MAAM,6BAA6B,MAAM,QAAQ;AAAA;AAAA,EAEzC,gBAA6B,oBAAI,IAAY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,CAAC,GAAG,EAAE,IAAI,OAAO,SAAS,UAAU,CAAC,GAAG,EAAE,IAAI;AAAA,QACjF;AAAA,MACD,WAAW,WAAW,UAAU,OAAO,MAAM,QAAQ,UAAU;AAC9D,uBAAe,MAAM,MAAM,WAAW;AAAA,MACvC;AAEA,UAAI,WAAW,SAAS,WAAQ,OAAO,MAAM,QAAQ,YAAY,CAAC,WAAW,QAAQ;AACpF,uBAAe,MAAM,MAAM;AAAA,MAC5B;AAEA,YAAM,gBAAgB,WAAW;AACjC,gBAAM,gCAAW,MAAM,SAAS,eAAe,EAAE,GAAG,YAAY;AAAA,IACjE,SAAS,KAAU;AAClB;AAAA,QACC,qFAAqF,IAAI,OAAO;AAAA,QAChG;AAAA,MACD;AAAA,IACD;AAAA,EACD;AACD;AAEA,IAAI,QAAQ,SAAS,QAAQ;AAC5B,SAAO,UAAU,CAAC,YAAuD,IAAI,qBAAqB,OAAO;AAC1G,OAAO;AACN,GAAC,MAAM,IAAI,qBAAqB,GAAG;AACpC;",
4
+ "sourcesContent": ["/*\n * Created with @iobroker/create-adapter v3.1.5\n */\nimport * as utils from '@iobroker/adapter-core';\nimport { handleZwangsheizen, handleZwangswarmwasser } from './actionHandlers';\nimport { formatTimerSecondsToTime } from './convert';\nimport { initLogger, setCustomDebug, writeLog } from './logger';\nimport { checkAndSendErrorNotifications, handleTestMessage, sendTelegramNotification } from './notificationManager';\nimport {\n\tcleanupCustomStates,\n\tcleanupEmptyFolders,\n\tcleanupStates,\n\tensureAllObjectsExist,\n\tensureCustomObjectsExist,\n\tisStateEnabled,\n} from './objectManager';\nimport { dumpAllRawToLog, queueWrite, readAllRaw } from './rawFunctions';\nimport { STATE_MAPPING, getDpPath } from './stateMapping';\nimport {\n\tcalculateTemperatureSpread,\n\tcalculateTotalEnergy,\n\tcalculateTotalThermalEnergy,\n\tupdateCustomStates,\n\tupdateErrorHistory,\n\tupdateOutageHistory,\n\tupdateStatusStrings,\n\tupdateSystemInfos,\n\tupdateTimerTables,\n} from './virtualStates';\nimport {\n\tcheckAndHandleMotionSensor,\n\tdisableHardwareZipTimer,\n\thandleActivateZip,\n\tstopZipAndDeaeration,\n\tsubscribeMotionSensors,\n} from './zipManager';\n\n/**\n * Main class for the Luxtronik2 Controller ioBroker Adapter.\n */\nclass Luxtronik2Controller extends utils.Adapter {\n\t/** Set of all active namespaced state IDs created or managed by the adapter */\n\tpublic createdStates: Set<string> = new Set<string>();\n\t/** ioBroker timeout handle for the hot water circulation pump macro */\n\tpublic zipTimer?: ioBroker.Timeout;\n\t/** Cached copy of the original circulation pump settings before macro activation */\n\tpublic originalZipConfig: Record<string, any> | null = null;\n\t/** Unix timestamp of the last error dispatched to prevent duplicate notification triggers */\n\tpublic lastKnownErrorTimestamp: number | null = null;\n\t/** Determines whether verbose debugging output is enabled */\n\tpublic isDebugLogActive: boolean = false;\n\t// Cache f\u00FCr den globalen Schreibschutz\n\tpublic currentRawParams: number[] = [];\n\t/** ioBroker interval handle for the main data polling loop */\n\tprivate pollingInterval: ioBroker.Interval | undefined;\n\t/** Cache for the last evaluated heat pump operating state code */\n\tprivate lastBzVal: string = '';\n\t/** Lock flag preventing concurrent execution of the polling updates */\n\tprivate updateRunning: boolean = false;\n\t/** Timestamp tracking the last dynamic pump voltage optimization execution */\n\tprivate lastPumpOptimization: number = 0;\n\n\t/** Internal array storing pending serial hardware write tasks */\n\tpublic writeQueue: (() => Promise<void>)[] = [];\n\t/** Lock flag indicating that the write queue is currently being processed */\n\tpublic isWriting: boolean = false;\n\t/** Counter tracking sequential communication timeouts/failures */\n\tprivate errorCount: number = 0;\n\t/** Maximum allowed sequential request failures before connection is flagged as interrupted */\n\tprivate readonly MAX_ERRORS: number = 3;\n\tpublic writeCyclesToday: number = 0;\n\tpublic writeCyclesTotal: number = 0;\n\tprivate midnightTimer?: ioBroker.Timeout;\n\n\t/**\n\t * Initializes a new instance of the Luxtronik2Controller class.\n\t *\n\t * @param options - Optional core configuration overrides passed by the ioBroker host.\n\t */\n\tpublic constructor(options: Partial<utils.AdapterOptions> = {}) {\n\t\tsuper({\n\t\t\t...options,\n\t\t\tname: 'luxtronik2-controller',\n\t\t});\n\t\tinitLogger(this);\n\n\t\tthis.on('ready', this.onReady.bind(this));\n\t\tthis.on('stateChange', this.onStateChange.bind(this));\n\t\tthis.on('unload', this.onUnload.bind(this));\n\t\tthis.on('message', this.onMessage.bind(this));\n\t}\n\n\t/**\n\t * Processes incoming inter-adapter messages or commands dispatched from the Admin UI.\n\t *\n\t * @param obj - The standardized ioBroker message structure containing parameters and optional callbacks.\n\t * @returns A promise that resolves once the message has been processed.\n\t */\n\tprivate async onMessage(obj: ioBroker.Message): Promise<void> {\n\t\tif (obj.command === 'testTelegram') {\n\t\t\tawait handleTestMessage(this, obj);\n\t\t}\n\t}\n\n\t/**\n\t * Callback executed once the ioBroker host framework completely initializes the adapter subsystem.\n\t * Sets up database objects, applies configurations, subscribes to states, and triggers the polling loop.\n\t *\n\t * @returns A promise that resolves when initialization completes.\n\t */\n\tprivate async onReady(): Promise<void> {\n\t\tconst config = this.config as Record<string, any>;\n\t\tconst ip = config.host;\n\t\tconst port = config.port || 8889;\n\n\t\tawait this.setState('info.connection', { val: false, ack: true });\n\t\twriteLog(`Connecting to heat pump at ${ip}:${port}...`, 'info');\n\n\t\tawait cleanupStates(this);\n\t\tawait cleanupCustomStates(this);\n\t\tawait cleanupEmptyFolders(this);\n\t\tawait ensureAllObjectsExist(this);\n\t\tawait ensureCustomObjectsExist(this);\n\n\t\t// Strikte \"Opt-In\" Pr\u00FCfung beim Start\n\t\tawait this.setState(getDpPath('Regelung_Aktiv'), { val: config.regelung_aktiv === true, ack: true });\n\n\t\tconst debugState = await this.getStateAsync(getDpPath('Schreibe_Debug_Log'));\n\t\tthis.isDebugLogActive = debugState?.val === true;\n\t\tsetCustomDebug(this.isDebugLogActive);\n\n\t\tawait disableHardwareZipTimer(this);\n\n\t\t// Schreib-Z\u00E4hler aus ioBroker laden (sichert den Stand bei einem Adapter-Neustart)\n\t\tconst cycleTodayState = await this.getStateAsync(getDpPath('write_cycles_today'));\n\t\tthis.writeCyclesToday = cycleTodayState && typeof cycleTodayState.val === 'number' ? cycleTodayState.val : 0;\n\n\t\tconst cycleTotalState = await this.getStateAsync(getDpPath('write_cycles_total'));\n\t\tthis.writeCyclesTotal = cycleTotalState && typeof cycleTotalState.val === 'number' ? cycleTotalState.val : 0;\n\n\t\tthis.scheduleMidnightReset(); // Startet den 00:00 Uhr Timer (nur f\u00FCr den Tagesz\u00E4hler!)\n\t\tsubscribeMotionSensors(this);\n\n\t\tthis.subscribeStates('*');\n\n\t\ttry {\n\t\t\tawait this.updateData();\n\t\t} catch (error: any) {\n\t\t\tthis.log.error(`Initial data retrieval failed (device offline?): ${error.message}`);\n\t\t}\n\n\t\tlet intervalSeconds = this.config.interval ? Number(this.config.interval) : 45;\n\t\tif (intervalSeconds < 10) {\n\t\t\tintervalSeconds = 10;\n\t\t\twriteLog(\n\t\t\t\t'Configured polling interval was too short. Forced to minimum threshold of 10 seconds for protection.',\n\t\t\t\t'warn',\n\t\t\t);\n\t\t}\n\t\tif (intervalSeconds > 3600) {\n\t\t\tintervalSeconds = 3600;\n\t\t\twriteLog(\n\t\t\t\t'Configured polling interval exceeded maximum boundary. Restricted to 3600 seconds to prevent overflow issues.',\n\t\t\t\t'warn',\n\t\t\t);\n\t\t}\n\n\t\tthis.pollingInterval = this.setInterval(async () => {\n\t\t\ttry {\n\t\t\t\tawait this.updateData();\n\t\t\t} catch (error: any) {\n\t\t\t\tthis.log.error(`Error during cyclic data retrieval loop: ${error.message}`);\n\t\t\t}\n\t\t}, intervalSeconds * 1000);\n\n\t\tawait this.setState('info.connection', true, true);\n\t}\n\n\t/**\n\t * Berechnet die Zeit bis Mitternacht und setzt NUR den heutigen Schreibz\u00E4hler auf 0 zur\u00FCck.\n\t */\n\tprivate scheduleMidnightReset(): void {\n\t\tconst now = new Date();\n\t\tconst night = new Date(now.getFullYear(), now.getMonth(), now.getDate() + 1, 0, 0, 0);\n\t\tconst msToMidnight = night.getTime() - now.getTime();\n\n\t\tthis.midnightTimer = this.setTimeout(() => {\n\t\t\tthis.writeCyclesToday = 0;\n\t\t\tvoid this.setState(getDpPath('write_cycles_today'), { val: 0, ack: true });\n\n\t\t\t// Timer f\u00FCr den n\u00E4chsten Tag neu aufziehen\n\t\t\tthis.scheduleMidnightReset();\n\t\t}, msToMidnight);\n\t}\n\n\t/**\n\t * Synchronizes a single state configuration parameter with the Luxtronik physical controller.\n\t *\n\t * @param mappingKey - The unique key identifier within the STATE_MAPPING structure.\n\t * @param val - The raw or parsed value to apply.\n\t * @returns A promise that resolves when the synchronization task finishes.\n\t */\n\tpublic async syncConfigValue(mappingKey: keyof typeof STATE_MAPPING, val: any): Promise<void> {\n\t\tif (val === undefined || val === null) {\n\t\t\treturn;\n\t\t}\n\t\tconst id = getDpPath(mappingKey);\n\t\tconst state = await this.getStateAsync(id);\n\n\t\tif (!state || state.val !== val) {\n\t\t\tconst definition = STATE_MAPPING[mappingKey];\n\t\t\tif (!definition) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tawait this.setState(id, { val: val, ack: true });\n\n\t\t\tif (this.isDebugLogActive) {\n\t\t\t\twriteLog(`Writing value directly into heat pump controller: ${mappingKey} = ${val}`, 'info');\n\t\t\t}\n\n\t\t\tif (definition.write === true && !definition.isVirtual && definition.luxWriteId) {\n\t\t\t\tlet valueToWrite: any = val;\n\t\t\t\tif (definition.factor && typeof val === 'number') {\n\t\t\t\t\tvalueToWrite = val * definition.factor;\n\t\t\t\t}\n\n\t\t\t\tconst isRawWrite =\n\t\t\t\t\tdefinition.dataSource === 'raw_parameter' ||\n\t\t\t\t\tdefinition.dataSource === 'raw_value' ||\n\t\t\t\t\t(!definition.dataSource && /^\\d+$/.test(definition.luxWriteId || ''));\n\t\t\t\tif (isRawWrite && definition.unit === '\u00B0C' && typeof val === 'number' && !definition.factor) {\n\t\t\t\t\tvalueToWrite = val * 10;\n\t\t\t\t}\n\n\t\t\t\ttry {\n\t\t\t\t\tconst targetWriteId = definition.luxWriteId;\n\t\t\t\t\tconst writeId = isRawWrite ? parseInt(targetWriteId, 10) : targetWriteId;\n\t\t\t\t\tawait queueWrite(this, writeId, valueToWrite);\n\t\t\t\t\tawait new Promise(r => global.setTimeout(r, 200));\n\t\t\t\t} catch (err: any) {\n\t\t\t\t\twriteLog(\n\t\t\t\t\t\t`Failed to transmit ${mappingKey} to the heat pump hardware interface: ${err.message}`,\n\t\t\t\t\t\t'error',\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\t/**\n\t * Safely updates an internal database state value only if the newly supplied value differs from the existing entry.\n\t *\n\t * @param id - The relative state path ID.\n\t * @param val - The updated value to process.\n\t * @param ack - Explicit acknowledgment flag status to set.\n\t * @returns A promise that resolves when the verification and write operation completes.\n\t */\n\tpublic async setOwnStateIfDifferent(id: string, val: any, ack = false): Promise<void> {\n\t\ttry {\n\t\t\tif (val === undefined) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tconst state = await this.getStateAsync(id);\n\t\t\tif (!state || state.val !== val) {\n\t\t\t\tawait this.setState(id, { val: val, ack: ack });\n\t\t\t\tif (this.isDebugLogActive) {\n\t\t\t\t\twriteLog(`Applying specific update for local state ${id}: ${val}`, 'debug');\n\t\t\t\t}\n\t\t\t}\n\t\t} catch (err: any) {\n\t\t\twriteLog(`Error occurred during setOwnStateIfDifferent operation for state ${id}: ${err.message}`, 'error');\n\t\t}\n\t}\n\n\t/**\n\t * Configures fallback factory parameter baselines for the heat pump when in an idle state.\n\t *\n\t * @returns A promise that resolves when all default configuration tasks resolve.\n\t */\n\tprivate async setIdleDefaults(): Promise<void> {\n\t\ttry {\n\t\t\tconst config = this.config as Record<string, any>;\n\t\t\tawait this.syncConfigValue('heating_curve_end_point', config.endpunkt ?? 23);\n\t\t\tawait this.syncConfigValue('heating_curve_parallel_offset', config.fusspunkt ?? 21.7);\n\t\t\tawait this.syncConfigValue(\n\t\t\t\t'heating_system_circ_pump_voltage_minimal',\n\t\t\t\tconfig.sync_heating_system_circ_pump_voltage_minimal_heating ?? 3,\n\t\t\t);\n\t\t\tawait this.syncConfigValue(\n\t\t\t\t'heating_system_circ_pump_voltage_nominal',\n\t\t\t\tconfig.sync_heating_system_circ_pump_voltage_nominal_heating ?? 7,\n\t\t\t);\n\t\t\tawait this.syncConfigValue('warmwater_temperature', config.sync_warmwater_target_temperature ?? 54);\n\t\t\tawait this.syncConfigValue('returnTemperatureHysteresis', config.sync_return_temperature_hysteresis ?? 1.5);\n\t\t\tawait this.syncConfigValue('zip_aktiv', config.zip_aktiv ?? 0);\n\t\t\tawait this.syncConfigValue('Heizen_nach_Wasser', config.Heating_after_warmwater ?? false);\n\t\t} catch (err: any) {\n\t\t\twriteLog(`Failed to apply the baseline idle configuration defaults: ${err.message}`, 'error');\n\t\t}\n\t}\n\n\t/**\n\t * Evaluates whether the current active operating state timestamp is older than ten minutes.\n\t *\n\t * @returns A promise that resolves to true if the state has remained unaltered for at least 10 minutes.\n\t */\n\tprivate async istBetriebszustandAelterAls10Min(): Promise<boolean> {\n\t\ttry {\n\t\t\tconst state = await this.getStateAsync(getDpPath('WP_BZ_akt'));\n\t\t\tconst lastChange = state?.lc ?? 0;\n\t\t\treturn (Date.now() - lastChange) / 60000 >= 10;\n\t\t} catch {\n\t\t\treturn false;\n\t\t}\n\t}\n\n\t/**\n\t * Primary intelligent engine analyzing live telemetry values to execute continuous performance optimizations.\n\t * Manages dynamic heating curves, anti-cycling protective delays, and voltage scaling algorithms.\n\t *\n\t * @returns A promise that resolves when the execution cycle finishes.\n\t */\n\tprivate async runOptimizationSchedule(): Promise<void> {\n\t\ttry {\n\t\t\tconst config = this.config as Record<string, any>;\n\t\t\tconst bzState = await this.getStateAsync(getDpPath('WP_BZ_akt'));\n\t\t\tconst bzVal = bzState && bzState.val !== null ? String(bzState.val).trim() : '';\n\n\t\t\t// Live-Status des ioBroker Schalters \"Regelung_Aktiv\" auslesen\n\t\t\tconst regelungAktivState = await this.getStateAsync(getDpPath('Regelung_Aktiv'));\n\t\t\tconst isRegelungAktiv = regelungAktivState?.val === true;\n\n\t\t\tconst istHeizen = bzVal === '0';\n\t\t\tconst istWarmwasser = bzVal === '1';\n\t\t\tconst istAbtauen = bzVal === '4';\n\t\t\tconst istLeerlauf = bzVal === '5';\n\n\t\t\tif (!istHeizen && !istWarmwasser && !istLeerlauf && !istAbtauen) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\t// =========================================================\n\t\t\t// 1. DYNAMIC PARAMETER ADJUSTMENT UPON STATE SWITCH\n\t\t\t// =========================================================\n\t\t\tif (bzVal !== this.lastBzVal) {\n\t\t\t\tif (istLeerlauf) {\n\t\t\t\t\tif (config.idle_defaults_aktiv === true) {\n\t\t\t\t\t\tawait this.setIdleDefaults();\n\t\t\t\t\t}\n\t\t\t\t} else if (istHeizen) {\n\t\t\t\t\tif (config.zip_optimierung_aktiv === true) {\n\t\t\t\t\t\tawait this.syncConfigValue('zip_aktiv', config.zip_aktiv ?? 0);\n\t\t\t\t\t\tawait this.syncConfigValue(\n\t\t\t\t\t\t\t'heating_system_circ_pump_voltage_minimal',\n\t\t\t\t\t\t\tconfig.sync_heating_system_circ_pump_voltage_minimal_heating ?? 3,\n\t\t\t\t\t\t);\n\t\t\t\t\t\tawait this.syncConfigValue(\n\t\t\t\t\t\t\t'heating_system_circ_pump_voltage_nominal',\n\t\t\t\t\t\t\tconfig.sync_heating_system_circ_pump_voltage_nominal_heating ?? 7,\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\t\t\t\t\tif (isRegelungAktiv) {\n\t\t\t\t\t\tawait this.syncConfigValue('Heizen_nach_Wasser', config.Heating_after_warmwater ?? false);\n\t\t\t\t\t}\n\t\t\t\t} else if (istWarmwasser) {\n\t\t\t\t\tif (config.zip_optimierung_aktiv === true) {\n\t\t\t\t\t\t// Pr\u00FCfen, ob externe Aktoren konfiguriert sind\n\t\t\t\t\t\tconst actors = config.actors || [];\n\t\t\t\t\t\tconst validActors = actors.filter(\n\t\t\t\t\t\t\t(a: any) => a.zip_external_relay_id && a.zip_external_relay_id.trim() !== '',\n\t\t\t\t\t\t);\n\n\t\t\t\t\t\t// Wenn Aktoren da sind, k\u00F6nnen wir die Zirkulation bedenkenlos starten (0 Flash-Schreibvorg\u00E4nge!)\n\t\t\t\t\t\tif (validActors.length > 0) {\n\t\t\t\t\t\t\tif (this.isDebugLogActive) {\n\t\t\t\t\t\t\t\tthis.log.debug(\n\t\t\t\t\t\t\t\t\t'[ZIP] Externe Aktoren gefunden. Starte Zirkulation synchron zur Warmwasserbereitung.',\n\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t// Dauer aus der Config holen (mit einem sinnvollen Fallback von z.B. 120 Sekunden)\n\t\t\t\t\t\t\tawait this.syncConfigValue('zip_aktiv', config.zip_aktiv_ww ?? 120);\n\t\t\t\t\t\t\t// Makro \u00FCber den Trigger-Datenpunkt ausl\u00F6sen\n\t\t\t\t\t\t\tawait this.setOwnStateIfDifferent(getDpPath('Activate_Zip'), true, false);\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tawait this.syncConfigValue(\n\t\t\t\t\t\t\t'heating_system_circ_pump_voltage_minimal',\n\t\t\t\t\t\t\tconfig.sync_heating_system_circ_pump_voltage_minimal_water ?? 3,\n\t\t\t\t\t\t);\n\t\t\t\t\t\tawait this.syncConfigValue(\n\t\t\t\t\t\t\t'heating_system_circ_pump_voltage_nominal',\n\t\t\t\t\t\t\tconfig.sync_heating_system_circ_pump_voltage_nominal_water ?? 10,\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tthis.lastBzVal = bzVal;\n\t\t\t}\n\n\t\t\tconst [\n\t\t\t\twwSollState,\n\t\t\t\twwIstState,\n\t\t\t\truecklaufState,\n\t\t\t\tspreizungState,\n\t\t\t\theatingStateStrState,\n\t\t\t\tvd1State,\n\t\t\t\twwHystereseState,\n\t\t\t\truecklaufSollState,\n\t\t\t\thupAktivState,\n\t\t\t\theizenHystereseState,\n\t\t\t\tnachWasserState,\n\t\t\t\tmitteltempState,\n\t\t\t\tthresholdHeatingLimitstate,\n\t\t\t\theatingLimitState,\n\t\t\t\taelterAls10,\n\t\t\t] = await Promise.all([\n\t\t\t\tthis.getStateAsync(getDpPath('Wamwassertemperatur_Soll')),\n\t\t\t\tthis.getStateAsync(getDpPath('Wamwassertemperatur_Ist')),\n\t\t\t\tthis.getStateAsync(getDpPath('temperature_return')),\n\t\t\t\tthis.getStateAsync(getDpPath('spreizung_vorlauf_ruecklauf')),\n\t\t\t\tthis.getStateAsync(getDpPath('opStateHeatingString')),\n\t\t\t\tthis.getStateAsync(getDpPath('VD1out')),\n\t\t\t\tthis.getStateAsync(getDpPath('hotWaterTemperatureHysteresis')),\n\t\t\t\tthis.getStateAsync(getDpPath('temperature_target_return')),\n\t\t\t\tthis.getStateAsync(getDpPath('HUPout')),\n\t\t\t\tthis.getStateAsync(getDpPath('returnTemperatureHysteresis')),\n\t\t\t\tthis.getStateAsync(getDpPath('Heizen_nach_Wasser')),\n\t\t\t\tthis.getStateAsync(getDpPath('Mitteltemperatur')),\n\t\t\t\tthis.getStateAsync(getDpPath('thresholdHeatingLimit')),\n\t\t\t\tthis.getStateAsync(getDpPath('heatingLimit')),\n\t\t\t\tthis.istBetriebszustandAelterAls10Min(),\n\t\t\t]);\n\n\t\t\tconst wwSoll = (wwSollState?.val as number) ?? 0;\n\t\t\tconst wwIst = (wwIstState?.val as number) ?? 0;\n\t\t\tconst ruecklauf = (ruecklaufState?.val as number) ?? 0;\n\t\t\tconst spreizung = (spreizungState?.val as number) ?? 0;\n\t\t\tconst heatingStateStr = String(heatingStateStrState?.val || '').trim();\n\t\t\tconst vd1 = vd1State?.val === 1;\n\t\t\tconst wwHysterese = (wwHystereseState?.val as number) ?? 0;\n\t\t\tconst ruecklaufSoll = (ruecklaufSollState?.val as number) ?? 0;\n\t\t\tconst hupAktiv = (hupAktivState?.val as number) ?? 0;\n\t\t\tconst heizenHysterese = (heizenHystereseState?.val as number) ?? 0;\n\t\t\tconst mitteltemperatur = (mitteltempState?.val as number) ?? 0;\n\t\t\tconst thresholdHeatingLimit = (thresholdHeatingLimitstate?.val as number) ?? 0;\n\t\t\tconst heatingLimit = (heatingLimitState?.val as number) ?? 0;\n\t\t\tconst nachWasser = nachWasserState?.val;\n\n\t\t\t// =========================================================\n\t\t\t// 2. CONTINUOUS IN-SERVICE TELEMETRY EVALUATION\n\t\t\t// =========================================================\n\t\t\tif (istHeizen) {\n\t\t\t\tif (isRegelungAktiv && aelterAls10 && vd1) {\n\t\t\t\t\tconst fusspunkt = (await this.getStateAsync(getDpPath('heating_curve_parallel_offset')))?.val;\n\t\t\t\t\tif (fusspunkt === 35) {\n\t\t\t\t\t\tconst fallbackFusspunkt = config.fusspunkt ?? 21.7;\n\t\t\t\t\t\tawait this.syncConfigValue('heating_curve_parallel_offset', fallbackFusspunkt);\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tif (config.zip_optimierung_aktiv === true) {\n\t\t\t\t\tconst now = Date.now();\n\t\t\t\t\tif (now - this.lastPumpOptimization > 600000) {\n\t\t\t\t\t\tif (spreizung < 6.5 && hupAktiv > 5.5) {\n\t\t\t\t\t\t\tawait this.syncConfigValue('heating_system_circ_pump_voltage_nominal', hupAktiv - 0.25);\n\t\t\t\t\t\t\tthis.lastPumpOptimization = now;\n\t\t\t\t\t\t\twriteLog(\n\t\t\t\t\t\t\t\t`Temperature spread too low (${spreizung}K). Scaling down HUP nominal target to ${hupAktiv - 0.25}V.`,\n\t\t\t\t\t\t\t\t'info',\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t} else if (spreizung > 7.5 && hupAktiv < 10) {\n\t\t\t\t\t\t\tawait this.syncConfigValue('heating_system_circ_pump_voltage_nominal', hupAktiv + 0.25);\n\t\t\t\t\t\t\tthis.lastPumpOptimization = now;\n\t\t\t\t\t\t\twriteLog(\n\t\t\t\t\t\t\t\t`Temperature spread too high (${spreizung}K). Scaling up HUP nominal target to ${hupAktiv + 0.25}V.`,\n\t\t\t\t\t\t\t\t'info',\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tif (isRegelungAktiv) {\n\t\t\t\t\t// WICHTIG: Heizen_nach_Wasser Logik (Reset & Setzen)\n\t\t\t\t\tif (ruecklauf >= ruecklaufSoll + heizenHysterese - 0.1) {\n\t\t\t\t\t\tif (aelterAls10) {\n\t\t\t\t\t\t\tawait this.syncConfigValue('Heizen_nach_Wasser', false);\n\t\t\t\t\t\t}\n\t\t\t\t\t} else if (!nachWasser && config.Heating_after_warmwater === true) {\n\t\t\t\t\t\tawait this.syncConfigValue('Heizen_nach_Wasser', true);\n\t\t\t\t\t}\n\n\t\t\t\t\t// Warmwassertakt erzwingen\n\t\t\t\t\tif (wwSoll - wwIst > 2 && ruecklauf >= ruecklaufSoll + heizenHysterese - 0.1) {\n\t\t\t\t\t\t// Neuen Sollwert berechnen: Ist-Wert + aktuelle Hysterese + 1.5K Puffer\n\t\t\t\t\t\tlet forceSoll = wwIst + wwHysterese + 1.5;\n\n\t\t\t\t\t\t// Sicherheitspr\u00FCfung: Maximaltemperatur kappen (Passend zu actionHandlers = 70\u00B0C)\n\t\t\t\t\t\tif (forceSoll > 70) {\n\t\t\t\t\t\t\tforceSoll = 70;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tforceSoll = Math.round(forceSoll * 10) / 10;\n\n\t\t\t\t\t\t// Statt Hysterese wird nun der Sollwert tempor\u00E4r erh\u00F6ht, um den WW-Takt k\u00FCnstlich anzusto\u00DFen\n\t\t\t\t\t\tawait this.syncConfigValue('warmwater_temperature', forceSoll);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (istWarmwasser && nachWasser) {\n\t\t\t\tif (isRegelungAktiv) {\n\t\t\t\t\tif ((heatingLimit === 1 && mitteltemperatur < thresholdHeatingLimit) || heatingLimit === 0) {\n\t\t\t\t\t\tawait this.syncConfigValue('heating_curve_parallel_offset', 35);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (istLeerlauf) {\n\t\t\t\tif (config.zip_optimierung_aktiv === true) {\n\t\t\t\t\tif (wwIst <= wwSoll - wwHysterese || ruecklauf <= ruecklaufSoll - heizenHysterese) {\n\t\t\t\t\t\tawait stopZipAndDeaeration(this);\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tif (isRegelungAktiv) {\n\t\t\t\t\tif (\n\t\t\t\t\t\twwSoll - wwIst >= wwHysterese - 1.5 &&\n\t\t\t\t\t\truecklauf <= ruecklaufSoll &&\n\t\t\t\t\t\theatingStateStr !== 'Heating limit'\n\t\t\t\t\t) {\n\t\t\t\t\t\tawait this.syncConfigValue('heating_curve_parallel_offset', 35);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t} catch (err: any) {\n\t\t\twriteLog(`Error occurred during runOptimizationSchedule loop execution: ${err.message}`, 'error');\n\t\t}\n\t}\n\n\t/**\n\t * Fetches, parses, converts types, and populates live data registries over the configured TCP socket.\n\t * Dispatches calculation and history logging subroutines accordingly.\n\t *\n\t * @returns A promise that resolves when the internal update registers conclude.\n\t */\n\tprivate async updateData(): Promise<void> {\n\t\tif (this.updateRunning) {\n\t\t\treturn;\n\t\t}\n\t\tthis.updateRunning = true;\n\t\ttry {\n\t\t\tconst delayHelper = (ms: number): Promise<void> => new Promise(resolve => this.setTimeout(resolve, ms));\n\n\t\t\tlet rawParams: number[] = [];\n\t\t\tlet rawValues: number[] = [];\n\n\t\t\ttry {\n\t\t\t\trawParams = await readAllRaw(this, 3003);\n\t\t\t\tthis.currentRawParams = rawParams; //Cache f\u00FCr Schreibschutz aktuell halten\n\t\t\t} catch (err: unknown) {\n\t\t\t\tthis.log.debug(\n\t\t\t\t\t`Raw parameter acquisition response error (Command 3003): ${err instanceof Error ? err.message : String(err)}`,\n\t\t\t\t);\n\t\t\t}\n\n\t\t\tawait delayHelper(200);\n\n\t\t\ttry {\n\t\t\t\trawValues = await readAllRaw(this, 3004);\n\t\t\t} catch (err: unknown) {\n\t\t\t\tthis.log.debug(\n\t\t\t\t\t`Raw telemetry value acquisition response error (Command 3004): ${err instanceof Error ? err.message : String(err)}`,\n\t\t\t\t);\n\t\t\t}\n\n\t\t\tthis.errorCount = 0;\n\t\t\tawait this.setState('info.connection', { val: true, ack: true });\n\n\t\t\tconst statePromises: Promise<any>[] = [];\n\t\t\tconst config = this.config as Record<string, any>;\n\n\t\t\tfor (const [key, definition] of Object.entries(STATE_MAPPING)) {\n\t\t\t\tif (definition.isVirtual) {\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\n\t\t\t\tif (!isStateEnabled(key, definition, config)) {\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\n\t\t\t\tconst luxId = definition.luxWriteId || key;\n\t\t\t\tlet value: any = undefined;\n\n\t\t\t\tif (definition.dataSource) {\n\t\t\t\t\tswitch (definition.dataSource) {\n\t\t\t\t\t\tcase 'raw_parameter':\n\t\t\t\t\t\t\tvalue = rawParams?.[parseInt(luxId, 10)];\n\t\t\t\t\t\t\tif (value !== undefined && definition.factor) {\n\t\t\t\t\t\t\t\tvalue /= definition.factor;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\tcase 'raw_value':\n\t\t\t\t\t\t\tvalue = rawValues?.[parseInt(luxId, 10)];\n\t\t\t\t\t\t\tif (value !== undefined && definition.factor) {\n\t\t\t\t\t\t\t\tvalue /= definition.factor;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\tcase 'parameter':\n\t\t\t\t\t\tcase 'value':\n\t\t\t\t\t\tcase 'additional':\n\t\t\t\t\t\t\tvalue = undefined;\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\tif (/^\\d+$/.test(luxId)) {\n\t\t\t\t\t\tconst idx = parseInt(luxId, 10);\n\t\t\t\t\t\tvalue = definition.folder.startsWith('Settings') ? rawParams?.[idx] : rawValues?.[idx];\n\t\t\t\t\t\tif (value !== undefined && definition.factor) {\n\t\t\t\t\t\t\tvalue /= definition.factor;\n\t\t\t\t\t\t}\n\t\t\t\t\t} else {\n\t\t\t\t\t\tvalue = undefined;\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tif (value !== undefined) {\n\t\t\t\t\tif (definition.type === 'number' && typeof value === 'string') {\n\t\t\t\t\t\tvalue =\n\t\t\t\t\t\t\tvalue.toLowerCase() === 'ein' ? 1 : value.toLowerCase() === 'aus' ? 0 : parseFloat(value);\n\t\t\t\t\t} else if (definition.type === 'boolean') {\n\t\t\t\t\t\tvalue =\n\t\t\t\t\t\t\tvalue === true ||\n\t\t\t\t\t\t\tvalue === 1 ||\n\t\t\t\t\t\t\tString(value).toLowerCase() === 'ein' ||\n\t\t\t\t\t\t\tString(value).toLowerCase() === 'true';\n\t\t\t\t\t} else if (definition.type === 'json' && typeof value === 'object') {\n\t\t\t\t\t\tvalue = JSON.stringify(value);\n\t\t\t\t\t}\n\n\t\t\t\t\t// INTERNER HACK F\u00DCR DEN LUXTRONIK ANZEIGEFEHLER (1 Sekunde -> 0 Sekunden)\n\t\t\t\t\tlet finalSeconds = Number(value);\n\t\t\t\t\tif (definition.isDurationFormat && key === 'Time_WPein_akt' && finalSeconds === 1) {\n\t\t\t\t\t\tfinalSeconds = 0;\n\t\t\t\t\t}\n\n\t\t\t\t\tif (definition.isDurationFormat) {\n\t\t\t\t\t\tvalue = formatTimerSecondsToTime(finalSeconds);\n\t\t\t\t\t} else if (definition.role && ['value.datetime', 'value.time', 'date'].includes(definition.role)) {\n\t\t\t\t\t\tconst totalSeconds = typeof value === 'number' ? value : parseInt(value as string, 10);\n\t\t\t\t\t\tif (!isNaN(totalSeconds) && totalSeconds >= 0) {\n\t\t\t\t\t\t\tif (totalSeconds < 86400) {\n\t\t\t\t\t\t\t\tconst h = Math.floor(totalSeconds / 3600)\n\t\t\t\t\t\t\t\t\t.toString()\n\t\t\t\t\t\t\t\t\t.padStart(2, '0');\n\t\t\t\t\t\t\t\tconst m = Math.floor((totalSeconds % 3600) / 60)\n\t\t\t\t\t\t\t\t\t.toString()\n\t\t\t\t\t\t\t\t\t.padStart(2, '0');\n\t\t\t\t\t\t\t\tvalue = `${h}:${m}`;\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\tvalue = new Date(totalSeconds * 1000).toISOString().replace('T', ' ').substring(0, 19);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\tlet targetIoBrokerType = definition.type === 'json' ? 'string' : definition.type;\n\n\t\t\t\t\tif (definition.role && ['value.datetime', 'value.time', 'date'].includes(definition.role)) {\n\t\t\t\t\t\ttargetIoBrokerType = 'string';\n\t\t\t\t\t}\n\n\t\t\t\t\tif (targetIoBrokerType === 'string' && typeof value !== 'string') {\n\t\t\t\t\t\tvalue = String(value);\n\t\t\t\t\t} else if (targetIoBrokerType === 'number' && typeof value !== 'number') {\n\t\t\t\t\t\tvalue = Number(value);\n\t\t\t\t\t} else if (targetIoBrokerType === 'boolean' && typeof value !== 'boolean') {\n\t\t\t\t\t\tvalue = Boolean(value);\n\t\t\t\t\t}\n\n\t\t\t\t\tconst stateId = `${definition.folder}.${key}`;\n\t\t\t\t\tstatePromises.push(this.setState(stateId, { val: value, ack: true }));\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tawait Promise.all(statePromises);\n\t\t\tawait calculateTotalThermalEnergy(this);\n\t\t\tawait calculateTotalEnergy(this);\n\n\t\t\tconst fehlerDp = getDpPath('Fehlerspeicher');\n\t\t\tconst oldFehlerState = await this.getStateAsync(fehlerDp);\n\t\t\tconst oldFehlerVal = oldFehlerState?.val as string | undefined;\n\n\t\t\tawait updateErrorHistory(this, rawValues);\n\n\t\t\tconst newFehlerState = await this.getStateAsync(fehlerDp);\n\t\t\tconst newFehlerVal = newFehlerState?.val as string | undefined;\n\n\t\t\tawait checkAndSendErrorNotifications(this, oldFehlerVal, newFehlerVal);\n\n\t\t\tawait updateOutageHistory(this, rawValues);\n\t\t\tawait calculateTemperatureSpread(this);\n\t\t\tawait updateStatusStrings(this, rawValues, rawParams);\n\t\t\tawait updateCustomStates(this, rawValues, rawParams);\n\t\t\tawait updateTimerTables(this);\n\t\t\tawait updateSystemInfos(this, rawValues);\n\t\t\tawait this.runOptimizationSchedule();\n\t\t} catch (err: any) {\n\t\t\tthis.errorCount++;\n\t\t\twriteLog(\n\t\t\t\t`Communication error encountered (${this.errorCount}/${this.MAX_ERRORS}): ${err.message}`,\n\t\t\t\t'error',\n\t\t\t);\n\n\t\t\tif (this.errorCount >= this.MAX_ERRORS) {\n\t\t\t\tawait this.setState('info.connection', { val: false, ack: true });\n\t\t\t\twriteLog('Heat pump controller unreachable. Flagging connection status as disconnected.', 'warn');\n\t\t\t\tsendTelegramNotification(\n\t\t\t\t\tthis,\n\t\t\t\t\t'Heat pump controller unreachable. Flagging connection status as disconnected.',\n\t\t\t\t);\n\t\t\t}\n\t\t} finally {\n\t\t\tthis.updateRunning = false;\n\t\t}\n\t}\n\n\t/**\n\t * Callback issued by the ioBroker framework during adapter shutdown sequences.\n\t *\n\t * @param callback - Termination completion trigger function.\n\t */\n\tprivate onUnload(callback: () => void): void {\n\t\ttry {\n\t\t\tif (this.pollingInterval) {\n\t\t\t\tclearInterval(this.pollingInterval);\n\t\t\t}\n\t\t\tif (this.zipTimer) {\n\t\t\t\tclearTimeout(this.zipTimer);\n\t\t\t}\n\n\t\t\tif (this.midnightTimer) {\n\t\t\t\tthis.clearTimeout(this.midnightTimer);\n\t\t\t}\n\n\t\t\tvoid this.setState('info.connection', { val: false, ack: true });\n\n\t\t\twriteLog(\n\t\t\t\t'Adapter is shutting down. Cleared all active intervals and terminated open socket configurations cleanly.',\n\t\t\t\t'info',\n\t\t\t);\n\t\t\tcallback();\n\t\t} catch {\n\t\t\tcallback();\n\t\t}\n\t}\n\n\t/**\n\t * Central observer callback executed whenever a subscribed state receives an update.\n\t *\n\t * @param id - The explicit full namespaced state identifier path.\n\t * @param state - The newly applied state context or null context if dropped.\n\t * @returns A promise that resolves when operations complete.\n\t */\n\tprivate async onStateChange(id: string, state: ioBroker.State | null | undefined): Promise<void> {\n\t\tif (!state) {\n\t\t\treturn;\n\t\t}\n\n\t\t// Bewegungsmelder an den Manager auslagern\n\t\tconst isMotionSensor = await checkAndHandleMotionSensor(this, id, state);\n\t\tif (isMotionSensor) {\n\t\t\treturn; // Der zipManager hat das Event verarbeitet, wir sind hier fertig\n\t\t}\n\n\t\tif (state.ack) {\n\t\t\treturn;\n\t\t}\n\n\t\tif (id.startsWith(`${this.namespace}.Custom.`)) {\n\t\t\ttry {\n\t\t\t\tconst obj = await this.getObjectAsync(id);\n\n\t\t\t\tif (obj && obj.native && obj.native.source === 'parameter') {\n\t\t\t\t\tconst relativeId = id.replace(`${this.namespace}.`, '');\n\t\t\t\t\tawait this.setState(relativeId, { val: state.val, ack: true });\n\n\t\t\t\t\tlet valueToWrite: any = state.val;\n\n\t\t\t\t\tif (obj.native.customType === 'boolean') {\n\t\t\t\t\t\tvalueToWrite = state.val ? 1 : 0;\n\t\t\t\t\t} else if (obj.native.customType === 'number' && typeof state.val === 'number') {\n\t\t\t\t\t\tif (obj.native.factor) {\n\t\t\t\t\t\t\tvalueToWrite = Math.round(state.val / obj.native.factor);\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tvalueToWrite = Math.round(state.val);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\tconst targetWriteId = parseInt(obj.native.luxId, 10);\n\t\t\t\t\tif (!isNaN(targetWriteId)) {\n\t\t\t\t\t\tif (this.isDebugLogActive) {\n\t\t\t\t\t\t\twriteLog(\n\t\t\t\t\t\t\t\t`Transmitting modified custom configuration parameter ${targetWriteId} to hardware layer with payload value ${valueToWrite}`,\n\t\t\t\t\t\t\t\t'info',\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t}\n\t\t\t\t\t\tawait queueWrite(this, targetWriteId, valueToWrite);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t} catch (err: any) {\n\t\t\t\twriteLog(`Failed to compile custom value parameter adjustment payload write: ${err.message}`, 'error');\n\t\t\t}\n\t\t\treturn;\n\t\t}\n\n\t\tconst mappingKey = id.split('.').pop();\n\t\tif (!mappingKey) {\n\t\t\treturn;\n\t\t}\n\t\tconst definition = STATE_MAPPING[mappingKey];\n\t\tif (!definition) {\n\t\t\treturn;\n\t\t}\n\n\t\ttry {\n\t\t\tconst relativeId = id.replace(`${this.namespace}.`, '');\n\n\t\t\tif (mappingKey === 'Schreibe_Debug_Log') {\n\t\t\t\tawait this.setState(relativeId, { val: state.val, ack: true });\n\n\t\t\t\tthis.isDebugLogActive = state.val === true;\n\t\t\t\tsetCustomDebug(this.isDebugLogActive);\n\t\t\t\twriteLog(\n\t\t\t\t\t`Extended debugging telemetry logging mode has been ${this.isDebugLogActive ? 'enabled' : 'disabled'}.`,\n\t\t\t\t\t'info',\n\t\t\t\t);\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tif (mappingKey === 'Regelung_Aktiv' || mappingKey === 'zip_aktiv') {\n\t\t\t\tawait this.setState(relativeId, { val: state.val, ack: true });\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tif (mappingKey === 'Setze_Vorgabewerte' && state.val === true) {\n\t\t\t\tawait this.setState(relativeId, { val: false, ack: true });\n\t\t\t\tawait this.setIdleDefaults();\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tif (mappingKey === 'Dump_Raw_To_Log' && state.val === true) {\n\t\t\t\tawait this.setState(relativeId, { val: false, ack: true });\n\t\t\t\tawait dumpAllRawToLog(this);\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tif (mappingKey === 'Zwangswarmwasser') {\n\t\t\t\tif (state.val === true) {\n\t\t\t\t\tawait handleZwangswarmwasser(this, id);\n\t\t\t\t}\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tif (mappingKey === 'Zwangsheizen') {\n\t\t\t\tif (state.val === true) {\n\t\t\t\t\tawait handleZwangsheizen(this, id);\n\t\t\t\t}\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tif (mappingKey === 'Activate_Zip') {\n\t\t\t\tif (state.val === true) {\n\t\t\t\t\tconst durationState = await this.getStateAsync(getDpPath('zip_aktiv'));\n\t\t\t\t\tconst durationSeconds =\n\t\t\t\t\t\tdurationState && typeof durationState.val === 'number' ? durationState.val : 120;\n\t\t\t\t\tawait handleActivateZip(this, id, durationSeconds);\n\t\t\t\t} else {\n\t\t\t\t\tawait this.setState(relativeId, { val: false, ack: true });\n\t\t\t\t\tawait stopZipAndDeaeration(this);\n\t\t\t\t}\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tif (!definition.luxWriteId || definition.write !== true) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tawait this.setState(relativeId, { val: state.val, ack: true });\n\n\t\t\tlet valueToWrite: any = state.val;\n\n\t\t\tif (definition.role === 'value.datetime') {\n\t\t\t\tconst valStr = String(state.val).trim();\n\t\t\t\tconst timeMatch = valStr.match(/^(\\d{1,2}):(\\d{1,2})/);\n\t\t\t\tif (timeMatch) {\n\t\t\t\t\tvalueToWrite = parseInt(timeMatch[1], 10) * 3600 + parseInt(timeMatch[2], 10) * 60;\n\t\t\t\t}\n\t\t\t} else if (definition.factor && typeof state.val === 'number') {\n\t\t\t\tvalueToWrite = state.val * definition.factor;\n\t\t\t}\n\n\t\t\tif (definition.unit === '\u00B0C' && typeof state.val === 'number' && !definition.factor) {\n\t\t\t\tvalueToWrite = state.val * 10;\n\t\t\t}\n\n\t\t\tconst targetWriteId = definition.luxWriteId;\n\t\t\tawait queueWrite(this, parseInt(targetWriteId, 10), valueToWrite);\n\t\t} catch (err: any) {\n\t\t\twriteLog(\n\t\t\t\t`Failed to finalize downstream state change command event pipeline execution loop: ${err.message}`,\n\t\t\t\t'error',\n\t\t\t);\n\t\t}\n\t}\n}\n\nif (require.main !== module) {\n\tmodule.exports = (options: Partial<utils.AdapterOptions> | undefined) => new Luxtronik2Controller(options);\n} else {\n\t(() => new Luxtronik2Controller())();\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;AAGA,YAAuB;AACvB,4BAA2D;AAC3D,qBAAyC;AACzC,oBAAqD;AACrD,iCAA4F;AAC5F,2BAOO;AACP,0BAAwD;AACxD,0BAAyC;AACzC,2BAUO;AACP,wBAMO;AAKP,MAAM,6BAA6B,MAAM,QAAQ;AAAA;AAAA,EAEzC,gBAA6B,oBAAI,IAAY;AAAA;AAAA,EAE7C;AAAA;AAAA,EAEA,oBAAgD;AAAA;AAAA,EAEhD,0BAAyC;AAAA;AAAA,EAEzC,mBAA4B;AAAA;AAAA,EAE5B,mBAA6B,CAAC;AAAA;AAAA,EAE7B;AAAA;AAAA,EAEA,YAAoB;AAAA;AAAA,EAEpB,gBAAyB;AAAA;AAAA,EAEzB,uBAA+B;AAAA;AAAA,EAGhC,aAAsC,CAAC;AAAA;AAAA,EAEvC,YAAqB;AAAA;AAAA,EAEpB,aAAqB;AAAA;AAAA,EAEZ,aAAqB;AAAA,EAC/B,mBAA2B;AAAA,EAC3B,mBAA2B;AAAA,EAC1B;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOD,YAAY,UAAyC,CAAC,GAAG;AAC/D,UAAM;AAAA,MACL,GAAG;AAAA,MACH,MAAM;AAAA,IACP,CAAC;AACD,kCAAW,IAAI;AAEf,SAAK,GAAG,SAAS,KAAK,QAAQ,KAAK,IAAI,CAAC;AACxC,SAAK,GAAG,eAAe,KAAK,cAAc,KAAK,IAAI,CAAC;AACpD,SAAK,GAAG,UAAU,KAAK,SAAS,KAAK,IAAI,CAAC;AAC1C,SAAK,GAAG,WAAW,KAAK,UAAU,KAAK,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341
1341
  // Hot Water
1342
1342
  warmwater_temperature: {
1343
1343
  folder: "Settings.03_HotWater",
1344
- name: "Hot water target temperature",
1344
+ name: "Hot water target temperature (Deckung WP ohne ZWE)",
1345
1345
  role: "level.temperature",
1346
1346
  type: "number",
1347
1347
  unit: "\xB0C",
@@ -1355,7 +1355,7 @@ const STATE_MAPPING = {
1355
1355
  },
1356
1356
  temperature_hot_water_target: {
1357
1357
  folder: "Settings.03_HotWater",
1358
- name: "Hot water target temperature (Parameter 105)",
1358
+ name: "Hot water target temperature (Parameter 105) Wunschwert",
1359
1359
  role: "level.temperature",
1360
1360
  type: "number",
1361
1361
  unit: "\xB0C",