iobroker.luxtronik2-controller 0.22.1 → 0.22.3

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
@@ -96,6 +96,52 @@ You might see red error messages in the installation log related to `node-gyp`,
96
96
  //### **WORK IN PROGRESS**
97
97
 
98
98
  ## Changelog
99
+ ### 0.22.3 (2026-11-01)
100
+
101
+ - **Notifications & Alarming:**
102
+ - Fixed an initialization bug where `lastKnownErrorTimestamp` and `lastKnownOutageTimestamp` were not set on adapter startup if the history remained unchanged, which previously caused the first genuine error or outage after a restart to be silently ignored.
103
+ - Decoupled the 60-minute flow warning cooldown (`lastFlowNotificationTime`) from critical heat pump malfunctions so genuine fault alarms are never suppressed by preceding flow warnings.
104
+ - Added language-independent outage code detection (codes 0, 1, 11, 18) alongside text-based fallbacks.
105
+ - **ZIP Circulation Control:**
106
+ - Added a raw parameter fallback (`currentRawParams`) when backing up `originalZipConfig` to prevent timer schedules from being overwritten with `null` if the corresponding timer states are disabled in the object tree.
107
+ - Fixed an issue in `stopZipAndDeaeration` where manually disabling `Activate_Zip` did not stop the hardware deaeration program (`runDeaerate`) by checking `Virtual_ZIP_Status` in addition to the trigger state.
108
+ - **Stability & Helpers:**
109
+ - Wrapped the automated DTA backup cron job initialization (`initAutoBackup`) in a `try/catch` block to prevent startup crashes on malformed cron expressions.
110
+ - Hardened `safeClose` in `ModbusManager` to cleanly terminate sockets even if a connection timeout occurs before the socket is marked as open.
111
+ - Improved input validation in `formatTimerSecondsToTime` (guarding against negative values and `NaN`) and `getNumber` (supporting numeric strings).
112
+
113
+ ### 0.22.2 (2026-11-01)
114
+
115
+ **🐛 Bugfixes & Tweaks**
116
+
117
+ - **Cycle Optimization & PV Integration:** Fixed an issue where the cycle optimization was blocked during an active PV boost. The adapter now correctly forces seamless transitions between heating and hot water (without compressor shutdown and anti-cycle delays) even when solar surplus is available. A new handshake mechanism ensures that PV target temperatures are immediately and safely restored after the cycle optimization resets the baseline idle defaults.
118
+
119
+ - **PV Surplus Management & Compressor Optimization:**
120
+ - Fixed read-only datapoint errors in `activateBoost` and `deactivateBoost` (now correctly targeting `temperature_hot_water_target`).
121
+ - Resolved baseline configuration mix-ups between `fusspunkt` and the heating parallel offset (`heating_temperature`).
122
+ - Fixed the heating saturation check (`isHzFull`) to prevent premature boost revocation.
123
+ - Implemented a seamless "PV-Boost Handshake" allowing cycle optimization to force hot water transitions even during active solar surplus without triggering anti-cycle compressor delays.
124
+
125
+ - **ZIP Circulation & Timer Logic:**
126
+ - Fixed a bug where hot water timer slots (`WW_MoSo_...`) were mistakenly backed up and overwritten instead of circulation pump slots (`Zirkulation_MoSo_...`).
127
+ - Improved time string conversions and state restoration robustness.
128
+ - **COP Calculation & Virtual States:**
129
+ - Fixed a UTC timezone offset in daily rollovers so COP snapshots trigger precisely at local midnight.
130
+ - Included defrosting cycles (`WP_BZ_akt = 4`) into the heating COP calculations and added clamping protection against negative energy deltas.
131
+ - Added an in-memory object cache (`ensuredObjects`) to drastically reduce redundant database write calls.
132
+ - Added a raw value fallback for total energy and thermal energy calculations if individual states are disabled in the object tree.
133
+ - **Modbus & Raw Communication Stability:**
134
+ - Implemented a strict serial operation queue (mutex) with a 50ms release delay in `ModbusManager` to prevent TCP port 502 connection collisions.
135
+ - Added a 30-second request timeout (`AbortSignal.timeout`) to DTA backups and corrected file naming for fallback paths (`dta_history`).
136
+ - Expanded firmware version regex in `updateManager` to support `F1.`, `WWB`, and `smo` firmware formats.
137
+ - Added socket `close` event listeners and safe number roundings for raw write operations.
138
+ - **Repository Compliance & Maintenance:**
139
+ - Added complete multi-language translations (i18n) for all configuration dropdown menus to meet strict ioBroker stable repository requirements.
140
+ - Cleaned up unpublished ghost versions from the `io-package.json` news section.
141
+ - Standardized the README changelog header format (`## Changelog`).
142
+
143
+ - **Repository Compliance:** Added missing multi-language translations (i18n) for all configuration dropdown menus (e.g. COP sources, PV modes) to meet strict ioBroker stable repository requirements.
144
+
99
145
  ### 0.22.1 (2026-10-28)
100
146
 
101
147
  **🔧 Maintenance & Compatibility**
@@ -121,32 +167,6 @@ You might see red error messages in the installation log related to `node-gyp`,
121
167
  - **COP Calculation Accuracy:** Fixed a UTC timezone offset in the daily rollover check so COP snapshots occur accurately at local midnight (00:00). Included defrosting cycles (`WP_BZ_akt = 4`) in the heating COP bucket and added clamping against negative deltas if external energy meters are reset.
122
168
  - **Object Management & Virtual States:** Removed a redundant loop in `onReady` that recreated disabled virtual datapoints on startup, and fixed `PREFIX_MAPPING` for weekend timer tables (`SaSo`) to properly reference the `52SatSun` configuration flags.
123
169
 
124
- ### 0.21.0 (2026-10-26)
125
-
126
- **🚀 New Features**
127
-
128
- - **PV Surplus Management (PV-Ready):** Introduced a fully integrated, automated PV surplus control system.
129
- - **PV Hysteresis Control:** Added a dedicated stop threshold (`pv_threshold_stop`) to the PV surplus manager. This prevents the heat pump from cancelling its own boost cycle by consuming the solar surplus (feedback loop). The system now supports independent start and stop boundaries (Schmitt trigger logic).
130
- - **Dynamic Setpoint Boost:** Automatically raises hot water and heating setpoints (wear-free via Modbus RAM) based on your current grid feed-in.
131
- - **Smart Timers:** Includes customizable start and stop delay timers to prevent compressor short-cycling during variable cloud cover.
132
- - **Cycle Protection:** Added a "finish cycle" safety feature. If the solar surplus drops, the adapter intelligently waits for an active heating or hot water cycle to finish before reverting the setpoints, protecting the compressor hardware.
133
- - **PV Telemetry:** Added three new virtual datapoints under `Information.17_PV_Surplus` (`pv_boost_active`, `pv_boost_active_since`, and `pv_boost_last_activation`) to make the current surplus control status transparently available for external ioBroker visualizations.
134
- - **Battery Prioritization (PV):** Added an optional feature to include your home battery's charging power into the PV surplus calculation. This allows you to treat the heat pump as the primary thermal battery, intercepting the solar power to heat up the house or hot water _before_ it flows into your chemical battery.
135
-
136
- **🐛 Bugfixes & Tweaks**
137
-
138
- - **Cycle Optimization vs. PV Logic:** Fixed an edge-case bug where a temporary high target temperature from the cycle optimization module leaked into the PV surplus manager if the heat pump skipped the standby/idle state. The adapter now explicitly resets cross-cycle targets and forces the PV manager to reference the secure baseline configuration limits.
139
- - **Modbus Stability:** Fixed a critical race condition in the Modbus manager. Concurrent read and write operations no longer share a single global client, preventing connection collisions and adapter crashes during hybrid mode operations.
140
- - **API Modernization:** Replaced deprecated `setStateAsync` calls in the PV manager with the modern Promise-based `setState` API to comply with the latest ioBroker adapter guidelines and resolve TypeScript warnings.
141
- - **Unit Conversion:** The PV feed-in datapoint now natively supports kilowatts (kW) via a new toggle in the configuration UI, automatically converting it to Watts internally.
142
- - **Admin UI Polish:** Replaced HTML-based information blocks in the configuration UI with native ioBroker JSON components to bypass React XSS-filtering issues and ensure clean rendering.
143
-
144
- ### 0.20.4 (2026-10-24)
145
-
146
- **🔧 Maintenance & Compatibility**
147
-
148
- - **Node.js Requirement:** Updated minimum Node.js requirement to `>= 22` in `package.json` and `io-package.json` to meet current adapter standards.
149
-
150
170
  ## License
151
171
 
152
172
  MIT License
@@ -40,10 +40,15 @@ function initAutoBackup(adapter) {
40
40
  const config = adapter.config;
41
41
  stopAutoBackup(adapter);
42
42
  if (config.autoBackupActive && config.autoBackupCron) {
43
- (0, import_logger.writeLog)(`Initializing automated DTA backup with cron schedule: ${config.autoBackupCron}`, "info");
44
- adapter.backupJob = schedule.scheduleJob(config.autoBackupCron, async () => {
45
- await executeDtaBackup(adapter);
46
- });
43
+ try {
44
+ (0, import_logger.writeLog)(`Initializing automated DTA backup with cron schedule: ${config.autoBackupCron}`, "info");
45
+ adapter.backupJob = schedule.scheduleJob(String(config.autoBackupCron).trim(), async () => {
46
+ await executeDtaBackup(adapter);
47
+ });
48
+ } catch (err) {
49
+ const msg = err instanceof Error ? err.message : String(err);
50
+ (0, import_logger.writeLog)(`Failed to initialize DTA backup cron (${config.autoBackupCron}): ${msg}`, "error");
51
+ }
47
52
  }
48
53
  }
49
54
  async function executeDtaBackup(adapter) {
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../src/backupManager.ts"],
4
- "sourcesContent": ["import * as schedule from 'node-schedule';\nimport { writeLog } from './logger';\nimport type { LuxtronikAdapter } from './types';\n\nconst BACKUP_TIMEOUT_MS = 30000;\n\n/**\n * Initialisiert den automatischen Backup-Zeitplan basierend auf der ioBroker-Konfiguration.\n *\n * @param adapter Die ioBroker Adapter-Instanz\n */\nexport function initAutoBackup(adapter: LuxtronikAdapter): void {\n\tconst config = adapter.config;\n\tstopAutoBackup(adapter);\n\n\tif (config.autoBackupActive && config.autoBackupCron) {\n\t\twriteLog(`Initializing automated DTA backup with cron schedule: ${config.autoBackupCron}`, 'info');\n\t\tadapter.backupJob = schedule.scheduleJob(config.autoBackupCron, async () => {\n\t\t\tawait executeDtaBackup(adapter);\n\t\t});\n\t}\n}\n\n/**\n * F\u00FChrt den automatischen DTA-Download von der Luxtronik-W\u00E4rmepumpe aus\n * und speichert die Datei sicher im globalen ioBroker-Dateisystem (0_userdata.0).\n * Nutzt prim\u00E4r den direkten Datei-Stream \u00FCber /NewProc ohne k\u00FCnstliche Verz\u00F6gerung.\n *\n * @param adapter Die ioBroker Adapter-Instanz (f\u00FCr Konfiguration, Logs und Dateisystemzugriff)\n * @returns Ein Promise, das nach Abschluss des Downloads aufgel\u00F6st wird\n */\nexport async function executeDtaBackup(adapter: LuxtronikAdapter): Promise<void> {\n\tconst config = adapter.config;\n\tconst ip = config.host;\n\n\tif (!ip) {\n\t\twriteLog('Backup aborted: No IP address configured.', 'warn');\n\t\treturn;\n\t}\n\n\ttry {\n\t\twriteLog('Fetching live DTA file (/NewProc)...', 'debug');\n\n\t\tlet isLive = true;\n\t\tlet arrayBuffer: ArrayBuffer | null = null;\n\n\t\t// 1. NewProc liefert den DTA-Speicher als direkten Datei-Stream (mit 30s Timeout)\n\t\tlet response = await fetch(`http://${ip}/NewProc`, {\n\t\t\tsignal: AbortSignal.timeout(BACKUP_TIMEOUT_MS),\n\t\t}).catch(() => null);\n\n\t\tif (response && response.ok) {\n\t\t\tarrayBuffer = await response.arrayBuffer();\n\t\t}\n\n\t\t// 2. Fallback auf /procdta, falls NewProc leer ist oder fehlt\n\t\tif (!arrayBuffer || arrayBuffer.byteLength < 1000) {\n\t\t\twriteLog('/NewProc did not return a valid file. Trying /procdta...', 'debug');\n\t\t\tisLive = false;\n\t\t\tresponse = await fetch(`http://${ip}/procdta`, {\n\t\t\t\tsignal: AbortSignal.timeout(BACKUP_TIMEOUT_MS),\n\t\t\t}).catch(() => null);\n\n\t\t\tif (response && response.ok) {\n\t\t\t\tarrayBuffer = await response.arrayBuffer();\n\t\t\t}\n\t\t}\n\n\t\tif (!arrayBuffer || arrayBuffer.byteLength < 1000) {\n\t\t\tthrow new Error(`HTTP Error - No valid DTA file found on heat pump webserver.`);\n\t\t}\n\n\t\t// 3. Datei f\u00FCr das Dateisystem vorbereiten\n\t\tconst buffer = Buffer.from(arrayBuffer);\n\t\tconst now = new Date();\n\t\tconst y = now.getFullYear();\n\t\tconst m = String(now.getMonth() + 1).padStart(2, '0');\n\t\tconst d = String(now.getDate()).padStart(2, '0');\n\t\tconst h = String(now.getHours()).padStart(2, '0');\n\t\tconst min = String(now.getMinutes()).padStart(2, '0');\n\t\tconst s = String(now.getSeconds()).padStart(2, '0');\n\t\tconst timestamp = `${y}-${m}-${d}T${h}-${min}-${s}`;\n\t\tconst filePrefix = isLive ? 'dta_live' : 'dta_history';\n\n\t\tconst targetId = '0_userdata.0';\n\t\tconst fileName = `luxtronik_backups/${filePrefix}_${timestamp}.dta`;\n\n\t\t// Speichern im ioBroker-Dateisystem\n\t\tawait adapter.writeFileAsync(targetId, fileName, buffer);\n\n\t\tadapter.log.info(`DTA Backup successfully saved as ${fileName} in folder ${targetId}.`);\n\t} catch (err: unknown) {\n\t\tconst msg = err instanceof Error ? err.message : String(err);\n\t\twriteLog(`Failed to execute automated DTA backup: ${msg}`, 'error');\n\t}\n}\n\n/**\n * Stoppt den laufenden Cronjob (wichtig f\u00FCr den Adapter-Neustart).\n *\n * @param adapter Die ioBroker Adapter-Instanz\n */\nexport function stopAutoBackup(adapter: LuxtronikAdapter): void {\n\tif (adapter.backupJob) {\n\t\tadapter.backupJob.cancel();\n\t\tadapter.backupJob = null;\n\t\twriteLog('Automated DTA backup schedule stopped.', 'debug');\n\t}\n}\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,eAA0B;AAC1B,oBAAyB;AAGzB,MAAM,oBAAoB;AAOnB,SAAS,eAAe,SAAiC;AAC/D,QAAM,SAAS,QAAQ;AACvB,iBAAe,OAAO;AAEtB,MAAI,OAAO,oBAAoB,OAAO,gBAAgB;AACrD,gCAAS,yDAAyD,OAAO,cAAc,IAAI,MAAM;AACjG,YAAQ,YAAY,SAAS,YAAY,OAAO,gBAAgB,YAAY;AAC3E,YAAM,iBAAiB,OAAO;AAAA,IAC/B,CAAC;AAAA,EACF;AACD;AAUA,eAAsB,iBAAiB,SAA0C;AAChF,QAAM,SAAS,QAAQ;AACvB,QAAM,KAAK,OAAO;AAElB,MAAI,CAAC,IAAI;AACR,gCAAS,6CAA6C,MAAM;AAC5D;AAAA,EACD;AAEA,MAAI;AACH,gCAAS,wCAAwC,OAAO;AAExD,QAAI,SAAS;AACb,QAAI,cAAkC;AAGtC,QAAI,WAAW,MAAM,MAAM,UAAU,EAAE,YAAY;AAAA,MAClD,QAAQ,YAAY,QAAQ,iBAAiB;AAAA,IAC9C,CAAC,EAAE,MAAM,MAAM,IAAI;AAEnB,QAAI,YAAY,SAAS,IAAI;AAC5B,oBAAc,MAAM,SAAS,YAAY;AAAA,IAC1C;AAGA,QAAI,CAAC,eAAe,YAAY,aAAa,KAAM;AAClD,kCAAS,4DAA4D,OAAO;AAC5E,eAAS;AACT,iBAAW,MAAM,MAAM,UAAU,EAAE,YAAY;AAAA,QAC9C,QAAQ,YAAY,QAAQ,iBAAiB;AAAA,MAC9C,CAAC,EAAE,MAAM,MAAM,IAAI;AAEnB,UAAI,YAAY,SAAS,IAAI;AAC5B,sBAAc,MAAM,SAAS,YAAY;AAAA,MAC1C;AAAA,IACD;AAEA,QAAI,CAAC,eAAe,YAAY,aAAa,KAAM;AAClD,YAAM,IAAI,MAAM,8DAA8D;AAAA,IAC/E;AAGA,UAAM,SAAS,OAAO,KAAK,WAAW;AACtC,UAAM,MAAM,oBAAI,KAAK;AACrB,UAAM,IAAI,IAAI,YAAY;AAC1B,UAAM,IAAI,OAAO,IAAI,SAAS,IAAI,CAAC,EAAE,SAAS,GAAG,GAAG;AACpD,UAAM,IAAI,OAAO,IAAI,QAAQ,CAAC,EAAE,SAAS,GAAG,GAAG;AAC/C,UAAM,IAAI,OAAO,IAAI,SAAS,CAAC,EAAE,SAAS,GAAG,GAAG;AAChD,UAAM,MAAM,OAAO,IAAI,WAAW,CAAC,EAAE,SAAS,GAAG,GAAG;AACpD,UAAM,IAAI,OAAO,IAAI,WAAW,CAAC,EAAE,SAAS,GAAG,GAAG;AAClD,UAAM,YAAY,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;AACjD,UAAM,aAAa,SAAS,aAAa;AAEzC,UAAM,WAAW;AACjB,UAAM,WAAW,qBAAqB,UAAU,IAAI,SAAS;AAG7D,UAAM,QAAQ,eAAe,UAAU,UAAU,MAAM;AAEvD,YAAQ,IAAI,KAAK,oCAAoC,QAAQ,cAAc,QAAQ,GAAG;AAAA,EACvF,SAAS,KAAc;AACtB,UAAM,MAAM,eAAe,QAAQ,IAAI,UAAU,OAAO,GAAG;AAC3D,gCAAS,2CAA2C,GAAG,IAAI,OAAO;AAAA,EACnE;AACD;AAOO,SAAS,eAAe,SAAiC;AAC/D,MAAI,QAAQ,WAAW;AACtB,YAAQ,UAAU,OAAO;AACzB,YAAQ,YAAY;AACpB,gCAAS,0CAA0C,OAAO;AAAA,EAC3D;AACD;",
4
+ "sourcesContent": ["import * as schedule from 'node-schedule';\nimport { writeLog } from './logger';\nimport type { LuxtronikAdapter } from './types';\n\nconst BACKUP_TIMEOUT_MS = 30000;\n\n/**\n * Initialisiert den automatischen Backup-Zeitplan basierend auf der ioBroker-Konfiguration.\n *\n * @param adapter Die ioBroker Adapter-Instanz\n */\nexport function initAutoBackup(adapter: LuxtronikAdapter): void {\n\tconst config = adapter.config;\n\tstopAutoBackup(adapter);\n\n\tif (config.autoBackupActive && config.autoBackupCron) {\n\t\ttry {\n\t\t\twriteLog(`Initializing automated DTA backup with cron schedule: ${config.autoBackupCron}`, 'info');\n\t\t\tadapter.backupJob = schedule.scheduleJob(String(config.autoBackupCron).trim(), async () => {\n\t\t\t\tawait executeDtaBackup(adapter);\n\t\t\t});\n\t\t} catch (err: unknown) {\n\t\t\tconst msg = err instanceof Error ? err.message : String(err);\n\t\t\twriteLog(`Failed to initialize DTA backup cron (${config.autoBackupCron}): ${msg}`, 'error');\n\t\t}\n\t}\n}\n\n/**\n * F\u00FChrt den automatischen DTA-Download von der Luxtronik-W\u00E4rmepumpe aus\n * und speichert die Datei sicher im globalen ioBroker-Dateisystem (0_userdata.0).\n * Nutzt prim\u00E4r den direkten Datei-Stream \u00FCber /NewProc ohne k\u00FCnstliche Verz\u00F6gerung.\n *\n * @param adapter Die ioBroker Adapter-Instanz (f\u00FCr Konfiguration, Logs und Dateisystemzugriff)\n * @returns Ein Promise, das nach Abschluss des Downloads aufgel\u00F6st wird\n */\nexport async function executeDtaBackup(adapter: LuxtronikAdapter): Promise<void> {\n\tconst config = adapter.config;\n\tconst ip = config.host;\n\n\tif (!ip) {\n\t\twriteLog('Backup aborted: No IP address configured.', 'warn');\n\t\treturn;\n\t}\n\n\ttry {\n\t\twriteLog('Fetching live DTA file (/NewProc)...', 'debug');\n\n\t\tlet isLive = true;\n\t\tlet arrayBuffer: ArrayBuffer | null = null;\n\n\t\t// 1. NewProc liefert den DTA-Speicher als direkten Datei-Stream (mit 30s Timeout)\n\t\tlet response = await fetch(`http://${ip}/NewProc`, {\n\t\t\tsignal: AbortSignal.timeout(BACKUP_TIMEOUT_MS),\n\t\t}).catch(() => null);\n\n\t\tif (response && response.ok) {\n\t\t\tarrayBuffer = await response.arrayBuffer();\n\t\t}\n\n\t\t// 2. Fallback auf /procdta, falls NewProc leer ist oder fehlt\n\t\tif (!arrayBuffer || arrayBuffer.byteLength < 1000) {\n\t\t\twriteLog('/NewProc did not return a valid file. Trying /procdta...', 'debug');\n\t\t\tisLive = false;\n\t\t\tresponse = await fetch(`http://${ip}/procdta`, {\n\t\t\t\tsignal: AbortSignal.timeout(BACKUP_TIMEOUT_MS),\n\t\t\t}).catch(() => null);\n\n\t\t\tif (response && response.ok) {\n\t\t\t\tarrayBuffer = await response.arrayBuffer();\n\t\t\t}\n\t\t}\n\n\t\tif (!arrayBuffer || arrayBuffer.byteLength < 1000) {\n\t\t\tthrow new Error(`HTTP Error - No valid DTA file found on heat pump webserver.`);\n\t\t}\n\n\t\t// 3. Datei f\u00FCr das Dateisystem vorbereiten\n\t\tconst buffer = Buffer.from(arrayBuffer);\n\t\tconst now = new Date();\n\t\tconst y = now.getFullYear();\n\t\tconst m = String(now.getMonth() + 1).padStart(2, '0');\n\t\tconst d = String(now.getDate()).padStart(2, '0');\n\t\tconst h = String(now.getHours()).padStart(2, '0');\n\t\tconst min = String(now.getMinutes()).padStart(2, '0');\n\t\tconst s = String(now.getSeconds()).padStart(2, '0');\n\t\tconst timestamp = `${y}-${m}-${d}T${h}-${min}-${s}`;\n\t\tconst filePrefix = isLive ? 'dta_live' : 'dta_history';\n\n\t\tconst targetId = '0_userdata.0';\n\t\tconst fileName = `luxtronik_backups/${filePrefix}_${timestamp}.dta`;\n\n\t\t// Speichern im ioBroker-Dateisystem\n\t\tawait adapter.writeFileAsync(targetId, fileName, buffer);\n\n\t\tadapter.log.info(`DTA Backup successfully saved as ${fileName} in folder ${targetId}.`);\n\t} catch (err: unknown) {\n\t\tconst msg = err instanceof Error ? err.message : String(err);\n\t\twriteLog(`Failed to execute automated DTA backup: ${msg}`, 'error');\n\t}\n}\n\n/**\n * Stoppt den laufenden Cronjob (wichtig f\u00FCr den Adapter-Neustart).\n *\n * @param adapter Die ioBroker Adapter-Instanz\n */\nexport function stopAutoBackup(adapter: LuxtronikAdapter): void {\n\tif (adapter.backupJob) {\n\t\tadapter.backupJob.cancel();\n\t\tadapter.backupJob = null;\n\t\twriteLog('Automated DTA backup schedule stopped.', 'debug');\n\t}\n}\n"],
5
+ "mappings": "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",
6
6
  "names": []
7
7
  }
package/build/convert.js CHANGED
@@ -36,9 +36,10 @@ function timeStringToSeconds(timeStr) {
36
36
  return 0;
37
37
  }
38
38
  function formatTimerSecondsToTime(totalSeconds) {
39
- const hours = Math.floor(totalSeconds / 3600);
40
- const minutes = Math.floor(totalSeconds % 3600 / 60);
41
- const seconds = totalSeconds % 60;
39
+ const safeSeconds = Math.max(0, Math.floor(Number(totalSeconds) || 0));
40
+ const hours = Math.floor(safeSeconds / 3600);
41
+ const minutes = Math.floor(safeSeconds % 3600 / 60);
42
+ const seconds = safeSeconds % 60;
42
43
  return `${String(hours).padStart(2, "0")}:${String(minutes).padStart(2, "0")}:${String(seconds).padStart(2, "0")}`;
43
44
  }
44
45
  // Annotate the CommonJS export names for ESM import in node:
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../src/convert.ts"],
4
- "sourcesContent": ["/**\n * Konvertiert einen ioBroker Zeit-String (HH:MM oder HH:MM:SS) in reine Luxtronik-Sekunden.\n *\n * @param timeStr Der Zeitstring aus dem ioBroker State\n * @returns Die Zeit in Sekunden seit Mitternacht\n */\nexport function timeStringToSeconds(timeStr: unknown): number {\n\tif (typeof timeStr !== 'string') {\n\t\treturn 0;\n\t}\n\tconst timeMatch = timeStr.match(/^(\\d{1,2}):(\\d{1,2})(?::(\\d{1,2}))?/);\n\tif (timeMatch) {\n\t\tconst h = parseInt(timeMatch[1], 10) || 0;\n\t\tconst m = parseInt(timeMatch[2], 10) || 0;\n\t\tconst s = parseInt(timeMatch[3], 10) || 0;\n\t\treturn h * 3600 + m * 60 + s;\n\t}\n\treturn 0;\n}\n\n/**\n * Verwandelt Luxtronik-Rohsekunden (z.B. 60) in einen HH:MM:SS String (z.B. \"00:01:00\").\n * N\u00FCtzlich, falls du Rohwerte manuell formatieren musst.\n *\n * @param totalSeconds Die Sekunden seit Mitternacht\n * @returns Ein formattierter String im Format HH:MM:SS\n */\nexport function formatTimerSecondsToTime(totalSeconds: number): string {\n\tconst hours = Math.floor(totalSeconds / 3600);\n\tconst minutes = Math.floor((totalSeconds % 3600) / 60);\n\tconst seconds = totalSeconds % 60;\n\treturn `${String(hours).padStart(2, '0')}:${String(minutes).padStart(2, '0')}:${String(seconds).padStart(2, '0')}`;\n}\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAMO,SAAS,oBAAoB,SAA0B;AAC7D,MAAI,OAAO,YAAY,UAAU;AAChC,WAAO;AAAA,EACR;AACA,QAAM,YAAY,QAAQ,MAAM,qCAAqC;AACrE,MAAI,WAAW;AACd,UAAM,IAAI,SAAS,UAAU,CAAC,GAAG,EAAE,KAAK;AACxC,UAAM,IAAI,SAAS,UAAU,CAAC,GAAG,EAAE,KAAK;AACxC,UAAM,IAAI,SAAS,UAAU,CAAC,GAAG,EAAE,KAAK;AACxC,WAAO,IAAI,OAAO,IAAI,KAAK;AAAA,EAC5B;AACA,SAAO;AACR;AASO,SAAS,yBAAyB,cAA8B;AACtE,QAAM,QAAQ,KAAK,MAAM,eAAe,IAAI;AAC5C,QAAM,UAAU,KAAK,MAAO,eAAe,OAAQ,EAAE;AACrD,QAAM,UAAU,eAAe;AAC/B,SAAO,GAAG,OAAO,KAAK,EAAE,SAAS,GAAG,GAAG,CAAC,IAAI,OAAO,OAAO,EAAE,SAAS,GAAG,GAAG,CAAC,IAAI,OAAO,OAAO,EAAE,SAAS,GAAG,GAAG,CAAC;AACjH;",
4
+ "sourcesContent": ["/**\n * Konvertiert einen ioBroker Zeit-String (HH:MM oder HH:MM:SS) in reine Luxtronik-Sekunden.\n *\n * @param timeStr Der Zeitstring aus dem ioBroker State\n * @returns Die Zeit in Sekunden seit Mitternacht\n */\nexport function timeStringToSeconds(timeStr: unknown): number {\n\tif (typeof timeStr !== 'string') {\n\t\treturn 0;\n\t}\n\tconst timeMatch = timeStr.match(/^(\\d{1,2}):(\\d{1,2})(?::(\\d{1,2}))?/);\n\tif (timeMatch) {\n\t\tconst h = parseInt(timeMatch[1], 10) || 0;\n\t\tconst m = parseInt(timeMatch[2], 10) || 0;\n\t\tconst s = parseInt(timeMatch[3], 10) || 0;\n\t\treturn h * 3600 + m * 60 + s;\n\t}\n\treturn 0;\n}\n\n/**\n * Verwandelt Luxtronik-Rohsekunden (z.B. 60) in einen HH:MM:SS String (z.B. \"00:01:00\").\n * N\u00FCtzlich, falls du Rohwerte manuell formatieren musst.\n *\n * @param totalSeconds Die Sekunden seit Mitternacht\n * @returns Ein formattierter String im Format HH:MM:SS\n */\nexport function formatTimerSecondsToTime(totalSeconds: number): string {\n\tconst safeSeconds = Math.max(0, Math.floor(Number(totalSeconds) || 0));\n\tconst hours = Math.floor(safeSeconds / 3600);\n\tconst minutes = Math.floor((safeSeconds % 3600) / 60);\n\tconst seconds = safeSeconds % 60;\n\treturn `${String(hours).padStart(2, '0')}:${String(minutes).padStart(2, '0')}:${String(seconds).padStart(2, '0')}`;\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAMO,SAAS,oBAAoB,SAA0B;AAC7D,MAAI,OAAO,YAAY,UAAU;AAChC,WAAO;AAAA,EACR;AACA,QAAM,YAAY,QAAQ,MAAM,qCAAqC;AACrE,MAAI,WAAW;AACd,UAAM,IAAI,SAAS,UAAU,CAAC,GAAG,EAAE,KAAK;AACxC,UAAM,IAAI,SAAS,UAAU,CAAC,GAAG,EAAE,KAAK;AACxC,UAAM,IAAI,SAAS,UAAU,CAAC,GAAG,EAAE,KAAK;AACxC,WAAO,IAAI,OAAO,IAAI,KAAK;AAAA,EAC5B;AACA,SAAO;AACR;AASO,SAAS,yBAAyB,cAA8B;AACtE,QAAM,cAAc,KAAK,IAAI,GAAG,KAAK,MAAM,OAAO,YAAY,KAAK,CAAC,CAAC;AACrE,QAAM,QAAQ,KAAK,MAAM,cAAc,IAAI;AAC3C,QAAM,UAAU,KAAK,MAAO,cAAc,OAAQ,EAAE;AACpD,QAAM,UAAU,cAAc;AAC9B,SAAO,GAAG,OAAO,KAAK,EAAE,SAAS,GAAG,GAAG,CAAC,IAAI,OAAO,OAAO,EAAE,SAAS,GAAG,GAAG,CAAC,IAAI,OAAO,OAAO,EAAE,SAAS,GAAG,GAAG,CAAC;AACjH;",
6
6
  "names": []
7
7
  }
@@ -40,13 +40,13 @@ async function handleHupOptimization(adapter, istHeizen, spreizung, hupAktiv, la
40
40
  } catch {
41
41
  }
42
42
  const now = Date.now();
43
- const checkIntervalMs = ((_a = config.hup_interval_min) != null ? _a : 10) * 6e4;
43
+ const checkIntervalMs = Number((_a = config.hup_interval_min) != null ? _a : 10) * 6e4;
44
44
  if (now - lastPumpOptimization > checkIntervalMs) {
45
- const minSpreizung = (_b = config.hup_spreizung_min) != null ? _b : 6.5;
46
- const maxSpreizung = (_c = config.hup_spreizung_max) != null ? _c : 7.5;
47
- const step = (_d = config.hup_voltage_step) != null ? _d : 0.25;
48
- const minVolt = (_e = config.hup_voltage_limit_min) != null ? _e : 3;
49
- const maxVolt = (_f = config.hup_voltage_limit_max) != null ? _f : 10;
45
+ const minSpreizung = Number((_b = config.hup_spreizung_min) != null ? _b : 6.5);
46
+ const maxSpreizung = Number((_c = config.hup_spreizung_max) != null ? _c : 7.5);
47
+ const step = Number((_d = config.hup_voltage_step) != null ? _d : 0.25);
48
+ const minVolt = Number((_e = config.hup_voltage_limit_min) != null ? _e : 3);
49
+ const maxVolt = Number((_f = config.hup_voltage_limit_max) != null ? _f : 10);
50
50
  if (spreizung < minSpreizung && hupAktiv > minVolt) {
51
51
  const newVolt = Math.max(minVolt, Math.round((hupAktiv - step) * 100) / 100);
52
52
  await adapter.syncConfigValue("heating_system_circ_pump_voltage_nominal", newVolt);
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../src/hupManager.ts"],
4
- "sourcesContent": ["import { writeLog } from './logger';\nimport { getDpPath } from './stateMapping';\nimport type { LuxtronikAdapter } from './types';\n\n/**\n * \u00DCbernimmt die dynamische Regelung der Heizungsumw\u00E4lzpumpe (HUP) anhand der Spreizung.\n *\n * @param adapter - Die erweiterte Adapter-Instanz\n * @param istHeizen - Boolean, ob sich die Anlage aktuell im Heizbetrieb befindet\n * @param spreizung - Die aktuell berechnete Temperaturspreizung (Vorlauf - R\u00FCcklauf)\n * @param hupAktiv - Die aktuell anliegende Nominalspannung der HUP\n * @param lastPumpOptimization - Timestamp der letzten Anpassung (f\u00FCr Intervall-Sperre)\n * @returns Den aktualisierten Timestamp der letzten Anpassung\n */\nexport async function handleHupOptimization(\n\tadapter: LuxtronikAdapter,\n\tistHeizen: boolean,\n\tspreizung: number,\n\thupAktiv: number,\n\tlastPumpOptimization: number,\n): Promise<number> {\n\tconst config = adapter.config;\n\n\t// Abbruch, wenn nicht geheizt wird oder das Feature deaktiviert ist\n\tif (!istHeizen || config.hup_optimierung_aktiv !== true) {\n\t\treturn lastPumpOptimization;\n\t}\n\n\t// Erkennung einer PWM-Pumpe. Wenn Max-Speed > 0 konfiguriert ist,\n\t// handelt es sich um eine PWM-Pumpe. Die 0-10V Optimierung ist hier nutzlos!\n\ttry {\n\t\tconst maxPwmState = await adapter.getStateAsync(getDpPath('heating_max_circ_pump_speed'));\n\t\tif (maxPwmState && typeof maxPwmState.val === 'number' && maxPwmState.val > 0) {\n\t\t\tif (adapter.isDebugLogActive) {\n\t\t\t\twriteLog('HUP: PWM-Pumpe erkannt (max_speed > 0). 0-10V Optimierung wird \u00FCbersprungen.', 'debug');\n\t\t\t}\n\t\t\treturn lastPumpOptimization; // Abbruch!\n\t\t}\n\t} catch {\n\t\t// Fehler beim Lesen ignorieren und sicherheitshalber weitermachen\n\t}\n\n\tconst now = Date.now();\n\tconst checkIntervalMs = (config.hup_interval_min ?? 10) * 60000;\n\n\t// Pr\u00FCfen, ob das Schutz-Intervall abgelaufen ist\n\tif (now - lastPumpOptimization > checkIntervalMs) {\n\t\tconst minSpreizung = config.hup_spreizung_min ?? 6.5;\n\t\tconst maxSpreizung = config.hup_spreizung_max ?? 7.5;\n\t\tconst step = config.hup_voltage_step ?? 0.25;\n\t\tconst minVolt = config.hup_voltage_limit_min ?? 3.0;\n\t\tconst maxVolt = config.hup_voltage_limit_max ?? 10.0;\n\n\t\tif (spreizung < minSpreizung && hupAktiv > minVolt) {\n\t\t\tconst newVolt = Math.max(minVolt, Math.round((hupAktiv - step) * 100) / 100);\n\t\t\tawait adapter.syncConfigValue('heating_system_circ_pump_voltage_nominal', newVolt);\n\t\t\twriteLog(\n\t\t\t\t`HUP: Temperature spread too low (${spreizung}K < ${minSpreizung}K). Scaling nominal voltage down to ${newVolt}V.`,\n\t\t\t\t'info',\n\t\t\t);\n\t\t\treturn now;\n\t\t} else if (spreizung > maxSpreizung && hupAktiv < maxVolt) {\n\t\t\tconst newVolt = Math.min(maxVolt, Math.round((hupAktiv + step) * 100) / 100);\n\t\t\tawait adapter.syncConfigValue('heating_system_circ_pump_voltage_nominal', newVolt);\n\t\t\twriteLog(\n\t\t\t\t`HUP: Temperature spread too high (${spreizung}K > ${maxSpreizung}K). Scaling nominal voltage up to ${newVolt}V.`,\n\t\t\t\t'info',\n\t\t\t);\n\t\t\treturn now;\n\t\t}\n\t}\n\n\treturn lastPumpOptimization;\n}\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,oBAAyB;AACzB,0BAA0B;AAa1B,eAAsB,sBACrB,SACA,WACA,WACA,UACA,sBACkB;AApBnB;AAqBC,QAAM,SAAS,QAAQ;AAGvB,MAAI,CAAC,aAAa,OAAO,0BAA0B,MAAM;AACxD,WAAO;AAAA,EACR;AAIA,MAAI;AACH,UAAM,cAAc,MAAM,QAAQ,kBAAc,+BAAU,6BAA6B,CAAC;AACxF,QAAI,eAAe,OAAO,YAAY,QAAQ,YAAY,YAAY,MAAM,GAAG;AAC9E,UAAI,QAAQ,kBAAkB;AAC7B,oCAAS,mFAAgF,OAAO;AAAA,MACjG;AACA,aAAO;AAAA,IACR;AAAA,EACD,QAAQ;AAAA,EAER;AAEA,QAAM,MAAM,KAAK,IAAI;AACrB,QAAM,oBAAmB,YAAO,qBAAP,YAA2B,MAAM;AAG1D,MAAI,MAAM,uBAAuB,iBAAiB;AACjD,UAAM,gBAAe,YAAO,sBAAP,YAA4B;AACjD,UAAM,gBAAe,YAAO,sBAAP,YAA4B;AACjD,UAAM,QAAO,YAAO,qBAAP,YAA2B;AACxC,UAAM,WAAU,YAAO,0BAAP,YAAgC;AAChD,UAAM,WAAU,YAAO,0BAAP,YAAgC;AAEhD,QAAI,YAAY,gBAAgB,WAAW,SAAS;AACnD,YAAM,UAAU,KAAK,IAAI,SAAS,KAAK,OAAO,WAAW,QAAQ,GAAG,IAAI,GAAG;AAC3E,YAAM,QAAQ,gBAAgB,4CAA4C,OAAO;AACjF;AAAA,QACC,oCAAoC,SAAS,OAAO,YAAY,uCAAuC,OAAO;AAAA,QAC9G;AAAA,MACD;AACA,aAAO;AAAA,IACR,WAAW,YAAY,gBAAgB,WAAW,SAAS;AAC1D,YAAM,UAAU,KAAK,IAAI,SAAS,KAAK,OAAO,WAAW,QAAQ,GAAG,IAAI,GAAG;AAC3E,YAAM,QAAQ,gBAAgB,4CAA4C,OAAO;AACjF;AAAA,QACC,qCAAqC,SAAS,OAAO,YAAY,qCAAqC,OAAO;AAAA,QAC7G;AAAA,MACD;AACA,aAAO;AAAA,IACR;AAAA,EACD;AAEA,SAAO;AACR;",
4
+ "sourcesContent": ["import { writeLog } from './logger';\nimport { getDpPath } from './stateMapping';\nimport type { LuxtronikAdapter } from './types';\n\n/**\n * \u00DCbernimmt die dynamische Regelung der Heizungsumw\u00E4lzpumpe (HUP) anhand der Spreizung.\n *\n * @param adapter - Die erweiterte Adapter-Instanz\n * @param istHeizen - Boolean, ob sich die Anlage aktuell im Heizbetrieb befindet\n * @param spreizung - Die aktuell berechnete Temperaturspreizung (Vorlauf - R\u00FCcklauf)\n * @param hupAktiv - Die aktuell anliegende Nominalspannung der HUP\n * @param lastPumpOptimization - Timestamp der letzten Anpassung (f\u00FCr Intervall-Sperre)\n * @returns Den aktualisierten Timestamp der letzten Anpassung\n */\nexport async function handleHupOptimization(\n\tadapter: LuxtronikAdapter,\n\tistHeizen: boolean,\n\tspreizung: number,\n\thupAktiv: number,\n\tlastPumpOptimization: number,\n): Promise<number> {\n\tconst config = adapter.config;\n\n\t// Abbruch, wenn nicht geheizt wird oder das Feature deaktiviert ist\n\tif (!istHeizen || config.hup_optimierung_aktiv !== true) {\n\t\treturn lastPumpOptimization;\n\t}\n\n\t// Erkennung einer PWM-Pumpe. Wenn Max-Speed > 0 konfiguriert ist,\n\t// handelt es sich um eine PWM-Pumpe. Die 0-10V Optimierung ist hier nutzlos!\n\ttry {\n\t\tconst maxPwmState = await adapter.getStateAsync(getDpPath('heating_max_circ_pump_speed'));\n\t\tif (maxPwmState && typeof maxPwmState.val === 'number' && maxPwmState.val > 0) {\n\t\t\tif (adapter.isDebugLogActive) {\n\t\t\t\twriteLog('HUP: PWM-Pumpe erkannt (max_speed > 0). 0-10V Optimierung wird \u00FCbersprungen.', 'debug');\n\t\t\t}\n\t\t\treturn lastPumpOptimization; // Abbruch!\n\t\t}\n\t} catch {\n\t\t// Fehler beim Lesen ignorieren und sicherheitshalber weitermachen\n\t}\n\n\tconst now = Date.now();\n\tconst checkIntervalMs = Number(config.hup_interval_min ?? 10) * 60000;\n\n\t// Pr\u00FCfen, ob das Schutz-Intervall abgelaufen ist\n\tif (now - lastPumpOptimization > checkIntervalMs) {\n\t\tconst minSpreizung = Number(config.hup_spreizung_min ?? 6.5);\n\t\tconst maxSpreizung = Number(config.hup_spreizung_max ?? 7.5);\n\t\tconst step = Number(config.hup_voltage_step ?? 0.25);\n\t\tconst minVolt = Number(config.hup_voltage_limit_min ?? 3.0);\n\t\tconst maxVolt = Number(config.hup_voltage_limit_max ?? 10.0);\n\n\t\tif (spreizung < minSpreizung && hupAktiv > minVolt) {\n\t\t\tconst newVolt = Math.max(minVolt, Math.round((hupAktiv - step) * 100) / 100);\n\t\t\tawait adapter.syncConfigValue('heating_system_circ_pump_voltage_nominal', newVolt);\n\t\t\twriteLog(\n\t\t\t\t`HUP: Temperature spread too low (${spreizung}K < ${minSpreizung}K). Scaling nominal voltage down to ${newVolt}V.`,\n\t\t\t\t'info',\n\t\t\t);\n\t\t\treturn now;\n\t\t} else if (spreizung > maxSpreizung && hupAktiv < maxVolt) {\n\t\t\tconst newVolt = Math.min(maxVolt, Math.round((hupAktiv + step) * 100) / 100);\n\t\t\tawait adapter.syncConfigValue('heating_system_circ_pump_voltage_nominal', newVolt);\n\t\t\twriteLog(\n\t\t\t\t`HUP: Temperature spread too high (${spreizung}K > ${maxSpreizung}K). Scaling nominal voltage up to ${newVolt}V.`,\n\t\t\t\t'info',\n\t\t\t);\n\t\t\treturn now;\n\t\t}\n\t}\n\n\treturn lastPumpOptimization;\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,oBAAyB;AACzB,0BAA0B;AAa1B,eAAsB,sBACrB,SACA,WACA,WACA,UACA,sBACkB;AApBnB;AAqBC,QAAM,SAAS,QAAQ;AAGvB,MAAI,CAAC,aAAa,OAAO,0BAA0B,MAAM;AACxD,WAAO;AAAA,EACR;AAIA,MAAI;AACH,UAAM,cAAc,MAAM,QAAQ,kBAAc,+BAAU,6BAA6B,CAAC;AACxF,QAAI,eAAe,OAAO,YAAY,QAAQ,YAAY,YAAY,MAAM,GAAG;AAC9E,UAAI,QAAQ,kBAAkB;AAC7B,oCAAS,mFAAgF,OAAO;AAAA,MACjG;AACA,aAAO;AAAA,IACR;AAAA,EACD,QAAQ;AAAA,EAER;AAEA,QAAM,MAAM,KAAK,IAAI;AACrB,QAAM,kBAAkB,QAAO,YAAO,qBAAP,YAA2B,EAAE,IAAI;AAGhE,MAAI,MAAM,uBAAuB,iBAAiB;AACjD,UAAM,eAAe,QAAO,YAAO,sBAAP,YAA4B,GAAG;AAC3D,UAAM,eAAe,QAAO,YAAO,sBAAP,YAA4B,GAAG;AAC3D,UAAM,OAAO,QAAO,YAAO,qBAAP,YAA2B,IAAI;AACnD,UAAM,UAAU,QAAO,YAAO,0BAAP,YAAgC,CAAG;AAC1D,UAAM,UAAU,QAAO,YAAO,0BAAP,YAAgC,EAAI;AAE3D,QAAI,YAAY,gBAAgB,WAAW,SAAS;AACnD,YAAM,UAAU,KAAK,IAAI,SAAS,KAAK,OAAO,WAAW,QAAQ,GAAG,IAAI,GAAG;AAC3E,YAAM,QAAQ,gBAAgB,4CAA4C,OAAO;AACjF;AAAA,QACC,oCAAoC,SAAS,OAAO,YAAY,uCAAuC,OAAO;AAAA,QAC9G;AAAA,MACD;AACA,aAAO;AAAA,IACR,WAAW,YAAY,gBAAgB,WAAW,SAAS;AAC1D,YAAM,UAAU,KAAK,IAAI,SAAS,KAAK,OAAO,WAAW,QAAQ,GAAG,IAAI,GAAG;AAC3E,YAAM,QAAQ,gBAAgB,4CAA4C,OAAO;AACjF;AAAA,QACC,qCAAqC,SAAS,OAAO,YAAY,qCAAqC,OAAO;AAAA,QAC7G;AAAA,MACD;AACA,aAAO;AAAA,IACR;AAAA,EACD;AAEA,SAAO;AACR;",
6
6
  "names": []
7
7
  }
package/build/main.js CHANGED
@@ -244,25 +244,6 @@ class Luxtronik2Controller extends utils.Adapter {
244
244
  "warn"
245
245
  );
246
246
  }
247
- for (const [key, stateDef] of Object.entries(import_stateMapping.STATE_MAPPING)) {
248
- if (stateDef.isVirtual) {
249
- await this.setObjectNotExistsAsync(`${stateDef.folder}.${key}`, {
250
- type: "state",
251
- common: {
252
- name: stateDef.name,
253
- type: stateDef.type,
254
- role: stateDef.role,
255
- read: true,
256
- write: stateDef.write || false,
257
- def: stateDef.def !== void 0 ? stateDef.def : null
258
- },
259
- native: {
260
- luxWriteId: stateDef.luxWriteId || null,
261
- dataSource: stateDef.dataSource || null
262
- }
263
- });
264
- }
265
- }
266
247
  if (config.update_check_active === true) {
267
248
  this.setTimeout(() => {
268
249
  void (0, import_updateManager.checkFirmwareUpdate)(this);
@@ -327,14 +308,18 @@ class Luxtronik2Controller extends utils.Adapter {
327
308
  this.modbusManager && this.modbusManager.isAvailable && config.modbus_active && definition.modbus && config[definition.modbus.configKey] === true
328
309
  );
329
310
  if ((definition.write === true || isModbusEnabled) && !definition.isVirtual && definition.luxWriteId) {
311
+ let appliedFactor = definition.factor;
312
+ if (mappingKey === "heating_system_circ_pump_voltage_nominal" || mappingKey === "heating_system_circ_pump_voltage_minimal") {
313
+ appliedFactor = config.hup_voltage_factor !== void 0 ? Number(config.hup_voltage_factor) : 100;
314
+ }
330
315
  let valueToWrite = val;
331
316
  if (typeof valueToWrite === "boolean") {
332
317
  valueToWrite = valueToWrite ? 1 : 0;
333
- } else if (definition.factor && typeof val === "number") {
334
- valueToWrite = val * definition.factor;
318
+ } else if (appliedFactor && typeof val === "number") {
319
+ valueToWrite = val * appliedFactor;
335
320
  }
336
321
  const isRawWrite = definition.dataSource === "raw_parameter" || definition.dataSource === "raw_value" || !definition.dataSource && /^\d+$/.test(definition.luxWriteId || "");
337
- if (isRawWrite && definition.unit === "\xB0C" && typeof val === "number" && !definition.factor) {
322
+ if (isRawWrite && definition.unit === "\xB0C" && typeof val === "number" && !appliedFactor) {
338
323
  valueToWrite = val * 10;
339
324
  }
340
325
  try {
@@ -396,6 +381,7 @@ class Luxtronik2Controller extends utils.Adapter {
396
381
  const config = this.config;
397
382
  await this.syncConfigValue("heating_curve_end_point", (_a = config.endpunkt) != null ? _a : 23);
398
383
  await this.syncConfigValue("heating_curve_parallel_offset", (_b = config.fusspunkt) != null ? _b : 21.7);
384
+ await this.syncConfigValue("heating_temperature", 0);
399
385
  await this.syncConfigValue(
400
386
  "heating_system_circ_pump_voltage_minimal",
401
387
  (_c = config.sync_heating_system_circ_pump_voltage_minimal_heating) != null ? _c : 3
@@ -408,6 +394,9 @@ class Luxtronik2Controller extends utils.Adapter {
408
394
  await this.syncConfigValue("returnTemperatureHysteresis", (_f = config.sync_return_temperature_hysteresis) != null ? _f : 1.5);
409
395
  await this.syncConfigValue("zip_aktiv", (_g = config.zip_aktiv) != null ? _g : 0);
410
396
  await this.syncConfigValue("Heizen_nach_Wasser", (_h = config.Heating_after_warmwater) != null ? _h : false);
397
+ if (import_pvManager.pvIsBoostActive) {
398
+ await (0, import_pvManager.evaluatePvBoost)(this, true);
399
+ }
411
400
  } catch (err) {
412
401
  (0, import_logger.writeLog)(`Failed to apply the baseline idle configuration defaults: ${err.message}`, "error");
413
402
  }
@@ -450,15 +439,18 @@ class Luxtronik2Controller extends utils.Adapter {
450
439
  }
451
440
  if (bzVal !== this.lastBzVal) {
452
441
  if (istLeerlauf) {
453
- if (config.idle_defaults_aktiv === true && !import_pvManager.pvIsBoostActive) {
442
+ if (config.idle_defaults_aktiv === true) {
454
443
  await this.setIdleDefaults();
455
444
  }
456
445
  } else if (istHeizen) {
457
- if (this.lastBzVal === "1" && config.idle_defaults_aktiv === true && !import_pvManager.pvIsBoostActive) {
446
+ if (this.lastBzVal === "1" && config.idle_defaults_aktiv === true) {
458
447
  await this.syncConfigValue(
459
448
  "temperature_hot_water_target",
460
449
  (_a = config.sync_warmwater_target_temperature) != null ? _a : 54
461
450
  );
451
+ if (import_pvManager.pvIsBoostActive) {
452
+ await (0, import_pvManager.evaluatePvBoost)(this, true);
453
+ }
462
454
  }
463
455
  if (config.zip_optimierung_aktiv === true) {
464
456
  await this.syncConfigValue("zip_aktiv", (_b = config.zip_aktiv) != null ? _b : 0);
@@ -552,7 +544,7 @@ class Luxtronik2Controller extends utils.Adapter {
552
544
  const heatingLimit = (_t = heatingLimitState == null ? void 0 : heatingLimitState.val) != null ? _t : 0;
553
545
  const nachWasser = nachWasserState == null ? void 0 : nachWasserState.val;
554
546
  if (istHeizen) {
555
- if (isRegelungAktiv && aelterAls10 && vd1) {
547
+ if (aelterAls10 && vd1) {
556
548
  const fusspunkt = (_u = await this.getStateAsync((0, import_stateMapping.getDpPath)("heating_curve_parallel_offset"))) == null ? void 0 : _u.val;
557
549
  if (fusspunkt === 35) {
558
550
  const fallbackFusspunkt = (_v = config.fusspunkt) != null ? _v : 21.7;
@@ -576,7 +568,7 @@ class Luxtronik2Controller extends utils.Adapter {
576
568
  } else if (!nachWasser && config.Heating_after_warmwater === true) {
577
569
  await this.syncConfigValue("Heizen_nach_Wasser", true);
578
570
  }
579
- if (!import_pvManager.pvIsBoostActive && wwSoll - wwIst > 2 && ruecklauf >= ruecklaufSoll + heizenHysterese - 0.1) {
571
+ if (wwSoll - wwIst > 2 && ruecklauf >= ruecklaufSoll + heizenHysterese - 0.1) {
580
572
  let forceSoll = wwIst + wwHysterese + 1.5;
581
573
  if (forceSoll > 70) {
582
574
  forceSoll = 70;
@@ -598,7 +590,7 @@ class Luxtronik2Controller extends utils.Adapter {
598
590
  await (0, import_zipManager.stopZipAndDeaeration)(this);
599
591
  }
600
592
  }
601
- if (isRegelungAktiv && !import_pvManager.pvIsBoostActive) {
593
+ if (isRegelungAktiv) {
602
594
  if (wwSoll - wwIst >= wwHysterese - 1.5 && ruecklauf <= ruecklaufSoll && isHeatingAllowedByLimit) {
603
595
  await this.syncConfigValue("heating_curve_parallel_offset", 35);
604
596
  }
@@ -766,8 +758,8 @@ class Luxtronik2Controller extends utils.Adapter {
766
758
  }
767
759
  }
768
760
  await Promise.all(statePromises);
769
- await (0, import_virtualStates.calculateTotalThermalEnergy)(this);
770
- await (0, import_virtualStates.calculateTotalEnergy)(this);
761
+ await (0, import_virtualStates.calculateTotalThermalEnergy)(this, rawValues);
762
+ await (0, import_virtualStates.calculateTotalEnergy)(this, rawValues);
771
763
  const fehlerDp = (0, import_stateMapping.getDpPath)("Fehlerspeicher");
772
764
  const oldFehlerState = fehlerDp ? await this.getStateAsync(fehlerDp) : null;
773
765
  const oldFehlerVal = oldFehlerState == null ? void 0 : oldFehlerState.val;
@@ -974,15 +966,19 @@ class Luxtronik2Controller extends utils.Adapter {
974
966
  return;
975
967
  }
976
968
  await this.setState(relativeId, { val: state.val, ack: true });
969
+ let appliedFactor = definition.factor;
970
+ if (mappingKey === "heating_system_circ_pump_voltage_nominal" || mappingKey === "heating_system_circ_pump_voltage_minimal") {
971
+ appliedFactor = config.hup_voltage_factor !== void 0 ? Number(config.hup_voltage_factor) : 100;
972
+ }
977
973
  let valueToWrite = state.val;
978
974
  if (typeof valueToWrite === "boolean") {
979
975
  valueToWrite = valueToWrite ? 1 : 0;
980
976
  } else if (definition.isDurationFormat || definition.role === "value.datetime" || definition.role === "value.time") {
981
977
  valueToWrite = (0, import_convert.timeStringToSeconds)(state.val);
982
- } else if (definition.factor && typeof state.val === "number") {
983
- valueToWrite = state.val * definition.factor;
978
+ } else if (appliedFactor && typeof state.val === "number") {
979
+ valueToWrite = state.val * appliedFactor;
984
980
  }
985
- if (definition.unit === "\xB0C" && typeof state.val === "number" && !definition.factor) {
981
+ if (definition.unit === "\xB0C" && typeof state.val === "number" && !appliedFactor) {
986
982
  valueToWrite = state.val * 10;
987
983
  }
988
984
  if (isModbusEnabled && definition.modbus) {