iobroker.luxtronik2-controller 0.23.2 → 0.24.0
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 +16 -8
- package/admin/jsonConfig.json +146 -0
- package/build/main.js +80 -29
- package/build/main.js.map +2 -2
- package/io-package.json +16 -15
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -13,6 +13,8 @@
|
|
|
13
13
|
|
|
14
14
|
This ioBroker adapter enables the local control, optimization, and monitoring of heat pumps with [Luxtronik 2.x / 3.x controllers](https://www.alpha-innotec.com/en/products/accessories/control/luxtronik) (e.g., Alpha Innotec, Novelan). The adapter is written entirely in TypeScript.
|
|
15
15
|
|
|
16
|
+
**If you like this project and want to support its development, feel free to drop a tip here: https://paypal.me/TJahnke**
|
|
17
|
+
|
|
16
18
|
## Acknowledgements & History
|
|
17
19
|
|
|
18
20
|
This project builds upon the preliminary work of existing open-source projects. Special thanks go to:
|
|
@@ -22,6 +24,10 @@ This project builds upon the preliminary work of existing open-source projects.
|
|
|
22
24
|
- **[UncleSamSwiss](https://github.com/UncleSamSwiss/ioBroker.luxtronik2):** For the original ioBroker adapter.
|
|
23
25
|
- **[BenPru](https://github.com/BenPru/luxtronik) & rhammen:** A special thanks to BenPru and rhammen for their continuous further development regarding the access and control of the Luxtronik controller. Without their dedication, efforts, and ideas, this adapter would not have reached the advanced state it is in today. _(If you appreciate their work, feel free to buy them a coffee! ☕) [BenPru](https://github.com/sponsors/BenPru) [rhammen](https://github.com/sponsors/rhammen)_
|
|
24
26
|
|
|
27
|
+
> **💡 No LAN cable near your heat pump? No problem!**
|
|
28
|
+
> If your Luxtronik 2.0 controller only has a free USB port instead of a nearby network socket, you can easily connect it via Wi-Fi using the clever **USB 2.0 powered WiFi/Ethernet Bridge** project by _obermolch_. It powers itself directly from the controller's USB port and bridges the connection wirelessly without extra wall power supplies.
|
|
29
|
+
> Check out the full guide and community discussion here: [ioBroker Forum: USB 2.0 powered WiFi/Ethernet Bridge für Luxtronik 2.0](https://forum.iobroker.net/topic/85773/usb-2-0-powered-wifi-ethernet-bridge-f%C3%BCr-luxtronik-2-0).
|
|
30
|
+
|
|
25
31
|
**Innovations in this version:**
|
|
26
32
|
The `luxtronik2-controller` natively integrates both classic TCP communication (Port `8888` / `8889`) and modern WebSockets (Port `8214` for firmware > V3.81), combined with an optional **Hybrid Modbus TCP** engine (Port `502`) for wear-free RAM writes. Additionally, it features intelligent cycle optimization, dynamic pump control, hardware flash-wear protection, COP/JAZ efficiency tracking, PV-management and automated datapoint management.
|
|
27
33
|
|
|
@@ -96,6 +102,16 @@ You might see red error messages in the installation log related to `node-gyp`,
|
|
|
96
102
|
//### **WORK IN PROGRESS**
|
|
97
103
|
|
|
98
104
|
## Changelog
|
|
105
|
+
### 0.24.0 (2026-11-09)
|
|
106
|
+
|
|
107
|
+
**🐛 Bugfixes & Tweaks**
|
|
108
|
+
|
|
109
|
+
- **Operating Mode & Write Protection (`jsonConfig.json`, `main.ts`):**
|
|
110
|
+
- **Explicit Operating Mode Selection:** Added a central "Operating Mode" selector in the Connection tab with color-coded status banners to clearly distinguish between **Read-Only (Monitoring)**, **Read & Write without Modbus (Native via Port 8889)**, and **Read & Write with Modbus TCP (Hybrid RAM access)**.
|
|
111
|
+
- **Dynamic UI Locking:** When "Read-Only" is selected, all write-related configuration tabs (Modbus, Idle Defaults, Cycle Optimization, HUP, ZIP, and PV Surplus) and their inputs are automatically grayed out and disabled. Selecting native write mode unlocks the optimization tabs while keeping the Modbus tab disabled.
|
|
112
|
+
- **Strict Backend Write Lock:** Enforced a global hardware write lock in Read-Only mode across `onReady`, `syncConfigValue`, `runOptimizationSchedule`, and `onStateChange` (while keeping diagnostic functions like debug logging, raw dumps, and firmware checks active).
|
|
113
|
+
- **Automatic Config Migration:** Existing installations are seamlessly migrated on startup to the matching operating mode based on their previously active Modbus and optimization settings.
|
|
114
|
+
|
|
99
115
|
### 0.23.2 (2026-11-07)
|
|
100
116
|
|
|
101
117
|
- **COP & Efficiency Calculation (`copManager.ts`):**
|
|
@@ -126,14 +142,6 @@ You might see red error messages in the installation log related to `node-gyp`,
|
|
|
126
142
|
- **Smart Delta Routing:** When the heat pump is actively generating hot water (`WP_BZ_akt === 1`), the COP manager now checks if the internal DHW power meter is stuck at zero. If so, it automatically intercepts the delta from the total energy meter (`energy_total`) over the last polling interval and securely routes it into the Hot Water COP bucket.
|
|
127
143
|
- **Continuous Standby Sync:** Enhanced the database tracking to ensure the total energy fallback counter is continuously synced even during standby or heating modes. This prevents idle power consumption from accumulating in the background and falsely distorting the next hot water efficiency calculation.
|
|
128
144
|
|
|
129
|
-
### 0.22.7 (2026-11-07)
|
|
130
|
-
|
|
131
|
-
**🐛 Bugfixes**
|
|
132
|
-
|
|
133
|
-
- **PV Surplus Management & Cycle Optimization:**
|
|
134
|
-
- **Zero-Drift Baseline Calculation:** Rewrote the PV boost baseline logic in `pvManager.ts`. The adapter no longer reads live datapoint states to calculate the boost, but strictly enforces the configured baseline values (`sync_warmwater_target_temperature` and `0K` for heating). This permanently resolves the "snowball effect" where the hot water target could incrementally drift up to the 70 °C safety limit.
|
|
135
|
-
- **Cycle Coupling Handshake:** Enhanced the intelligent cycle optimization (`main.ts`) during active PV surplus. At the end of a heating cycle, the adapter now seamlessly couples a hot water cycle and intelligently enforces the PV boost target (e.g., 60 °C) to maximize solar self-consumption, without interfering with the strict baseline logic.
|
|
136
|
-
|
|
137
145
|
## License
|
|
138
146
|
|
|
139
147
|
MIT License
|
package/admin/jsonConfig.json
CHANGED
|
@@ -88,6 +88,137 @@
|
|
|
88
88
|
"lg": 12,
|
|
89
89
|
"xl": 12
|
|
90
90
|
},
|
|
91
|
+
"divider_operation_mode": {
|
|
92
|
+
"type": "divider",
|
|
93
|
+
"color": "primary",
|
|
94
|
+
"style": {
|
|
95
|
+
"marginBottom": "15px",
|
|
96
|
+
"marginTop": "15px"
|
|
97
|
+
},
|
|
98
|
+
"xs": 12,
|
|
99
|
+
"sm": 12,
|
|
100
|
+
"md": 12,
|
|
101
|
+
"lg": 12,
|
|
102
|
+
"xl": 12
|
|
103
|
+
},
|
|
104
|
+
"headerOperationMode": {
|
|
105
|
+
"type": "header",
|
|
106
|
+
"text": {
|
|
107
|
+
"en": "Operating Mode & Hardware Write Access",
|
|
108
|
+
"de": "Betriebsmodus & Hardware-Schreibzugriff"
|
|
109
|
+
},
|
|
110
|
+
"size": 4,
|
|
111
|
+
"xs": 12,
|
|
112
|
+
"sm": 12,
|
|
113
|
+
"md": 12,
|
|
114
|
+
"lg": 12,
|
|
115
|
+
"xl": 12
|
|
116
|
+
},
|
|
117
|
+
"operation_mode": {
|
|
118
|
+
"type": "select",
|
|
119
|
+
"label": {
|
|
120
|
+
"en": "Select Operating Mode",
|
|
121
|
+
"de": "Betriebsmodus auswählen"
|
|
122
|
+
},
|
|
123
|
+
"options": [
|
|
124
|
+
{
|
|
125
|
+
"label": {
|
|
126
|
+
"en": "🔒 Read-Only (Monitoring only – 0% flash wear, all optimizations disabled)",
|
|
127
|
+
"de": "🔒 Nur Lesend (Reines Monitoring – 0% Flash-Verschleiß, alle Optimierungen deaktiviert)"
|
|
128
|
+
},
|
|
129
|
+
"value": "readonly"
|
|
130
|
+
},
|
|
131
|
+
{
|
|
132
|
+
"label": {
|
|
133
|
+
"en": "✍️ Read & Write: Without Modbus (Native via Port 8889 – writes to EEPROM)",
|
|
134
|
+
"de": "✍️ Schreibend: Ohne Modbus (Nativ über Port 8889 – schreibt in EEPROM)"
|
|
135
|
+
},
|
|
136
|
+
"value": "native"
|
|
137
|
+
},
|
|
138
|
+
{
|
|
139
|
+
"label": {
|
|
140
|
+
"en": "⚡ Read & Write: With Modbus TCP (Hybrid – wear-free RAM access)",
|
|
141
|
+
"de": "⚡ Schreibend: Mit Modbus TCP (Hybrid – verschleißfreier RAM-Zugriff)"
|
|
142
|
+
},
|
|
143
|
+
"value": "modbus"
|
|
144
|
+
}
|
|
145
|
+
],
|
|
146
|
+
"default": "readonly",
|
|
147
|
+
"xs": 12,
|
|
148
|
+
"sm": 12,
|
|
149
|
+
"md": 12,
|
|
150
|
+
"lg": 12,
|
|
151
|
+
"xl": 12
|
|
152
|
+
},
|
|
153
|
+
"infoModeReadonly": {
|
|
154
|
+
"type": "staticText",
|
|
155
|
+
"text": {
|
|
156
|
+
"en": "🔒 <b>Read-Only Mode active:</b> The adapter only reads telemetry and parameters. All write-related tabs (Modbus, Idle Defaults, Cycle Optimization, HUP, ZIP, PV Surplus) are disabled and grayed out. Manual changes in the object tree are blocked.",
|
|
157
|
+
"de": "🔒 <b>Nur-Lesen-Modus aktiv:</b> Der Adapter liest ausschließlich Messwerte und Parameter aus (z.B. für Visualisierungen und COP-Berechnung). Alle schreibenden Reiter (Modbus, Vorgaben, Takt-Optimierung, HUP, ZIP, PV-Überschuss) sind komplett deaktiviert und ausgegraut. Es finden garantiert keine Schreibzugriffe auf die Wärmepumpe statt."
|
|
158
|
+
},
|
|
159
|
+
"hidden": "data.operation_mode !== 'readonly'",
|
|
160
|
+
"style": {
|
|
161
|
+
"marginTop": "10px",
|
|
162
|
+
"marginBottom": "15px",
|
|
163
|
+
"fontSize": "13px",
|
|
164
|
+
"backgroundColor": "#e3f2fd",
|
|
165
|
+
"color": "#0d47a1",
|
|
166
|
+
"padding": "12px",
|
|
167
|
+
"borderRadius": "5px",
|
|
168
|
+
"borderLeft": "5px solid #1976d2"
|
|
169
|
+
},
|
|
170
|
+
"xs": 12,
|
|
171
|
+
"sm": 12,
|
|
172
|
+
"md": 12,
|
|
173
|
+
"lg": 12,
|
|
174
|
+
"xl": 12
|
|
175
|
+
},
|
|
176
|
+
"infoModeNative": {
|
|
177
|
+
"type": "staticText",
|
|
178
|
+
"text": {
|
|
179
|
+
"en": "✍️ <b>Write Mode (Without Modbus / Native Port 8889):</b> Active optimizations and parameter changes are written directly to the Luxtronik EEPROM via port 8889. Please enable 'Idle Defaults' when using optimizations and monitor daily flash write cycles.",
|
|
180
|
+
"de": "✍️ <b>Schreibmodus (Ohne Modbus / Nativ über Port 8889):</b> Aktive Optimierungen (Takt, HUP, ZIP, PV) und Parameter-Änderungen werden direkt über Port 8889 in den EEPROM-Speicher der Luxtronik geschrieben. Der Reiter 'Modbus (Hybrid)' ist deaktiviert."
|
|
181
|
+
},
|
|
182
|
+
"hidden": "data.operation_mode !== 'native'",
|
|
183
|
+
"style": {
|
|
184
|
+
"marginTop": "10px",
|
|
185
|
+
"marginBottom": "15px",
|
|
186
|
+
"fontSize": "13px",
|
|
187
|
+
"backgroundColor": "#fff3e0",
|
|
188
|
+
"color": "#e65100",
|
|
189
|
+
"padding": "12px",
|
|
190
|
+
"borderRadius": "5px",
|
|
191
|
+
"borderLeft": "5px solid #ff9800"
|
|
192
|
+
},
|
|
193
|
+
"xs": 12,
|
|
194
|
+
"sm": 12,
|
|
195
|
+
"md": 12,
|
|
196
|
+
"lg": 12,
|
|
197
|
+
"xl": 12
|
|
198
|
+
},
|
|
199
|
+
"infoModeModbus": {
|
|
200
|
+
"type": "staticText",
|
|
201
|
+
"text": {
|
|
202
|
+
"en": "⚡ <b>Hybrid Mode (Write with Modbus TCP):</b> Volatile parameters (setpoints, offsets, coils) are written directly into the controller's RAM via Modbus TCP without causing EEPROM flash wear. Please select your active registers in the 'Modbus (Hybrid)' tab.",
|
|
203
|
+
"de": "⚡ <b>Hybrid-Modus (Schreibend mit Modbus TCP):</b> Flüchtige Parameter (Sollwerte, Parallelverschiebung, Coils) werden ohne EEPROM-Verschleiß direkt über Modbus TCP in den Arbeitsspeicher (RAM) geschrieben. Bitte wähle im Reiter 'Modbus (Hybrid)' die gewünschten Register aus."
|
|
204
|
+
},
|
|
205
|
+
"hidden": "data.operation_mode !== 'modbus'",
|
|
206
|
+
"style": {
|
|
207
|
+
"marginTop": "10px",
|
|
208
|
+
"marginBottom": "15px",
|
|
209
|
+
"fontSize": "13px",
|
|
210
|
+
"backgroundColor": "#e8f5e9",
|
|
211
|
+
"color": "#1b5e20",
|
|
212
|
+
"padding": "12px",
|
|
213
|
+
"borderRadius": "5px",
|
|
214
|
+
"borderLeft": "5px solid #4caf50"
|
|
215
|
+
},
|
|
216
|
+
"xs": 12,
|
|
217
|
+
"sm": 12,
|
|
218
|
+
"md": 12,
|
|
219
|
+
"lg": 12,
|
|
220
|
+
"xl": 12
|
|
221
|
+
},
|
|
91
222
|
"headerOption": {
|
|
92
223
|
"type": "header",
|
|
93
224
|
"text": {
|
|
@@ -584,6 +715,7 @@
|
|
|
584
715
|
},
|
|
585
716
|
"idleTab": {
|
|
586
717
|
"type": "panel",
|
|
718
|
+
"disabled": "data.operation_mode === 'readonly'",
|
|
587
719
|
"label": {
|
|
588
720
|
"en": "Idle Defaults",
|
|
589
721
|
"de": "Vorgaben"
|
|
@@ -632,6 +764,7 @@
|
|
|
632
764
|
"de": "Standardwerte im Leerlauf erzwingen"
|
|
633
765
|
},
|
|
634
766
|
"default": false,
|
|
767
|
+
"disabled": "data.operation_mode === 'readonly'",
|
|
635
768
|
"confirm": {
|
|
636
769
|
"condition": "data.idle_defaults_aktiv === true",
|
|
637
770
|
"text": {
|
|
@@ -1011,6 +1144,7 @@
|
|
|
1011
1144
|
},
|
|
1012
1145
|
"cycleOptimizationTab": {
|
|
1013
1146
|
"type": "panel",
|
|
1147
|
+
"disabled": "data.operation_mode === 'readonly'",
|
|
1014
1148
|
"label": {
|
|
1015
1149
|
"en": "Cycle Optimization",
|
|
1016
1150
|
"de": "Takt-Optimierung"
|
|
@@ -1039,6 +1173,7 @@
|
|
|
1039
1173
|
"en": "Enable intelligent cycle optimization",
|
|
1040
1174
|
"de": "Intelligente Takt-Optimierung aktivieren"
|
|
1041
1175
|
},
|
|
1176
|
+
"disabled": "data.operation_mode === 'readonly'",
|
|
1042
1177
|
"default": false,
|
|
1043
1178
|
"confirm": {
|
|
1044
1179
|
"condition": "data.regelung_aktiv === true && data.idle_defaults_aktiv !== true",
|
|
@@ -1059,6 +1194,7 @@
|
|
|
1059
1194
|
},
|
|
1060
1195
|
"Heating_after_warmwater": {
|
|
1061
1196
|
"type": "checkbox",
|
|
1197
|
+
"disabled": "data.operation_mode === 'readonly'",
|
|
1062
1198
|
"label": {
|
|
1063
1199
|
"en": "Heating after hot water",
|
|
1064
1200
|
"de": "Heizen nach Warmwasser erzwingen"
|
|
@@ -1093,6 +1229,7 @@
|
|
|
1093
1229
|
},
|
|
1094
1230
|
"hupTab": {
|
|
1095
1231
|
"type": "panel",
|
|
1232
|
+
"disabled": "data.operation_mode === 'readonly'",
|
|
1096
1233
|
"label": {
|
|
1097
1234
|
"en": "HUP control",
|
|
1098
1235
|
"de": "HUP Steuerung"
|
|
@@ -1117,6 +1254,7 @@
|
|
|
1117
1254
|
},
|
|
1118
1255
|
"hup_voltage_factor": {
|
|
1119
1256
|
"type": "select",
|
|
1257
|
+
"disabled": "data.operation_mode === 'readonly'",
|
|
1120
1258
|
"label": {
|
|
1121
1259
|
"en": "Hardware voltage scale",
|
|
1122
1260
|
"de": "Hardware Spannungs-Faktor"
|
|
@@ -1144,6 +1282,7 @@
|
|
|
1144
1282
|
},
|
|
1145
1283
|
"hup_optimierung_aktiv": {
|
|
1146
1284
|
"type": "checkbox",
|
|
1285
|
+
"disabled": "data.operation_mode === 'readonly'",
|
|
1147
1286
|
"label": {
|
|
1148
1287
|
"en": "Enable dynamic HUP spread control",
|
|
1149
1288
|
"de": "Dynamische HUP-Spreizungsregelung aktivieren"
|
|
@@ -1315,6 +1454,7 @@
|
|
|
1315
1454
|
},
|
|
1316
1455
|
"zipTab": {
|
|
1317
1456
|
"type": "panel",
|
|
1457
|
+
"disabled": "data.operation_mode === 'readonly'",
|
|
1318
1458
|
"label": {
|
|
1319
1459
|
"en": "Circulation pump",
|
|
1320
1460
|
"de": "ZIP Steuerung"
|
|
@@ -1323,6 +1463,7 @@
|
|
|
1323
1463
|
"items": {
|
|
1324
1464
|
"zip_control_mode": {
|
|
1325
1465
|
"type": "select",
|
|
1466
|
+
"disabled": "data.operation_mode === 'readonly'",
|
|
1326
1467
|
"label": {
|
|
1327
1468
|
"en": "How is your circulation pump (ZIP) controlled?",
|
|
1328
1469
|
"de": "Wie wird deine Zirkulationspumpe (ZIP) gesteuert?"
|
|
@@ -1440,6 +1581,7 @@
|
|
|
1440
1581
|
},
|
|
1441
1582
|
"zip_lWP_aktiv": {
|
|
1442
1583
|
"type": "checkbox",
|
|
1584
|
+
"disabled": "data.operation_mode === 'readonly'",
|
|
1443
1585
|
"label": {
|
|
1444
1586
|
"en": "Disable base ZIP values (Set Luxtronik timers to 0)",
|
|
1445
1587
|
"de": "Deaktiviere reguläre ZIP Werte (Luxtronik-Timer auf 0)"
|
|
@@ -1454,6 +1596,7 @@
|
|
|
1454
1596
|
},
|
|
1455
1597
|
"zip_optimierung_aktiv": {
|
|
1456
1598
|
"type": "checkbox",
|
|
1599
|
+
"disabled": "data.operation_mode === 'readonly'",
|
|
1457
1600
|
"label": {
|
|
1458
1601
|
"en": "Allow ZIP optimization",
|
|
1459
1602
|
"de": "ZIP-Optimierung zulassen"
|
|
@@ -1538,6 +1681,7 @@
|
|
|
1538
1681
|
},
|
|
1539
1682
|
"motion_sensors_aktiv": {
|
|
1540
1683
|
"type": "checkbox",
|
|
1684
|
+
"disabled": "data.operation_mode === 'readonly'",
|
|
1541
1685
|
"label": {
|
|
1542
1686
|
"en": "Actively use motion sensors",
|
|
1543
1687
|
"de": "Bewegungssensoren aktiv nutzen"
|
|
@@ -1652,6 +1796,7 @@
|
|
|
1652
1796
|
},
|
|
1653
1797
|
"pvTab": {
|
|
1654
1798
|
"type": "panel",
|
|
1799
|
+
"disabled": "data.operation_mode === 'readonly'",
|
|
1655
1800
|
"label": {
|
|
1656
1801
|
"en": "PV / Surplus",
|
|
1657
1802
|
"de": "PV-Überschuss"
|
|
@@ -1660,6 +1805,7 @@
|
|
|
1660
1805
|
"items": {
|
|
1661
1806
|
"pv_active": {
|
|
1662
1807
|
"type": "checkbox",
|
|
1808
|
+
"disabled": "data.operation_mode === 'readonly'",
|
|
1663
1809
|
"label": {
|
|
1664
1810
|
"en": "Enable PV surplus management",
|
|
1665
1811
|
"de": "PV-Überschusssteuerung aktivieren"
|
package/build/main.js
CHANGED
|
@@ -153,11 +153,29 @@ class Luxtronik2Controller extends utils.Adapter {
|
|
|
153
153
|
configUpdated = true;
|
|
154
154
|
(0, import_logger.writeLog)(`[Migration] Updated zip_control_mode to '${migratedMode}' based on legacy settings.`, "info");
|
|
155
155
|
}
|
|
156
|
+
if (config.operation_mode === void 0) {
|
|
157
|
+
if (config.modbus_active === true) {
|
|
158
|
+
config.operation_mode = "modbus";
|
|
159
|
+
} else if (config.idle_defaults_aktiv === true || config.regelung_aktiv === true || config.hup_optimierung_aktiv === true || config.pv_active === true || config.zip_optimierung_aktiv === true) {
|
|
160
|
+
config.operation_mode = "native";
|
|
161
|
+
} else {
|
|
162
|
+
config.operation_mode = "readonly";
|
|
163
|
+
}
|
|
164
|
+
configUpdated = true;
|
|
165
|
+
(0, import_logger.writeLog)(`[Migration] Set operation_mode to '${config.operation_mode}' based on legacy settings.`, "info");
|
|
166
|
+
}
|
|
167
|
+
const shouldModbusBeActive = config.operation_mode === "modbus";
|
|
168
|
+
if (config.modbus_active !== shouldModbusBeActive) {
|
|
169
|
+
config.modbus_active = shouldModbusBeActive;
|
|
170
|
+
configUpdated = true;
|
|
171
|
+
}
|
|
156
172
|
if (configUpdated) {
|
|
157
173
|
try {
|
|
158
174
|
const obj = await this.getForeignObjectAsync(`system.adapter.${this.namespace}`);
|
|
159
175
|
if (obj && obj.native) {
|
|
160
176
|
obj.native.zip_control_mode = config.zip_control_mode;
|
|
177
|
+
obj.native.operation_mode = config.operation_mode;
|
|
178
|
+
obj.native.modbus_active = config.modbus_active;
|
|
161
179
|
await this.setForeignObject(`system.adapter.${this.namespace}`, obj);
|
|
162
180
|
}
|
|
163
181
|
} catch (err) {
|
|
@@ -194,21 +212,36 @@ class Luxtronik2Controller extends utils.Adapter {
|
|
|
194
212
|
await (0, import_objectManager.ensureCustomObjectsExist)(this);
|
|
195
213
|
(0, import_backupManager.initAutoBackup)(this);
|
|
196
214
|
await this.subscribeStatesAsync("Information.12_SystemInfo.check_firmware");
|
|
197
|
-
|
|
215
|
+
const isReadOnly = config.operation_mode === "readonly";
|
|
216
|
+
if (isReadOnly) {
|
|
217
|
+
(0, import_logger.writeLog)(
|
|
218
|
+
"\u{1F512} Operating Mode: READ-ONLY. All hardware write operations and optimizations are disabled.",
|
|
219
|
+
"info"
|
|
220
|
+
);
|
|
221
|
+
await this.setState((0, import_stateMapping.getDpPath)("Regelung_Aktiv"), { val: false, ack: true });
|
|
222
|
+
} else if (config.operation_mode === "modbus") {
|
|
223
|
+
(0, import_logger.writeLog)("\u26A1 Operating Mode: READ/WRITE WITH MODBUS TCP (Hybrid).", "info");
|
|
224
|
+
await this.setState((0, import_stateMapping.getDpPath)("Regelung_Aktiv"), { val: config.regelung_aktiv === true, ack: true });
|
|
225
|
+
} else {
|
|
226
|
+
(0, import_logger.writeLog)("\u270D\uFE0F Operating Mode: READ/WRITE WITHOUT MODBUS (Native TCP Port 8889).", "info");
|
|
227
|
+
await this.setState((0, import_stateMapping.getDpPath)("Regelung_Aktiv"), { val: config.regelung_aktiv === true, ack: true });
|
|
228
|
+
}
|
|
198
229
|
const debugState = await this.getStateAsync((0, import_stateMapping.getDpPath)("Schreibe_Debug_Log"));
|
|
199
230
|
this.isDebugLogActive = (debugState == null ? void 0 : debugState.val) === true;
|
|
200
231
|
(0, import_logger.setCustomDebug)(this.isDebugLogActive);
|
|
201
|
-
await (0, import_zipManager.disableHardwareZipTimer)(this);
|
|
202
232
|
const cycleTodayState = await this.getStateAsync((0, import_stateMapping.getDpPath)("write_cycles_today"));
|
|
203
233
|
this.writeCyclesToday = cycleTodayState && typeof cycleTodayState.val === "number" ? cycleTodayState.val : 0;
|
|
204
234
|
const cycleTotalState = await this.getStateAsync((0, import_stateMapping.getDpPath)("write_cycles_total"));
|
|
205
235
|
this.writeCyclesTotal = cycleTotalState && typeof cycleTotalState.val === "number" ? cycleTotalState.val : 0;
|
|
206
236
|
this.scheduleMidnightReset();
|
|
207
|
-
|
|
208
|
-
|
|
237
|
+
if (!isReadOnly) {
|
|
238
|
+
await (0, import_zipManager.disableHardwareZipTimer)(this);
|
|
239
|
+
(0, import_zipManager.subscribeMotionSensors)(this);
|
|
240
|
+
await (0, import_pvManager.initPvManagement)(this);
|
|
241
|
+
}
|
|
209
242
|
this.subscribeStates("*");
|
|
210
243
|
this.modbusManager = new import_modbusManager.ModbusManager(this);
|
|
211
|
-
if (config.modbus_active) {
|
|
244
|
+
if (!isReadOnly && config.modbus_active) {
|
|
212
245
|
(0, import_logger.writeLog)("Checking Modbus TCP availability for hybrid operations...", "info");
|
|
213
246
|
await this.modbusManager.checkAvailability();
|
|
214
247
|
}
|
|
@@ -289,6 +322,10 @@ class Luxtronik2Controller extends utils.Adapter {
|
|
|
289
322
|
* @returns A promise that resolves when the synchronization task finishes.
|
|
290
323
|
*/
|
|
291
324
|
async syncConfigValue(mappingKey, val) {
|
|
325
|
+
const config = this.config;
|
|
326
|
+
if (config.operation_mode === "readonly") {
|
|
327
|
+
return;
|
|
328
|
+
}
|
|
292
329
|
if (val === void 0 || val === null) {
|
|
293
330
|
return;
|
|
294
331
|
}
|
|
@@ -298,7 +335,6 @@ class Luxtronik2Controller extends utils.Adapter {
|
|
|
298
335
|
}
|
|
299
336
|
const id = (0, import_stateMapping.getDpPath)(mappingKey);
|
|
300
337
|
const state = await this.getStateAsync(id);
|
|
301
|
-
const config = this.config;
|
|
302
338
|
let appliedFactor = definition.factor;
|
|
303
339
|
if (mappingKey === "heating_system_circ_pump_voltage_nominal" || mappingKey === "heating_system_circ_pump_voltage_minimal") {
|
|
304
340
|
appliedFactor = config.hup_voltage_factor !== void 0 ? Number(config.hup_voltage_factor) : 100;
|
|
@@ -427,6 +463,9 @@ class Luxtronik2Controller extends utils.Adapter {
|
|
|
427
463
|
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k;
|
|
428
464
|
try {
|
|
429
465
|
const config = this.config;
|
|
466
|
+
if (config.operation_mode === "readonly") {
|
|
467
|
+
return;
|
|
468
|
+
}
|
|
430
469
|
const bzState = await this.getStateAsync((0, import_stateMapping.getDpPath)("WP_BZ_akt"));
|
|
431
470
|
const bzVal = bzState && bzState.val !== null ? String(bzState.val).trim() : rawValues[80] !== void 0 ? String(rawValues[80]) : "";
|
|
432
471
|
const regelungAktivState = await this.getStateAsync((0, import_stateMapping.getDpPath)("Regelung_Aktiv"));
|
|
@@ -862,18 +901,25 @@ class Luxtronik2Controller extends utils.Adapter {
|
|
|
862
901
|
if (!state) {
|
|
863
902
|
return;
|
|
864
903
|
}
|
|
904
|
+
const config = this.config;
|
|
905
|
+
const isReadOnly = config.operation_mode === "readonly";
|
|
865
906
|
if (!id.startsWith(`${this.namespace}.`)) {
|
|
907
|
+
if (isReadOnly) {
|
|
908
|
+
return;
|
|
909
|
+
}
|
|
866
910
|
(0, import_pvManager.handlePvFeedInChange)(this, id, state);
|
|
867
911
|
}
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
912
|
+
if (!isReadOnly) {
|
|
913
|
+
const isMotionSensor = await (0, import_zipManager.checkAndHandleMotionSensor)(this, id, state);
|
|
914
|
+
if (isMotionSensor) {
|
|
915
|
+
return;
|
|
916
|
+
}
|
|
871
917
|
}
|
|
872
918
|
if (!id.startsWith(`${this.namespace}.`)) {
|
|
873
919
|
return;
|
|
874
920
|
}
|
|
875
921
|
if (state.ack) {
|
|
876
|
-
if (id.endsWith("WP_BZ_akt")) {
|
|
922
|
+
if (!isReadOnly && id.endsWith("WP_BZ_akt")) {
|
|
877
923
|
await (0, import_pvManager.handlePvCycleCheck)(this, Number(state.val));
|
|
878
924
|
}
|
|
879
925
|
return;
|
|
@@ -884,11 +930,34 @@ class Luxtronik2Controller extends utils.Adapter {
|
|
|
884
930
|
void (0, import_updateManager.checkFirmwareUpdate)(this);
|
|
885
931
|
return;
|
|
886
932
|
}
|
|
933
|
+
const mappingKey = id.split(".").pop();
|
|
934
|
+
const relativeId = id.replace(`${this.namespace}.`, "");
|
|
935
|
+
if (mappingKey === "Schreibe_Debug_Log") {
|
|
936
|
+
await this.setState(relativeId, { val: state.val, ack: true });
|
|
937
|
+
this.isDebugLogActive = state.val === true;
|
|
938
|
+
(0, import_logger.setCustomDebug)(this.isDebugLogActive);
|
|
939
|
+
(0, import_logger.writeLog)(
|
|
940
|
+
`Extended debugging telemetry logging mode has been ${this.isDebugLogActive ? "enabled" : "disabled"}.`,
|
|
941
|
+
"info"
|
|
942
|
+
);
|
|
943
|
+
return;
|
|
944
|
+
}
|
|
945
|
+
if (mappingKey === "Dump_Raw_To_Log" && state.val === true) {
|
|
946
|
+
await this.setState(relativeId, { val: false, ack: true });
|
|
947
|
+
await (0, import_rawFunctions.dumpAllRawToLog)(this);
|
|
948
|
+
return;
|
|
949
|
+
}
|
|
950
|
+
if (isReadOnly) {
|
|
951
|
+
(0, import_logger.writeLog)(
|
|
952
|
+
`[Read-Only] Write attempt to '${id}' blocked! Change Operating Mode in adapter settings to enable hardware writes.`,
|
|
953
|
+
"warn"
|
|
954
|
+
);
|
|
955
|
+
return;
|
|
956
|
+
}
|
|
887
957
|
if (id.startsWith(`${this.namespace}.Custom.`)) {
|
|
888
958
|
try {
|
|
889
959
|
const obj = await this.getObjectAsync(id);
|
|
890
960
|
if (obj && obj.native && obj.native.source === "parameter") {
|
|
891
|
-
const relativeId = id.replace(`${this.namespace}.`, "");
|
|
892
961
|
await this.setState(relativeId, { val: state.val, ack: true });
|
|
893
962
|
let valueToWrite = state.val;
|
|
894
963
|
if (obj.native.customType === "boolean") {
|
|
@@ -916,7 +985,6 @@ class Luxtronik2Controller extends utils.Adapter {
|
|
|
916
985
|
}
|
|
917
986
|
return;
|
|
918
987
|
}
|
|
919
|
-
const mappingKey = id.split(".").pop();
|
|
920
988
|
if (!mappingKey) {
|
|
921
989
|
return;
|
|
922
990
|
}
|
|
@@ -925,17 +993,6 @@ class Luxtronik2Controller extends utils.Adapter {
|
|
|
925
993
|
return;
|
|
926
994
|
}
|
|
927
995
|
try {
|
|
928
|
-
const relativeId = id.replace(`${this.namespace}.`, "");
|
|
929
|
-
if (mappingKey === "Schreibe_Debug_Log") {
|
|
930
|
-
await this.setState(relativeId, { val: state.val, ack: true });
|
|
931
|
-
this.isDebugLogActive = state.val === true;
|
|
932
|
-
(0, import_logger.setCustomDebug)(this.isDebugLogActive);
|
|
933
|
-
(0, import_logger.writeLog)(
|
|
934
|
-
`Extended debugging telemetry logging mode has been ${this.isDebugLogActive ? "enabled" : "disabled"}.`,
|
|
935
|
-
"info"
|
|
936
|
-
);
|
|
937
|
-
return;
|
|
938
|
-
}
|
|
939
996
|
if (mappingKey === "Regelung_Aktiv" || mappingKey === "zip_aktiv") {
|
|
940
997
|
await this.setState(relativeId, { val: state.val, ack: true });
|
|
941
998
|
return;
|
|
@@ -946,11 +1003,6 @@ class Luxtronik2Controller extends utils.Adapter {
|
|
|
946
1003
|
await this.setIdleDefaults();
|
|
947
1004
|
return;
|
|
948
1005
|
}
|
|
949
|
-
if (mappingKey === "Dump_Raw_To_Log" && state.val === true) {
|
|
950
|
-
await this.setState(relativeId, { val: false, ack: true });
|
|
951
|
-
await (0, import_rawFunctions.dumpAllRawToLog)(this);
|
|
952
|
-
return;
|
|
953
|
-
}
|
|
954
1006
|
if (mappingKey === "Zwangswarmwasser") {
|
|
955
1007
|
if (state.val === true) {
|
|
956
1008
|
await (0, import_actionHandlers.handleZwangswarmwasser)(this, id);
|
|
@@ -974,7 +1026,6 @@ class Luxtronik2Controller extends utils.Adapter {
|
|
|
974
1026
|
}
|
|
975
1027
|
return;
|
|
976
1028
|
}
|
|
977
|
-
const config = this.config;
|
|
978
1029
|
const isModbusEnabled = Boolean(
|
|
979
1030
|
this.modbusManager && this.modbusManager.isAvailable && config.modbus_active && definition.modbus && config[definition.modbus.configKey] === true
|
|
980
1031
|
);
|
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 * as schedule from 'node-schedule';\nimport { handleZwangsheizen, handleZwangswarmwasser } from './actionHandlers';\nimport { initAutoBackup, stopAutoBackup } from './backupManager';\nimport { formatTimerSecondsToTime, timeStringToSeconds } from './convert';\nimport { processCopData } from './copManager';\nimport { handleHupOptimization } from './hupManager';\nimport { initLogger, setCustomDebug, writeLog } from './logger';\nimport { ModbusManager } from './modbusManager';\nimport {\n\tcheckAndSendErrorNotifications,\n\tcheckAndSendOutageNotifications,\n\thandleTestMessage,\n\tsendTelegramNotification,\n} from './notificationManager';\nimport {\n\tcleanupCustomStates,\n\tcleanupEmptyFolders,\n\tcleanupStates,\n\tensureAllObjectsExist,\n\tensureCustomObjectsExist,\n\tisStateEnabled,\n} from './objectManager';\nimport {\n\tevaluatePvBoost,\n\tforceResetPvBoost,\n\thandlePvCycleCheck,\n\thandlePvFeedInChange,\n\tinitPvManagement,\n\tpvIsBoostActive,\n} from './pvManager';\n\nimport { dumpAllRawToLog, queueWrite, readAllRaw } from './rawFunctions';\nimport { STATE_MAPPING, getDpPath } from './stateMapping';\nimport { generateHeatCurveSVG } from './svgGenerator';\nimport type { LuxtronikAdapter } from './types';\nimport { checkFirmwareUpdate } from './updateManager';\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 implements LuxtronikAdapter {\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//* Known Visibilities */\n\tpublic currentVisibilities: number[] = [];\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\tpublic 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/** Modbus Manager f\u00FCr hybride Schreib- und Lesevorg\u00E4nge (SmartGrid / Vorlauf / ZIP) */\n\tpublic modbusManager!: ModbusManager;\n\t/** ioBroker interval handle for the ZIP remaining time countdown */\n\tpublic zipCountdownInterval?: ioBroker.Interval;\n\t/** Target timestamp when the current ZIP run finishes */\n\tpublic zipEndTime?: number;\n\t/** Cron-Job Handle f\u00FCr die Firmware-Update-Pr\u00FCfung */\n\tpublic updateCronJob?: schedule.Job;\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\tprivate async onMessage(obj: ioBroker.Message): Promise<void> {\n\t\tif (obj.command === 'testTelegram') {\n\t\t\tawait handleTestMessage(this, obj);\n\t\t} else if (obj.command === 'getHeatCurve') {\n\t\t\ttry {\n\t\t\t\tlet fp = 21.7;\n\t\t\t\tlet ep = 23.0;\n\n\t\t\t\t// Werte aus der Config-UI auslesen\n\t\t\t\tif (obj.message && typeof obj.message === 'object') {\n\t\t\t\t\tconst msg = obj.message as Record<string, any>;\n\t\t\t\t\tif (msg.fusspunkt !== undefined) {\n\t\t\t\t\t\tfp = parseFloat(msg.fusspunkt);\n\t\t\t\t\t}\n\t\t\t\t\tif (msg.endpunkt !== undefined) {\n\t\t\t\t\t\tep = parseFloat(msg.endpunkt);\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\t// Fallbacks, falls der Nutzer Quatsch eintippt\n\t\t\t\tif (isNaN(fp)) {\n\t\t\t\t\tfp = 21.7;\n\t\t\t\t}\n\t\t\t\tif (isNaN(ep)) {\n\t\t\t\t\tep = 23.0;\n\t\t\t\t}\n\n\t\t\t\t// SVG generieren und als Base64-Bild verpacken\n\t\t\t\tconst svg = generateHeatCurveSVG(fp, ep);\n\t\t\t\tconst base64 = `data:image/svg+xml;base64,${Buffer.from(svg).toString('base64')}`;\n\n\t\t\t\t// Bild zur\u00FCck an die Benutzeroberfl\u00E4che schicken!\n\t\t\t\tif (obj.callback) {\n\t\t\t\t\tthis.sendTo(obj.from, obj.command, base64, obj.callback);\n\t\t\t\t}\n\t\t\t} catch (err: any) {\n\t\t\t\tthis.log.error(`Error generating heat curve: ${err.message}`);\n\t\t\t}\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\t// 1. Config als Record casten, um TypeScript-Fehler zu vermeiden\n\t\tconst config = this.config as Record<string, any>;\n\n\t\t// =========================================================\n\t\t// MIGRATION: ZIP Control Mode (Bestandsnutzer abfangen)\n\t\t// =========================================================\n\t\tlet configUpdated = false;\n\t\tif (config.zip_control_mode === undefined) {\n\t\t\tlet migratedMode = 'controller'; // Default\n\n\t\t\tconst actors = config.actors || [];\n\t\t\tconst validActors = actors.filter(\n\t\t\t\t(a: any) => a.zip_external_relay_id && a.zip_external_relay_id.trim() !== '',\n\t\t\t);\n\n\t\t\tif (validActors.length > 0) {\n\t\t\t\tmigratedMode = 'actor';\n\t\t\t} else if (config.modbus_active && config.sync_modbus_coil_7) {\n\t\t\t\tmigratedMode = 'modbus';\n\t\t\t}\n\n\t\t\tconfig.zip_control_mode = migratedMode;\n\t\t\tconfigUpdated = true;\n\t\t\twriteLog(`[Migration] Updated zip_control_mode to '${migratedMode}' based on legacy settings.`, 'info');\n\t\t}\n\n\t\t// Falls migriert wurde -> direkt in der ioBroker-Datenbank speichern\n\t\tif (configUpdated) {\n\t\t\ttry {\n\t\t\t\tconst obj = await this.getForeignObjectAsync(`system.adapter.${this.namespace}`);\n\t\t\t\tif (obj && obj.native) {\n\t\t\t\t\tobj.native.zip_control_mode = config.zip_control_mode;\n\t\t\t\t\tawait this.setForeignObject(`system.adapter.${this.namespace}`, obj);\n\t\t\t\t}\n\t\t\t} catch (err: any) {\n\t\t\t\twriteLog(`[Migration] Failed to save updated config: ${err.message}`, 'error');\n\t\t\t}\n\t\t}\n\t\t// =========================================================\n\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\t// Visibilities einmalig beim Start abfragen f\u00FCr den intelligenten Objekt-Filter\n\t\t// (Wird nur ausgef\u00FChrt, wenn der Nutzer die Funktion in den Settings nicht deaktiviert hat)\n\t\tif (config.filter_visibility !== false) {\n\t\t\ttry {\n\t\t\t\tthis.currentVisibilities = await readAllRaw(this, 3005);\n\t\t\t\tif (this.isDebugLogActive) {\n\t\t\t\t\twriteLog(\n\t\t\t\t\t\t`Successfully loaded ${this.currentVisibilities.length} visibility flags from heat pump.`,\n\t\t\t\t\t\t'debug',\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t} catch (err: any) {\n\t\t\t\twriteLog(\n\t\t\t\t\t`Could not load visibility flags (Command 3005). Assuming all parameters are visible. Error: ${err.message}`,\n\t\t\t\t\t'warn',\n\t\t\t\t);\n\t\t\t\tthis.currentVisibilities = [];\n\t\t\t}\n\t\t} else {\n\t\t\t// Nutzer hat den Filter deaktiviert -> Array bleibt leer, alles wird angezeigt\n\t\t\tthis.currentVisibilities = [];\n\t\t}\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\t\tinitAutoBackup(this);\n\t\tawait this.subscribeStatesAsync('Information.12_SystemInfo.check_firmware');\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\t// PV-Steuerung initialisieren\n\t\tawait initPvManagement(this);\n\n\t\tthis.subscribeStates('*');\n\n\t\t// --- MODBUS HYBRID INITIALISIERUNG (Vor dem ersten updateData-Aufruf) ---\n\t\tthis.modbusManager = new ModbusManager(this);\n\t\tif (config.modbus_active) {\n\t\t\twriteLog('Checking Modbus TCP availability for hybrid operations...', 'info');\n\t\t\tawait this.modbusManager.checkAvailability();\n\t\t}\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\t// Virtuelle ZIP-Datenpunkte beim Start initialisieren, um 'null' Werte zu vermeiden\n\t\tconst dpActivateZip = getDpPath('Activate_Zip');\n\t\tif (dpActivateZip) {\n\t\t\tawait this.setState(dpActivateZip, { val: false, ack: true });\n\t\t}\n\n\t\tconst dpVirtualZipStatus = getDpPath('Virtual_ZIP_Status');\n\t\tif (dpVirtualZipStatus) {\n\t\t\tawait this.setState(dpVirtualZipStatus, { val: false, ack: true });\n\t\t}\n\n\t\tconst dpVirtualZipRemaining = getDpPath('Virtual_ZIP_Remaining_Time');\n\t\tif (dpVirtualZipRemaining) {\n\t\t\tawait this.setState(dpVirtualZipRemaining, { val: 0, ack: true });\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\t// --- FIRMWARE UPDATE TIMER ---\n\t\tif (config.update_check_active === true) {\n\t\t\t// Erste Pr\u00FCfung 15 Sekunden nach Adapter-Start (damit die aktuelle Firmware bereits gelesen wurde)\n\t\t\tthis.setTimeout(() => {\n\t\t\t\tvoid checkFirmwareUpdate(this);\n\t\t\t}, 15000);\n\n\t\t\t// Cronjob f\u00FCr regelm\u00E4\u00DFige Pr\u00FCfungen einrichten\n\t\t\tconst cronString = config.update_check_cron || '0 12 * * *';\n\t\t\ttry {\n\t\t\t\tthis.updateCronJob = schedule.scheduleJob(cronString, () => {\n\t\t\t\t\tthis.log.info('F\u00FChre geplante Firmware-Update-Pr\u00FCfung aus (Cron)...');\n\t\t\t\t\tvoid checkFirmwareUpdate(this);\n\t\t\t\t});\n\t\t\t} catch (err: any) {\n\t\t\t\tthis.log.error(`Fehler beim Einrichten des Firmware-Update-Crons (${cronString}): ${err.message}`);\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 * Automatically routes via Modbus TCP if hybrid mode is enabled for the target datapoint.\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 definition = STATE_MAPPING[mappingKey];\n\t\tif (!definition) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst id = getDpPath(mappingKey);\n\t\tconst state = await this.getStateAsync(id);\n\n\t\tconst config = this.config as Record<string, any>;\n\t\tlet appliedFactor = definition.factor;\n\t\tif (\n\t\t\tmappingKey === 'heating_system_circ_pump_voltage_nominal' ||\n\t\t\tmappingKey === 'heating_system_circ_pump_voltage_minimal'\n\t\t) {\n\t\t\tappliedFactor = config.hup_voltage_factor !== undefined ? Number(config.hup_voltage_factor) : 100;\n\t\t}\n\n\t\tlet valueToWrite: any = val;\n\t\tif (typeof valueToWrite === 'boolean') {\n\t\t\tvalueToWrite = valueToWrite ? 1 : 0;\n\t\t} else if (appliedFactor && typeof val === 'number') {\n\t\t\tvalueToWrite = val * appliedFactor;\n\t\t}\n\n\t\tconst isRawWrite =\n\t\t\tdefinition.dataSource === 'raw_parameter' ||\n\t\t\tdefinition.dataSource === 'raw_value' ||\n\t\t\t(!definition.dataSource && /^\\d+$/.test(definition.luxWriteId || ''));\n\t\tif (isRawWrite && definition.unit === '\u00B0C' && typeof val === 'number' && !appliedFactor) {\n\t\t\tvalueToWrite = val * 10;\n\t\t}\n\n\t\tconst writeId = definition.luxWriteId ? parseInt(definition.luxWriteId, 10) : NaN;\n\t\tconst hardwareOutOfSync =\n\t\t\t!definition.isVirtual &&\n\t\t\t!isNaN(writeId) &&\n\t\t\twriteId < 9990 &&\n\t\t\tthis.currentRawParams.length > writeId &&\n\t\t\tthis.currentRawParams[writeId] !== Math.round(Number(valueToWrite));\n\n\t\tif (!state || state.val !== val || hardwareOutOfSync) {\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\tconst isModbusEnabled = Boolean(\n\t\t\t\tthis.modbusManager &&\n\t\t\t\tthis.modbusManager.isAvailable &&\n\t\t\t\tconfig.modbus_active &&\n\t\t\t\tdefinition.modbus &&\n\t\t\t\tconfig[definition.modbus.configKey] === true,\n\t\t\t);\n\n\t\t\tif ((definition.write === true || isModbusEnabled) && !definition.isVirtual && definition.luxWriteId) {\n\t\t\t\ttry {\n\t\t\t\t\tif (isModbusEnabled && definition.modbus) {\n\t\t\t\t\t\tconst isCoil = definition.modbus.type === 'coil';\n\t\t\t\t\t\tawait this.modbusManager.writeRegister(\n\t\t\t\t\t\t\tdefinition.modbus.register,\n\t\t\t\t\t\t\tNumber(valueToWrite),\n\t\t\t\t\t\t\tisCoil,\n\t\t\t\t\t\t);\n\t\t\t\t\t} else if (!isNaN(writeId) && writeId < 9990) {\n\t\t\t\t\t\tawait queueWrite(this, writeId, valueToWrite);\n\t\t\t\t\t}\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\n\t\t\t// FIX: Hier nicht mehr hart auf 0, sondern auf deinen eigenen Config-Wert setzen\n\t\t\tawait this.syncConfigValue('heating_temperature', config.sync_heating_temperature ?? 0);\n\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('temperature_hot_water_target', 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\n\t\t\t// WICHTIG: Wenn der PV-Boost aktiv ist, PV-Sollwerte sofort wieder \u00FCber die Leerlauf-Werte b\u00FCgeln!\n\t\t\tif (pvIsBoostActive) {\n\t\t\t\tawait evaluatePvBoost(this, true);\n\t\t\t}\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 * @param rawValues - Optional raw telemetry values array from command 3004 as fallback.\n\t * @param rawParams - Optional raw parameters array from command 3003 as fallback.\n\t * @returns A promise that resolves when the execution cycle finishes.\n\t */\n\tprivate async runOptimizationSchedule(rawValues: number[] = [], rawParams: number[] = []): 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 =\n\t\t\t\tbzState && bzState.val !== null\n\t\t\t\t\t? String(bzState.val).trim()\n\t\t\t\t\t: rawValues[80] !== undefined\n\t\t\t\t\t\t? String(rawValues[80])\n\t\t\t\t\t\t: '';\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 (this.lastBzVal === '1' && config.idle_defaults_aktiv === true) {\n\t\t\t\t\t\tawait this.syncConfigValue(\n\t\t\t\t\t\t\t'temperature_hot_water_target',\n\t\t\t\t\t\t\tconfig.sync_warmwater_target_temperature ?? 54,\n\t\t\t\t\t\t);\n\t\t\t\t\t\tif (pvIsBoostActive) {\n\t\t\t\t\t\t\tawait evaluatePvBoost(this, true);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\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}\n\t\t\t\t\tif (config.hup_optimierung_aktiv === true) {\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\tconst mode = config.zip_control_mode || 'controller';\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\tconst canRunWearFree =\n\t\t\t\t\t\t\t(mode === 'actor' && validActors.length > 0) ||\n\t\t\t\t\t\t\t(mode === 'modbus' && this.modbusManager?.isAvailable);\n\n\t\t\t\t\t\tif (canRunWearFree) {\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] Wear-free mode (${mode}) active. Starting circulation synchronous to hot water generation.`,\n\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tawait this.syncConfigValue('zip_aktiv', config.zip_aktiv_ww ?? 120);\n\t\t\t\t\t\t\tawait this.setOwnStateIfDifferent(getDpPath('Activate_Zip'), true, false);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\tif (config.hup_optimierung_aktiv === true) {\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\twwTargetParamState,\n\t\t\t\twwIstState,\n\t\t\t\truecklaufState,\n\t\t\t\tspreizungState,\n\t\t\t\tvd1State,\n\t\t\t\twwHystereseState,\n\t\t\t\truecklaufSollState,\n\t\t\t\tcurrentHupVoltState,\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('temperature_hot_water_target')),\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('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('heating_system_circ_pump_voltage_nominal')),\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\t// Sichere Auswertung mit Rohdaten-Fallback (falls Datenpunkte im Objektbaum deaktiviert sind)\n\t\t\tconst wwSoll =\n\t\t\t\ttypeof wwSollState?.val === 'number'\n\t\t\t\t\t? wwSollState.val\n\t\t\t\t\t: typeof wwTargetParamState?.val === 'number'\n\t\t\t\t\t\t? wwTargetParamState.val\n\t\t\t\t\t\t: rawValues[18] !== undefined\n\t\t\t\t\t\t\t? rawValues[18] / 10\n\t\t\t\t\t\t\t: rawParams[105] !== undefined\n\t\t\t\t\t\t\t\t? rawParams[105] / 10\n\t\t\t\t\t\t\t\t: 54;\n\t\t\tconst wwIst =\n\t\t\t\ttypeof wwIstState?.val === 'number'\n\t\t\t\t\t? wwIstState.val\n\t\t\t\t\t: rawValues[17] !== undefined\n\t\t\t\t\t\t? rawValues[17] / 10\n\t\t\t\t\t\t: 0;\n\t\t\tconst ruecklauf =\n\t\t\t\ttypeof ruecklaufState?.val === 'number'\n\t\t\t\t\t? ruecklaufState.val\n\t\t\t\t\t: rawValues[11] !== undefined\n\t\t\t\t\t\t? rawValues[11] / 10\n\t\t\t\t\t\t: 0;\n\t\t\tconst ruecklaufSoll =\n\t\t\t\ttypeof ruecklaufSollState?.val === 'number'\n\t\t\t\t\t? ruecklaufSollState.val\n\t\t\t\t\t: rawValues[12] !== undefined\n\t\t\t\t\t\t? rawValues[12] / 10\n\t\t\t\t\t\t: 0;\n\t\t\tconst spreizung =\n\t\t\t\ttypeof spreizungState?.val === 'number'\n\t\t\t\t\t? spreizungState.val\n\t\t\t\t\t: rawValues[10] !== undefined && rawValues[11] !== undefined\n\t\t\t\t\t\t? (rawValues[10] - rawValues[11]) / 10\n\t\t\t\t\t\t: 0;\n\n\t\t\t// FIX: VD1out kann im State als boolean (true) oder number (1) vorliegen!\n\t\t\tconst vd1 =\n\t\t\t\tvd1State?.val !== undefined && vd1State?.val !== null\n\t\t\t\t\t? vd1State.val === 1 || vd1State.val === true || String(vd1State.val).toLowerCase() === 'true'\n\t\t\t\t\t: rawValues[44] === 1;\n\n\t\t\tconst wwHysterese =\n\t\t\t\ttypeof wwHystereseState?.val === 'number'\n\t\t\t\t\t? wwHystereseState.val\n\t\t\t\t\t: rawParams[74] !== undefined\n\t\t\t\t\t\t? rawParams[74] / 10\n\t\t\t\t\t\t: 2.0;\n\t\t\tconst currentHupVolt = (currentHupVoltState?.val as number) ?? 7.0;\n\t\t\tconst heizenHysterese =\n\t\t\t\ttypeof heizenHystereseState?.val === 'number'\n\t\t\t\t\t? heizenHystereseState.val\n\t\t\t\t\t: rawParams[88] !== undefined\n\t\t\t\t\t\t? rawParams[88] / 10\n\t\t\t\t\t\t: 1.5;\n\t\t\tconst mitteltemperatur =\n\t\t\t\ttypeof mitteltempState?.val === 'number'\n\t\t\t\t\t? mitteltempState.val\n\t\t\t\t\t: rawValues[16] !== undefined\n\t\t\t\t\t\t? rawValues[16] / 10\n\t\t\t\t\t\t: 0;\n\t\t\tconst thresholdHeatingLimit =\n\t\t\t\ttypeof thresholdHeatingLimitState?.val === 'number'\n\t\t\t\t\t? thresholdHeatingLimitState.val\n\t\t\t\t\t: rawParams[700] !== undefined\n\t\t\t\t\t\t? rawParams[700] / 10\n\t\t\t\t\t\t: 15;\n\n\t\t\t// FIX: heatingLimit typsicher auf Boolean (true/false) UND Number (1/0) pr\u00FCfen!\n\t\t\tconst isHeatingLimitEnabled =\n\t\t\t\theatingLimitState?.val !== undefined && heatingLimitState?.val !== null\n\t\t\t\t\t? heatingLimitState.val === 1 ||\n\t\t\t\t\t\theatingLimitState.val === true ||\n\t\t\t\t\t\tString(heatingLimitState.val) === '1' ||\n\t\t\t\t\t\tString(heatingLimitState.val).toLowerCase() === 'true'\n\t\t\t\t\t: rawParams[699] === 1;\n\n\t\t\tconst nachWasser = Boolean(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 (aelterAls10 && vd1) {\n\t\t\t\t\tconst fusspunktState = await this.getStateAsync(getDpPath('heating_curve_parallel_offset'));\n\t\t\t\t\tconst currentFusspunkt =\n\t\t\t\t\t\ttypeof fusspunktState?.val === 'number'\n\t\t\t\t\t\t\t? fusspunktState.val\n\t\t\t\t\t\t\t: rawParams[13] !== undefined\n\t\t\t\t\t\t\t\t? rawParams[13] / 10\n\t\t\t\t\t\t\t\t: 0;\n\t\t\t\t\tif (currentFusspunkt === 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 (aelterAls10 && vd1) {\n\t\t\t\t\tthis.lastPumpOptimization = await handleHupOptimization(\n\t\t\t\t\t\tthis,\n\t\t\t\t\t\tistHeizen,\n\t\t\t\t\t\tspreizung,\n\t\t\t\t\t\tcurrentHupVolt,\n\t\t\t\t\t\tthis.lastPumpOptimization,\n\t\t\t\t\t);\n\t\t\t\t}\n\n\t\t\t\tif (isRegelungAktiv) {\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 am Ende des Heiztaktes erzwingen\n\t\t\t\t\tif (wwSoll - wwIst > 2 && ruecklauf >= ruecklaufSoll + heizenHysterese - 0.1) {\n\t\t\t\t\t\tlet forceSoll = wwIst + wwHysterese + 1.5;\n\n\t\t\t\t\t\t// Handshake mit dem PV-Manager:\n\t\t\t\t\t\t// Wenn PV aktiv ist, stellen wir sicher, dass der Takt mindestens bis zum PV-Sollwert gefahren wird\n\t\t\t\t\t\tif (pvIsBoostActive) {\n\t\t\t\t\t\t\tconst baseWw =\n\t\t\t\t\t\t\t\tparseFloat(String(config.sync_warmwater_target_temperature).replace(',', '.')) || 54;\n\t\t\t\t\t\t\tconst boostWw = parseFloat(String(config.pv_boost_ww).replace(',', '.')) || 0;\n\t\t\t\t\t\t\tconst pvTarget = baseWw + boostWw;\n\n\t\t\t\t\t\t\t// Nimmt den h\u00F6heren Wert: Entweder das regul\u00E4re PV-Ziel (z.B. 60) oder\n\t\t\t\t\t\t\t// den Wert, der minimal n\u00F6tig ist, um den Takt jetzt k\u00FCnstlich anzusto\u00DFen (z.B. 60.5)\n\t\t\t\t\t\t\tforceSoll = Math.max(forceSoll, pvTarget);\n\t\t\t\t\t\t}\n\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\t\t\t\t\t\tawait this.syncConfigValue('temperature_hot_water_target', forceSoll);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// Typsichere Pr\u00FCfung, ob die Heizgrenze das Heizen erlaubt\n\t\t\tconst isHeatingAllowedByLimit = !isHeatingLimitEnabled || mitteltemperatur < thresholdHeatingLimit;\n\n\t\t\tif (istWarmwasser && nachWasser) {\n\t\t\t\tif (isRegelungAktiv && isHeatingAllowedByLimit) {\n\t\t\t\t\tawait this.syncConfigValue('heating_curve_parallel_offset', 35);\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 (wwSoll - wwIst >= wwHysterese - 1.5 && ruecklauf <= ruecklaufSoll && isHeatingAllowedByLimit) {\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`[CycleOpt] Pre-starting heating before WW (WW: ${wwIst}/${wwSoll}\u00B0C, Hyst: ${wwHysterese}K, RL: ${ruecklauf}/${ruecklaufSoll}\u00B0C). Setting base point to 35\u00B0C.`,\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 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\n\t\t// Schreibvorg\u00E4nge haben absolute Priorit\u00E4t!\n\t\t// Wenn gerade geschrieben wird, \u00FCberspringen wir den Lese-Zyklus,\n\t\t// um alte Anlagen vor abst\u00FCrzenden Netzwerk-Sockets zu sch\u00FCtzen.\n\t\tif (this.isWriting) {\n\t\t\tif (this.isDebugLogActive) {\n\t\t\t\tthis.log.debug('Skipping read cycle because a write operation is currently in progress.');\n\t\t\t}\n\t\t\treturn;\n\t\t}\n\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\tconst config = this.config as Record<string, any>;\n\n\t\t\t// Alle Modbus-Register (Holdings 0..23 & Coils 0..13) in einem Batch aus dem RAM lesen\n\t\t\tconst modbusData =\n\t\t\t\tconfig.modbus_active && this.modbusManager?.isAvailable\n\t\t\t\t\t? await this.modbusManager.readAllRegisters()\n\t\t\t\t\t: null;\n\n\t\t\tthis.errorCount = 0;\n\t\t\tawait this.setState('info.connection', { val: true, ack: true });\n\t\t\tawait this.setState('info.lastUpdate', { val: new Date().toISOString(), ack: true });\n\n\t\t\tconst statePromises: Promise<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, this.currentVisibilities)) {\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\t// DYNAMISCHER FAKTOR F\u00DCR HUP\n\t\t\t\tlet appliedFactor = definition.factor;\n\t\t\t\tif (\n\t\t\t\t\tkey === 'heating_system_circ_pump_voltage_nominal' ||\n\t\t\t\t\tkey === 'heating_system_circ_pump_voltage_minimal'\n\t\t\t\t) {\n\t\t\t\t\tappliedFactor = config.hup_voltage_factor !== undefined ? Number(config.hup_voltage_factor) : 100;\n\t\t\t\t}\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 && appliedFactor) {\n\t\t\t\t\t\t\t\tvalue /= appliedFactor;\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 && appliedFactor) {\n\t\t\t\t\t\t\t\tvalue /= appliedFactor;\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 && appliedFactor) {\n\t\t\t\t\t\t\tvalue /= appliedFactor;\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\t// =========================================================\n\t\t\t\t// MODBUS LIVE-SYNC (Aktualisiert alle aktivierten Modbus-Werte)\n\t\t\t\t// =========================================================\n\t\t\t\tif (\n\t\t\t\t\tmodbusData &&\n\t\t\t\t\tconfig.modbus_active &&\n\t\t\t\t\tdefinition.modbus &&\n\t\t\t\t\tconfig[definition.modbus.configKey] === true\n\t\t\t\t) {\n\t\t\t\t\tconst reg = definition.modbus.register;\n\t\t\t\t\tif (definition.modbus.type === 'holding' && modbusData.holdings[reg] !== undefined) {\n\t\t\t\t\t\tvalue = modbusData.holdings[reg];\n\t\t\t\t\t\tif (appliedFactor) {\n\t\t\t\t\t\t\tvalue /= appliedFactor;\n\t\t\t\t\t\t} else if (definition.unit === '\u00B0C') {\n\t\t\t\t\t\t\tvalue /= 10;\n\t\t\t\t\t\t}\n\t\t\t\t\t} else if (definition.modbus.type === 'coil' && modbusData.coils[reg] !== undefined) {\n\t\t\t\t\t\tvalue = modbusData.coils[reg] ? 1 : 0;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\t// =========================================================\n\n\t\t\t\tif (value !== undefined && typeof value === 'number' && appliedFactor) {\n\t\t\t\t\tvalue = Math.round(value * 100) / 100;\n\t\t\t\t}\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\n\t\t\t\t\t// ANTI-FLAPPING-SCHUTZ: Verhindert, dass die Hauptschleife Energiez\u00E4hler auf 0 st\u00FCrzen l\u00E4sst\n\t\t\t\t\tif (\n\t\t\t\t\t\ttypeof value === 'number' &&\n\t\t\t\t\t\t(key.toLowerCase().includes('energy') ||\n\t\t\t\t\t\t\tkey.toLowerCase().includes('w\u00E4rme') ||\n\t\t\t\t\t\t\tkey.toLowerCase().includes('power'))\n\t\t\t\t\t) {\n\t\t\t\t\t\tstatePromises.push(\n\t\t\t\t\t\t\t(async () => {\n\t\t\t\t\t\t\t\tconst oldState = await this.getStateAsync(stateId);\n\t\t\t\t\t\t\t\tif (oldState && typeof oldState.val === 'number' && value < oldState.val) {\n\t\t\t\t\t\t\t\t\treturn; // T\u00FCrsteher: Der neue Wert ist kleiner als der alte -> Ignorieren!\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tawait this.setState(stateId, { val: value, ack: true });\n\t\t\t\t\t\t\t})(),\n\t\t\t\t\t\t);\n\t\t\t\t\t} else {\n\t\t\t\t\t\tstatePromises.push(this.setState(stateId, { val: value, ack: true }));\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tawait Promise.all(statePromises);\n\t\t\tawait calculateTotalThermalEnergy(this, rawValues);\n\t\t\tawait calculateTotalEnergy(this, rawValues);\n\n\t\t\t// ----------------------------------------------------\n\t\t\t// Fehler-Historie abarbeiten & Alarmieren\n\t\t\t// ----------------------------------------------------\n\t\t\tconst fehlerDp = getDpPath('Fehlerspeicher');\n\t\t\tconst oldFehlerState = fehlerDp ? await this.getStateAsync(fehlerDp) : null;\n\t\t\tconst oldFehlerVal = oldFehlerState?.val as string | undefined;\n\n\t\t\tawait updateErrorHistory(this, rawValues);\n\n\t\t\tconst newFehlerState = fehlerDp ? await this.getStateAsync(fehlerDp) : null;\n\t\t\tconst newFehlerVal = newFehlerState?.val as string | undefined;\n\n\t\t\tawait checkAndSendErrorNotifications(this, oldFehlerVal, newFehlerVal);\n\n\t\t\t// ----------------------------------------------------\n\t\t\t// Abschalt-Historie abarbeiten & Alarmieren (Durchfluss)\n\t\t\t// ----------------------------------------------------\n\t\t\tconst abschaltungDp = getDpPath('Abschaltungen');\n\t\t\tconst oldAbschaltungState = abschaltungDp ? await this.getStateAsync(abschaltungDp) : null;\n\t\t\tconst oldAbschaltungVal = oldAbschaltungState?.val as string | undefined;\n\n\t\t\tawait updateOutageHistory(this, rawValues);\n\n\t\t\tconst newAbschaltungState = abschaltungDp ? await this.getStateAsync(abschaltungDp) : null;\n\t\t\tconst newAbschaltungVal = newAbschaltungState?.val as string | undefined;\n\n\t\t\tawait checkAndSendOutageNotifications(this, oldAbschaltungVal, newAbschaltungVal);\n\t\t\t// ----------------------------------------------------\n\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\n\t\t\t// Aktuellen Betriebszustand aus dem Cache oder live holen\n\t\t\tconst bzState = await this.getStateAsync(getDpPath('WP_BZ_akt'));\n\t\t\tconst currentBzVal = bzState && bzState.val !== null ? String(bzState.val).trim() : '';\n\n\t\t\twriteLog(`=> Rufe jetzt den COP Manager auf. BZ ist: ${currentBzVal}`, 'debug');\n\t\t\tawait processCopData(this, currentBzVal);\n\n\t\t\tawait this.runOptimizationSchedule(rawValues, rawParams);\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\tthis.clearTimeout(this.zipTimer);\n\t\t\t}\n\t\t\tif (this.zipCountdownInterval) {\n\t\t\t\tthis.clearInterval(this.zipCountdownInterval);\n\t\t\t}\n\n\t\t\tif (this.updateCronJob) {\n\t\t\t\tthis.updateCronJob.cancel();\n\t\t\t}\n\n\t\t\tstopAutoBackup(this);\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// 1. Fremd-Datenpunkte (PV-\u00DCberschuss etc.) abfangen\n\t\tif (!id.startsWith(`${this.namespace}.`)) {\n\t\t\t// An PV-Manager weiterleiten (wird synchron verarbeitet)\n\t\t\thandlePvFeedInChange(this, id, state);\n\t\t}\n\n\t\t// Bewegungsmelder an den Manager auslagern (k\u00F6nnen technisch eigene oder fremde OIDs sein)\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\t// Falls wir hier noch bei einem Fremd-Datenpunkt sind, brechen wir ab\n\t\t// (eigene Logik unten ist nur f\u00FCr den internen Adapter-Namespace!)\n\t\tif (!id.startsWith(`${this.namespace}.`)) {\n\t\t\treturn;\n\t\t}\n\n\t\tif (state.ack) {\n\t\t\t// PV-Sicherheits-Check beim Verdichter-Status (nur bei Ack=true, wenn der Wert echt von der WP kommt)\n\t\t\tif (id.endsWith('WP_BZ_akt')) {\n\t\t\t\tawait handlePvCycleCheck(this, Number(state.val));\n\t\t\t}\n\t\t\treturn;\n\t\t}\n\n\t\tif (id.endsWith('check_firmware') && state.val === true) {\n\t\t\tthis.log.info('Manuelle Firmware-Update-Pr\u00FCfung durch Benutzer gestartet...');\n\n\t\t\t// Button direkt wieder auf false zur\u00FCcksetzen, um Doppel-Trigger zu blockieren\n\t\t\tvoid this.setState(id, false, true);\n\n\t\t\t// Update-Pr\u00FCfung starten\n\t\t\tvoid checkFirmwareUpdate(this);\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\n\t\t\t\t// FIX: Bricht einen eventuell laufenden PV-Boost hart ab, bevor die Standardwerte geladen werden\n\t\t\t\tawait forceResetPvBoost(this);\n\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\tconst config = this.config as Record<string, any>;\n\t\t\tconst isModbusEnabled = Boolean(\n\t\t\t\tthis.modbusManager &&\n\t\t\t\tthis.modbusManager.isAvailable &&\n\t\t\t\tconfig.modbus_active &&\n\t\t\t\tdefinition.modbus &&\n\t\t\t\tconfig[definition.modbus.configKey] === true,\n\t\t\t);\n\n\t\t\tif (!definition.luxWriteId || (definition.write !== true && !isModbusEnabled)) {\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 appliedFactor = definition.factor;\n\t\t\tif (\n\t\t\t\tmappingKey === 'heating_system_circ_pump_voltage_nominal' ||\n\t\t\t\tmappingKey === 'heating_system_circ_pump_voltage_minimal'\n\t\t\t) {\n\t\t\t\tappliedFactor = config.hup_voltage_factor !== undefined ? Number(config.hup_voltage_factor) : 100;\n\t\t\t}\n\n\t\t\tlet valueToWrite: any = state.val;\n\n\t\t\tif (typeof valueToWrite === 'boolean') {\n\t\t\t\tvalueToWrite = valueToWrite ? 1 : 0;\n\t\t\t} else if (\n\t\t\t\tdefinition.isDurationFormat ||\n\t\t\t\tdefinition.role === 'value.datetime' ||\n\t\t\t\tdefinition.role === 'value.time'\n\t\t\t) {\n\t\t\t\tvalueToWrite = timeStringToSeconds(state.val);\n\t\t\t} else if (appliedFactor && typeof state.val === 'number') {\n\t\t\t\tvalueToWrite = state.val * appliedFactor;\n\t\t\t}\n\n\t\t\tif (definition.unit === '\u00B0C' && typeof state.val === 'number' && !appliedFactor) {\n\t\t\t\tvalueToWrite = state.val * 10;\n\t\t\t}\n\n\t\t\t// =========================================================\n\t\t\t// HYBRIDE SCHREIB-WEICHE (MODBUS VS. NATIV PORT 8889)\n\t\t\t// =========================================================\n\t\t\tif (isModbusEnabled && definition.modbus) {\n\t\t\t\tconst isCoil = definition.modbus.type === 'coil';\n\t\t\t\tconst register = definition.modbus.register;\n\n\t\t\t\tawait this.modbusManager.writeRegister(register, Number(valueToWrite), isCoil);\n\t\t\t\treturn; // NATIVE ROUTE 8889 UMGEHEN!\n\t\t\t}\n\n\t\t\t// =========================================================\n\t\t\t// NATIVE ROUTE (Fallback oder Standard-Parameter via 8889)\n\t\t\t// =========================================================\n\t\t\tconst targetWriteId = parseInt(definition.luxWriteId, 10);\n\t\t\t// Platzhalter-IDs (>= 9990) niemals nativ \u00FCber Port 8889 senden\n\t\t\tif (isNaN(targetWriteId) || targetWriteId >= 9990) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tawait queueWrite(this, targetWriteId, 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,eAA0B;AAC1B,4BAA2D;AAC3D,2BAA+C;AAC/C,qBAA8D;AAC9D,wBAA+B;AAC/B,wBAAsC;AACtC,oBAAqD;AACrD,2BAA8B;AAC9B,iCAKO;AACP,2BAOO;AACP,uBAOO;AAEP,0BAAwD;AACxD,0BAAyC;AACzC,0BAAqC;AAErC,2BAAoC;AACpC,2BAUO;AACP,wBAMO;AAKP,MAAM,6BAA6B,MAAM,QAAoC;AAAA;AAAA,EAErE,gBAA6B,oBAAI,IAAY;AAAA;AAAA,EAE7C;AAAA;AAAA,EAEA,oBAAgD;AAAA;AAAA,EAEhD,0BAAyC;AAAA;AAAA,EAEzC,mBAA4B;AAAA;AAAA,EAE5B,sBAAgC,CAAC;AAAA;AAAA,EAEjC,mBAA6B,CAAC;AAAA;AAAA,EAE7B;AAAA;AAAA,EAEA,YAAoB;AAAA;AAAA,EAErB,gBAAyB;AAAA;AAAA,EAExB,uBAA+B;AAAA;AAAA,EAGhC,aAAsC,CAAC;AAAA;AAAA,EAEvC,YAAqB;AAAA;AAAA,EAEpB,aAAqB;AAAA;AAAA,EA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O;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 * as schedule from 'node-schedule';\nimport { handleZwangsheizen, handleZwangswarmwasser } from './actionHandlers';\nimport { initAutoBackup, stopAutoBackup } from './backupManager';\nimport { formatTimerSecondsToTime, timeStringToSeconds } from './convert';\nimport { processCopData } from './copManager';\nimport { handleHupOptimization } from './hupManager';\nimport { initLogger, setCustomDebug, writeLog } from './logger';\nimport { ModbusManager } from './modbusManager';\nimport {\n\tcheckAndSendErrorNotifications,\n\tcheckAndSendOutageNotifications,\n\thandleTestMessage,\n\tsendTelegramNotification,\n} from './notificationManager';\nimport {\n\tcleanupCustomStates,\n\tcleanupEmptyFolders,\n\tcleanupStates,\n\tensureAllObjectsExist,\n\tensureCustomObjectsExist,\n\tisStateEnabled,\n} from './objectManager';\nimport {\n\tevaluatePvBoost,\n\tforceResetPvBoost,\n\thandlePvCycleCheck,\n\thandlePvFeedInChange,\n\tinitPvManagement,\n\tpvIsBoostActive,\n} from './pvManager';\n\nimport { dumpAllRawToLog, queueWrite, readAllRaw } from './rawFunctions';\nimport { STATE_MAPPING, getDpPath } from './stateMapping';\nimport { generateHeatCurveSVG } from './svgGenerator';\nimport type { LuxtronikAdapter } from './types';\nimport { checkFirmwareUpdate } from './updateManager';\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 implements LuxtronikAdapter {\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//* Known Visibilities */\n\tpublic currentVisibilities: number[] = [];\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\tpublic 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/** Modbus Manager f\u00FCr hybride Schreib- und Lesevorg\u00E4nge (SmartGrid / Vorlauf / ZIP) */\n\tpublic modbusManager!: ModbusManager;\n\t/** ioBroker interval handle for the ZIP remaining time countdown */\n\tpublic zipCountdownInterval?: ioBroker.Interval;\n\t/** Target timestamp when the current ZIP run finishes */\n\tpublic zipEndTime?: number;\n\t/** Cron-Job Handle f\u00FCr die Firmware-Update-Pr\u00FCfung */\n\tpublic updateCronJob?: schedule.Job;\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\tprivate async onMessage(obj: ioBroker.Message): Promise<void> {\n\t\tif (obj.command === 'testTelegram') {\n\t\t\tawait handleTestMessage(this, obj);\n\t\t} else if (obj.command === 'getHeatCurve') {\n\t\t\ttry {\n\t\t\t\tlet fp = 21.7;\n\t\t\t\tlet ep = 23.0;\n\n\t\t\t\t// Werte aus der Config-UI auslesen\n\t\t\t\tif (obj.message && typeof obj.message === 'object') {\n\t\t\t\t\tconst msg = obj.message as Record<string, any>;\n\t\t\t\t\tif (msg.fusspunkt !== undefined) {\n\t\t\t\t\t\tfp = parseFloat(msg.fusspunkt);\n\t\t\t\t\t}\n\t\t\t\t\tif (msg.endpunkt !== undefined) {\n\t\t\t\t\t\tep = parseFloat(msg.endpunkt);\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\t// Fallbacks, falls der Nutzer Quatsch eintippt\n\t\t\t\tif (isNaN(fp)) {\n\t\t\t\t\tfp = 21.7;\n\t\t\t\t}\n\t\t\t\tif (isNaN(ep)) {\n\t\t\t\t\tep = 23.0;\n\t\t\t\t}\n\n\t\t\t\t// SVG generieren und als Base64-Bild verpacken\n\t\t\t\tconst svg = generateHeatCurveSVG(fp, ep);\n\t\t\t\tconst base64 = `data:image/svg+xml;base64,${Buffer.from(svg).toString('base64')}`;\n\n\t\t\t\t// Bild zur\u00FCck an die Benutzeroberfl\u00E4che schicken!\n\t\t\t\tif (obj.callback) {\n\t\t\t\t\tthis.sendTo(obj.from, obj.command, base64, obj.callback);\n\t\t\t\t}\n\t\t\t} catch (err: any) {\n\t\t\t\tthis.log.error(`Error generating heat curve: ${err.message}`);\n\t\t\t}\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\t// 1. Config als Record casten, um TypeScript-Fehler zu vermeiden\n\t\tconst config = this.config as Record<string, any>;\n\n\t\t// =========================================================\n\t\t// MIGRATION: ZIP Control Mode & Operation Mode (Bestandsnutzer)\n\t\t// =========================================================\n\t\tlet configUpdated = false;\n\t\tif (config.zip_control_mode === undefined) {\n\t\t\tlet migratedMode = 'controller'; // Default\n\n\t\t\tconst actors = config.actors || [];\n\t\t\tconst validActors = actors.filter(\n\t\t\t\t(a: any) => a.zip_external_relay_id && a.zip_external_relay_id.trim() !== '',\n\t\t\t);\n\n\t\t\tif (validActors.length > 0) {\n\t\t\t\tmigratedMode = 'actor';\n\t\t\t} else if (config.modbus_active && config.sync_modbus_coil_7) {\n\t\t\t\tmigratedMode = 'modbus';\n\t\t\t}\n\n\t\t\tconfig.zip_control_mode = migratedMode;\n\t\t\tconfigUpdated = true;\n\t\t\twriteLog(`[Migration] Updated zip_control_mode to '${migratedMode}' based on legacy settings.`, 'info');\n\t\t}\n\n\t\tif (config.operation_mode === undefined) {\n\t\t\tif (config.modbus_active === true) {\n\t\t\t\tconfig.operation_mode = 'modbus';\n\t\t\t} else if (\n\t\t\t\tconfig.idle_defaults_aktiv === true ||\n\t\t\t\tconfig.regelung_aktiv === true ||\n\t\t\t\tconfig.hup_optimierung_aktiv === true ||\n\t\t\t\tconfig.pv_active === true ||\n\t\t\t\tconfig.zip_optimierung_aktiv === true\n\t\t\t) {\n\t\t\t\tconfig.operation_mode = 'native';\n\t\t\t} else {\n\t\t\t\tconfig.operation_mode = 'readonly';\n\t\t\t}\n\t\t\tconfigUpdated = true;\n\t\t\twriteLog(`[Migration] Set operation_mode to '${config.operation_mode}' based on legacy settings.`, 'info');\n\t\t}\n\n\t\t// Halte modbus_active immer synchron zu operation_mode\n\t\tconst shouldModbusBeActive = config.operation_mode === 'modbus';\n\t\tif (config.modbus_active !== shouldModbusBeActive) {\n\t\t\tconfig.modbus_active = shouldModbusBeActive;\n\t\t\tconfigUpdated = true;\n\t\t}\n\n\t\t// Falls migriert wurde -> direkt in der ioBroker-Datenbank speichern\n\t\tif (configUpdated) {\n\t\t\ttry {\n\t\t\t\tconst obj = await this.getForeignObjectAsync(`system.adapter.${this.namespace}`);\n\t\t\t\tif (obj && obj.native) {\n\t\t\t\t\tobj.native.zip_control_mode = config.zip_control_mode;\n\t\t\t\t\tobj.native.operation_mode = config.operation_mode;\n\t\t\t\t\tobj.native.modbus_active = config.modbus_active;\n\t\t\t\t\tawait this.setForeignObject(`system.adapter.${this.namespace}`, obj);\n\t\t\t\t}\n\t\t\t} catch (err: any) {\n\t\t\t\twriteLog(`[Migration] Failed to save updated config: ${err.message}`, 'error');\n\t\t\t}\n\t\t}\n\t\t// =========================================================\n\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\t// Visibilities einmalig beim Start abfragen f\u00FCr den intelligenten Objekt-Filter\n\t\t// (Wird nur ausgef\u00FChrt, wenn der Nutzer die Funktion in den Settings nicht deaktiviert hat)\n\t\tif (config.filter_visibility !== false) {\n\t\t\ttry {\n\t\t\t\tthis.currentVisibilities = await readAllRaw(this, 3005);\n\t\t\t\tif (this.isDebugLogActive) {\n\t\t\t\t\twriteLog(\n\t\t\t\t\t\t`Successfully loaded ${this.currentVisibilities.length} visibility flags from heat pump.`,\n\t\t\t\t\t\t'debug',\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t} catch (err: any) {\n\t\t\t\twriteLog(\n\t\t\t\t\t`Could not load visibility flags (Command 3005). Assuming all parameters are visible. Error: ${err.message}`,\n\t\t\t\t\t'warn',\n\t\t\t\t);\n\t\t\t\tthis.currentVisibilities = [];\n\t\t\t}\n\t\t} else {\n\t\t\t// Nutzer hat den Filter deaktiviert -> Array bleibt leer, alles wird angezeigt\n\t\t\tthis.currentVisibilities = [];\n\t\t}\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\t\tinitAutoBackup(this);\n\t\tawait this.subscribeStatesAsync('Information.12_SystemInfo.check_firmware');\n\n\t\tconst isReadOnly = config.operation_mode === 'readonly';\n\n\t\t// Strikte Pr\u00FCfung des Betriebsmodus beim Start\n\t\tif (isReadOnly) {\n\t\t\twriteLog(\n\t\t\t\t'\uD83D\uDD12 Operating Mode: READ-ONLY. All hardware write operations and optimizations are disabled.',\n\t\t\t\t'info',\n\t\t\t);\n\t\t\tawait this.setState(getDpPath('Regelung_Aktiv'), { val: false, ack: true });\n\t\t} else if (config.operation_mode === 'modbus') {\n\t\t\twriteLog('\u26A1 Operating Mode: READ/WRITE WITH MODBUS TCP (Hybrid).', 'info');\n\t\t\tawait this.setState(getDpPath('Regelung_Aktiv'), { val: config.regelung_aktiv === true, ack: true });\n\t\t} else {\n\t\t\twriteLog('\u270D\uFE0F Operating Mode: READ/WRITE WITHOUT MODBUS (Native TCP Port 8889).', 'info');\n\t\t\tawait this.setState(getDpPath('Regelung_Aktiv'), { val: config.regelung_aktiv === true, ack: true });\n\t\t}\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\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\n\t\tif (!isReadOnly) {\n\t\t\tawait disableHardwareZipTimer(this);\n\t\t\tsubscribeMotionSensors(this);\n\t\t\t// PV-Steuerung initialisieren\n\t\t\tawait initPvManagement(this);\n\t\t}\n\n\t\tthis.subscribeStates('*');\n\n\t\t// --- MODBUS HYBRID INITIALISIERUNG (Vor dem ersten updateData-Aufruf) ---\n\t\tthis.modbusManager = new ModbusManager(this);\n\t\tif (!isReadOnly && config.modbus_active) {\n\t\t\twriteLog('Checking Modbus TCP availability for hybrid operations...', 'info');\n\t\t\tawait this.modbusManager.checkAvailability();\n\t\t}\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\t// Virtuelle ZIP-Datenpunkte beim Start initialisieren, um 'null' Werte zu vermeiden\n\t\tconst dpActivateZip = getDpPath('Activate_Zip');\n\t\tif (dpActivateZip) {\n\t\t\tawait this.setState(dpActivateZip, { val: false, ack: true });\n\t\t}\n\n\t\tconst dpVirtualZipStatus = getDpPath('Virtual_ZIP_Status');\n\t\tif (dpVirtualZipStatus) {\n\t\t\tawait this.setState(dpVirtualZipStatus, { val: false, ack: true });\n\t\t}\n\n\t\tconst dpVirtualZipRemaining = getDpPath('Virtual_ZIP_Remaining_Time');\n\t\tif (dpVirtualZipRemaining) {\n\t\t\tawait this.setState(dpVirtualZipRemaining, { val: 0, ack: true });\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\t// --- FIRMWARE UPDATE TIMER ---\n\t\tif (config.update_check_active === true) {\n\t\t\t// Erste Pr\u00FCfung 15 Sekunden nach Adapter-Start (damit die aktuelle Firmware bereits gelesen wurde)\n\t\t\tthis.setTimeout(() => {\n\t\t\t\tvoid checkFirmwareUpdate(this);\n\t\t\t}, 15000);\n\n\t\t\t// Cronjob f\u00FCr regelm\u00E4\u00DFige Pr\u00FCfungen einrichten\n\t\t\tconst cronString = config.update_check_cron || '0 12 * * *';\n\t\t\ttry {\n\t\t\t\tthis.updateCronJob = schedule.scheduleJob(cronString, () => {\n\t\t\t\t\tthis.log.info('F\u00FChre geplante Firmware-Update-Pr\u00FCfung aus (Cron)...');\n\t\t\t\t\tvoid checkFirmwareUpdate(this);\n\t\t\t\t});\n\t\t\t} catch (err: any) {\n\t\t\t\tthis.log.error(`Fehler beim Einrichten des Firmware-Update-Crons (${cronString}): ${err.message}`);\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 * Automatically routes via Modbus TCP if hybrid mode is enabled for the target datapoint.\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\tconst config = this.config as Record<string, any>;\n\t\tif (config.operation_mode === 'readonly') {\n\t\t\treturn;\n\t\t}\n\t\tif (val === undefined || val === null) {\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\tconst id = getDpPath(mappingKey);\n\t\tconst state = await this.getStateAsync(id);\n\n\t\tlet appliedFactor = definition.factor;\n\t\tif (\n\t\t\tmappingKey === 'heating_system_circ_pump_voltage_nominal' ||\n\t\t\tmappingKey === 'heating_system_circ_pump_voltage_minimal'\n\t\t) {\n\t\t\tappliedFactor = config.hup_voltage_factor !== undefined ? Number(config.hup_voltage_factor) : 100;\n\t\t}\n\n\t\tlet valueToWrite: any = val;\n\t\tif (typeof valueToWrite === 'boolean') {\n\t\t\tvalueToWrite = valueToWrite ? 1 : 0;\n\t\t} else if (appliedFactor && typeof val === 'number') {\n\t\t\tvalueToWrite = val * appliedFactor;\n\t\t}\n\n\t\tconst isRawWrite =\n\t\t\tdefinition.dataSource === 'raw_parameter' ||\n\t\t\tdefinition.dataSource === 'raw_value' ||\n\t\t\t(!definition.dataSource && /^\\d+$/.test(definition.luxWriteId || ''));\n\t\tif (isRawWrite && definition.unit === '\u00B0C' && typeof val === 'number' && !appliedFactor) {\n\t\t\tvalueToWrite = val * 10;\n\t\t}\n\n\t\tconst writeId = definition.luxWriteId ? parseInt(definition.luxWriteId, 10) : NaN;\n\t\tconst hardwareOutOfSync =\n\t\t\t!definition.isVirtual &&\n\t\t\t!isNaN(writeId) &&\n\t\t\twriteId < 9990 &&\n\t\t\tthis.currentRawParams.length > writeId &&\n\t\t\tthis.currentRawParams[writeId] !== Math.round(Number(valueToWrite));\n\n\t\tif (!state || state.val !== val || hardwareOutOfSync) {\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\tconst isModbusEnabled = Boolean(\n\t\t\t\tthis.modbusManager &&\n\t\t\t\tthis.modbusManager.isAvailable &&\n\t\t\t\tconfig.modbus_active &&\n\t\t\t\tdefinition.modbus &&\n\t\t\t\tconfig[definition.modbus.configKey] === true,\n\t\t\t);\n\n\t\t\tif ((definition.write === true || isModbusEnabled) && !definition.isVirtual && definition.luxWriteId) {\n\t\t\t\ttry {\n\t\t\t\t\tif (isModbusEnabled && definition.modbus) {\n\t\t\t\t\t\tconst isCoil = definition.modbus.type === 'coil';\n\t\t\t\t\t\tawait this.modbusManager.writeRegister(\n\t\t\t\t\t\t\tdefinition.modbus.register,\n\t\t\t\t\t\t\tNumber(valueToWrite),\n\t\t\t\t\t\t\tisCoil,\n\t\t\t\t\t\t);\n\t\t\t\t\t} else if (!isNaN(writeId) && writeId < 9990) {\n\t\t\t\t\t\tawait queueWrite(this, writeId, valueToWrite);\n\t\t\t\t\t}\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\n\t\t\t// FIX: Hier nicht mehr hart auf 0, sondern auf deinen eigenen Config-Wert setzen\n\t\t\tawait this.syncConfigValue('heating_temperature', config.sync_heating_temperature ?? 0);\n\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('temperature_hot_water_target', 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\n\t\t\t// WICHTIG: Wenn der PV-Boost aktiv ist, PV-Sollwerte sofort wieder \u00FCber die Leerlauf-Werte b\u00FCgeln!\n\t\t\tif (pvIsBoostActive) {\n\t\t\t\tawait evaluatePvBoost(this, true);\n\t\t\t}\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 * @param rawValues - Optional raw telemetry values array from command 3004 as fallback.\n\t * @param rawParams - Optional raw parameters array from command 3003 as fallback.\n\t * @returns A promise that resolves when the execution cycle finishes.\n\t */\n\tprivate async runOptimizationSchedule(rawValues: number[] = [], rawParams: number[] = []): Promise<void> {\n\t\ttry {\n\t\t\tconst config = this.config as Record<string, any>;\n\t\t\tif (config.operation_mode === 'readonly') {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst bzState = await this.getStateAsync(getDpPath('WP_BZ_akt'));\n\t\t\tconst bzVal =\n\t\t\t\tbzState && bzState.val !== null\n\t\t\t\t\t? String(bzState.val).trim()\n\t\t\t\t\t: rawValues[80] !== undefined\n\t\t\t\t\t\t? String(rawValues[80])\n\t\t\t\t\t\t: '';\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 (this.lastBzVal === '1' && config.idle_defaults_aktiv === true) {\n\t\t\t\t\t\tawait this.syncConfigValue(\n\t\t\t\t\t\t\t'temperature_hot_water_target',\n\t\t\t\t\t\t\tconfig.sync_warmwater_target_temperature ?? 54,\n\t\t\t\t\t\t);\n\t\t\t\t\t\tif (pvIsBoostActive) {\n\t\t\t\t\t\t\tawait evaluatePvBoost(this, true);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\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}\n\t\t\t\t\tif (config.hup_optimierung_aktiv === true) {\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\tconst mode = config.zip_control_mode || 'controller';\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\tconst canRunWearFree =\n\t\t\t\t\t\t\t(mode === 'actor' && validActors.length > 0) ||\n\t\t\t\t\t\t\t(mode === 'modbus' && this.modbusManager?.isAvailable);\n\n\t\t\t\t\t\tif (canRunWearFree) {\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] Wear-free mode (${mode}) active. Starting circulation synchronous to hot water generation.`,\n\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tawait this.syncConfigValue('zip_aktiv', config.zip_aktiv_ww ?? 120);\n\t\t\t\t\t\t\tawait this.setOwnStateIfDifferent(getDpPath('Activate_Zip'), true, false);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\tif (config.hup_optimierung_aktiv === true) {\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\twwTargetParamState,\n\t\t\t\twwIstState,\n\t\t\t\truecklaufState,\n\t\t\t\tspreizungState,\n\t\t\t\tvd1State,\n\t\t\t\twwHystereseState,\n\t\t\t\truecklaufSollState,\n\t\t\t\tcurrentHupVoltState,\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('temperature_hot_water_target')),\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('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('heating_system_circ_pump_voltage_nominal')),\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\t// Sichere Auswertung mit Rohdaten-Fallback (falls Datenpunkte im Objektbaum deaktiviert sind)\n\t\t\tconst wwSoll =\n\t\t\t\ttypeof wwSollState?.val === 'number'\n\t\t\t\t\t? wwSollState.val\n\t\t\t\t\t: typeof wwTargetParamState?.val === 'number'\n\t\t\t\t\t\t? wwTargetParamState.val\n\t\t\t\t\t\t: rawValues[18] !== undefined\n\t\t\t\t\t\t\t? rawValues[18] / 10\n\t\t\t\t\t\t\t: rawParams[105] !== undefined\n\t\t\t\t\t\t\t\t? rawParams[105] / 10\n\t\t\t\t\t\t\t\t: 54;\n\t\t\tconst wwIst =\n\t\t\t\ttypeof wwIstState?.val === 'number'\n\t\t\t\t\t? wwIstState.val\n\t\t\t\t\t: rawValues[17] !== undefined\n\t\t\t\t\t\t? rawValues[17] / 10\n\t\t\t\t\t\t: 0;\n\t\t\tconst ruecklauf =\n\t\t\t\ttypeof ruecklaufState?.val === 'number'\n\t\t\t\t\t? ruecklaufState.val\n\t\t\t\t\t: rawValues[11] !== undefined\n\t\t\t\t\t\t? rawValues[11] / 10\n\t\t\t\t\t\t: 0;\n\t\t\tconst ruecklaufSoll =\n\t\t\t\ttypeof ruecklaufSollState?.val === 'number'\n\t\t\t\t\t? ruecklaufSollState.val\n\t\t\t\t\t: rawValues[12] !== undefined\n\t\t\t\t\t\t? rawValues[12] / 10\n\t\t\t\t\t\t: 0;\n\t\t\tconst spreizung =\n\t\t\t\ttypeof spreizungState?.val === 'number'\n\t\t\t\t\t? spreizungState.val\n\t\t\t\t\t: rawValues[10] !== undefined && rawValues[11] !== undefined\n\t\t\t\t\t\t? (rawValues[10] - rawValues[11]) / 10\n\t\t\t\t\t\t: 0;\n\n\t\t\t// FIX: VD1out kann im State als boolean (true) oder number (1) vorliegen!\n\t\t\tconst vd1 =\n\t\t\t\tvd1State?.val !== undefined && vd1State?.val !== null\n\t\t\t\t\t? vd1State.val === 1 || vd1State.val === true || String(vd1State.val).toLowerCase() === 'true'\n\t\t\t\t\t: rawValues[44] === 1;\n\n\t\t\tconst wwHysterese =\n\t\t\t\ttypeof wwHystereseState?.val === 'number'\n\t\t\t\t\t? wwHystereseState.val\n\t\t\t\t\t: rawParams[74] !== undefined\n\t\t\t\t\t\t? rawParams[74] / 10\n\t\t\t\t\t\t: 2.0;\n\t\t\tconst currentHupVolt = (currentHupVoltState?.val as number) ?? 7.0;\n\t\t\tconst heizenHysterese =\n\t\t\t\ttypeof heizenHystereseState?.val === 'number'\n\t\t\t\t\t? heizenHystereseState.val\n\t\t\t\t\t: rawParams[88] !== undefined\n\t\t\t\t\t\t? rawParams[88] / 10\n\t\t\t\t\t\t: 1.5;\n\t\t\tconst mitteltemperatur =\n\t\t\t\ttypeof mitteltempState?.val === 'number'\n\t\t\t\t\t? mitteltempState.val\n\t\t\t\t\t: rawValues[16] !== undefined\n\t\t\t\t\t\t? rawValues[16] / 10\n\t\t\t\t\t\t: 0;\n\t\t\tconst thresholdHeatingLimit =\n\t\t\t\ttypeof thresholdHeatingLimitState?.val === 'number'\n\t\t\t\t\t? thresholdHeatingLimitState.val\n\t\t\t\t\t: rawParams[700] !== undefined\n\t\t\t\t\t\t? rawParams[700] / 10\n\t\t\t\t\t\t: 15;\n\n\t\t\t// FIX: heatingLimit typsicher auf Boolean (true/false) UND Number (1/0) pr\u00FCfen!\n\t\t\tconst isHeatingLimitEnabled =\n\t\t\t\theatingLimitState?.val !== undefined && heatingLimitState?.val !== null\n\t\t\t\t\t? heatingLimitState.val === 1 ||\n\t\t\t\t\t\theatingLimitState.val === true ||\n\t\t\t\t\t\tString(heatingLimitState.val) === '1' ||\n\t\t\t\t\t\tString(heatingLimitState.val).toLowerCase() === 'true'\n\t\t\t\t\t: rawParams[699] === 1;\n\n\t\t\tconst nachWasser = Boolean(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 (aelterAls10 && vd1) {\n\t\t\t\t\tconst fusspunktState = await this.getStateAsync(getDpPath('heating_curve_parallel_offset'));\n\t\t\t\t\tconst currentFusspunkt =\n\t\t\t\t\t\ttypeof fusspunktState?.val === 'number'\n\t\t\t\t\t\t\t? fusspunktState.val\n\t\t\t\t\t\t\t: rawParams[13] !== undefined\n\t\t\t\t\t\t\t\t? rawParams[13] / 10\n\t\t\t\t\t\t\t\t: 0;\n\t\t\t\t\tif (currentFusspunkt === 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 (aelterAls10 && vd1) {\n\t\t\t\t\tthis.lastPumpOptimization = await handleHupOptimization(\n\t\t\t\t\t\tthis,\n\t\t\t\t\t\tistHeizen,\n\t\t\t\t\t\tspreizung,\n\t\t\t\t\t\tcurrentHupVolt,\n\t\t\t\t\t\tthis.lastPumpOptimization,\n\t\t\t\t\t);\n\t\t\t\t}\n\n\t\t\t\tif (isRegelungAktiv) {\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 am Ende des Heiztaktes erzwingen\n\t\t\t\t\tif (wwSoll - wwIst > 2 && ruecklauf >= ruecklaufSoll + heizenHysterese - 0.1) {\n\t\t\t\t\t\tlet forceSoll = wwIst + wwHysterese + 1.5;\n\n\t\t\t\t\t\t// Handshake mit dem PV-Manager:\n\t\t\t\t\t\t// Wenn PV aktiv ist, stellen wir sicher, dass der Takt mindestens bis zum PV-Sollwert gefahren wird\n\t\t\t\t\t\tif (pvIsBoostActive) {\n\t\t\t\t\t\t\tconst baseWw =\n\t\t\t\t\t\t\t\tparseFloat(String(config.sync_warmwater_target_temperature).replace(',', '.')) || 54;\n\t\t\t\t\t\t\tconst boostWw = parseFloat(String(config.pv_boost_ww).replace(',', '.')) || 0;\n\t\t\t\t\t\t\tconst pvTarget = baseWw + boostWw;\n\n\t\t\t\t\t\t\t// Nimmt den h\u00F6heren Wert: Entweder das regul\u00E4re PV-Ziel (z.B. 60) oder\n\t\t\t\t\t\t\t// den Wert, der minimal n\u00F6tig ist, um den Takt jetzt k\u00FCnstlich anzusto\u00DFen (z.B. 60.5)\n\t\t\t\t\t\t\tforceSoll = Math.max(forceSoll, pvTarget);\n\t\t\t\t\t\t}\n\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\t\t\t\t\t\tawait this.syncConfigValue('temperature_hot_water_target', forceSoll);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// Typsichere Pr\u00FCfung, ob die Heizgrenze das Heizen erlaubt\n\t\t\tconst isHeatingAllowedByLimit = !isHeatingLimitEnabled || mitteltemperatur < thresholdHeatingLimit;\n\n\t\t\tif (istWarmwasser && nachWasser) {\n\t\t\t\tif (isRegelungAktiv && isHeatingAllowedByLimit) {\n\t\t\t\t\tawait this.syncConfigValue('heating_curve_parallel_offset', 35);\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 (wwSoll - wwIst >= wwHysterese - 1.5 && ruecklauf <= ruecklaufSoll && isHeatingAllowedByLimit) {\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`[CycleOpt] Pre-starting heating before WW (WW: ${wwIst}/${wwSoll}\u00B0C, Hyst: ${wwHysterese}K, RL: ${ruecklauf}/${ruecklaufSoll}\u00B0C). Setting base point to 35\u00B0C.`,\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 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\n\t\t// Schreibvorg\u00E4nge haben absolute Priorit\u00E4t!\n\t\t// Wenn gerade geschrieben wird, \u00FCberspringen wir den Lese-Zyklus,\n\t\t// um alte Anlagen vor abst\u00FCrzenden Netzwerk-Sockets zu sch\u00FCtzen.\n\t\tif (this.isWriting) {\n\t\t\tif (this.isDebugLogActive) {\n\t\t\t\tthis.log.debug('Skipping read cycle because a write operation is currently in progress.');\n\t\t\t}\n\t\t\treturn;\n\t\t}\n\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\tconst config = this.config as Record<string, any>;\n\n\t\t\t// Alle Modbus-Register (Holdings 0..23 & Coils 0..13) in einem Batch aus dem RAM lesen\n\t\t\tconst modbusData =\n\t\t\t\tconfig.modbus_active && this.modbusManager?.isAvailable\n\t\t\t\t\t? await this.modbusManager.readAllRegisters()\n\t\t\t\t\t: null;\n\n\t\t\tthis.errorCount = 0;\n\t\t\tawait this.setState('info.connection', { val: true, ack: true });\n\t\t\tawait this.setState('info.lastUpdate', { val: new Date().toISOString(), ack: true });\n\n\t\t\tconst statePromises: Promise<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, this.currentVisibilities)) {\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\t// DYNAMISCHER FAKTOR F\u00DCR HUP\n\t\t\t\tlet appliedFactor = definition.factor;\n\t\t\t\tif (\n\t\t\t\t\tkey === 'heating_system_circ_pump_voltage_nominal' ||\n\t\t\t\t\tkey === 'heating_system_circ_pump_voltage_minimal'\n\t\t\t\t) {\n\t\t\t\t\tappliedFactor = config.hup_voltage_factor !== undefined ? Number(config.hup_voltage_factor) : 100;\n\t\t\t\t}\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 && appliedFactor) {\n\t\t\t\t\t\t\t\tvalue /= appliedFactor;\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 && appliedFactor) {\n\t\t\t\t\t\t\t\tvalue /= appliedFactor;\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 && appliedFactor) {\n\t\t\t\t\t\t\tvalue /= appliedFactor;\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\t// =========================================================\n\t\t\t\t// MODBUS LIVE-SYNC (Aktualisiert alle aktivierten Modbus-Werte)\n\t\t\t\t// =========================================================\n\t\t\t\tif (\n\t\t\t\t\tmodbusData &&\n\t\t\t\t\tconfig.modbus_active &&\n\t\t\t\t\tdefinition.modbus &&\n\t\t\t\t\tconfig[definition.modbus.configKey] === true\n\t\t\t\t) {\n\t\t\t\t\tconst reg = definition.modbus.register;\n\t\t\t\t\tif (definition.modbus.type === 'holding' && modbusData.holdings[reg] !== undefined) {\n\t\t\t\t\t\tvalue = modbusData.holdings[reg];\n\t\t\t\t\t\tif (appliedFactor) {\n\t\t\t\t\t\t\tvalue /= appliedFactor;\n\t\t\t\t\t\t} else if (definition.unit === '\u00B0C') {\n\t\t\t\t\t\t\tvalue /= 10;\n\t\t\t\t\t\t}\n\t\t\t\t\t} else if (definition.modbus.type === 'coil' && modbusData.coils[reg] !== undefined) {\n\t\t\t\t\t\tvalue = modbusData.coils[reg] ? 1 : 0;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\t// =========================================================\n\n\t\t\t\tif (value !== undefined && typeof value === 'number' && appliedFactor) {\n\t\t\t\t\tvalue = Math.round(value * 100) / 100;\n\t\t\t\t}\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\n\t\t\t\t\t// ANTI-FLAPPING-SCHUTZ: Verhindert, dass die Hauptschleife Energiez\u00E4hler auf 0 st\u00FCrzen l\u00E4sst\n\t\t\t\t\tif (\n\t\t\t\t\t\ttypeof value === 'number' &&\n\t\t\t\t\t\t(key.toLowerCase().includes('energy') ||\n\t\t\t\t\t\t\tkey.toLowerCase().includes('w\u00E4rme') ||\n\t\t\t\t\t\t\tkey.toLowerCase().includes('power'))\n\t\t\t\t\t) {\n\t\t\t\t\t\tstatePromises.push(\n\t\t\t\t\t\t\t(async () => {\n\t\t\t\t\t\t\t\tconst oldState = await this.getStateAsync(stateId);\n\t\t\t\t\t\t\t\tif (oldState && typeof oldState.val === 'number' && value < oldState.val) {\n\t\t\t\t\t\t\t\t\treturn; // T\u00FCrsteher: Der neue Wert ist kleiner als der alte -> Ignorieren!\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tawait this.setState(stateId, { val: value, ack: true });\n\t\t\t\t\t\t\t})(),\n\t\t\t\t\t\t);\n\t\t\t\t\t} else {\n\t\t\t\t\t\tstatePromises.push(this.setState(stateId, { val: value, ack: true }));\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tawait Promise.all(statePromises);\n\t\t\tawait calculateTotalThermalEnergy(this, rawValues);\n\t\t\tawait calculateTotalEnergy(this, rawValues);\n\n\t\t\t// ----------------------------------------------------\n\t\t\t// Fehler-Historie abarbeiten & Alarmieren\n\t\t\t// ----------------------------------------------------\n\t\t\tconst fehlerDp = getDpPath('Fehlerspeicher');\n\t\t\tconst oldFehlerState = fehlerDp ? await this.getStateAsync(fehlerDp) : null;\n\t\t\tconst oldFehlerVal = oldFehlerState?.val as string | undefined;\n\n\t\t\tawait updateErrorHistory(this, rawValues);\n\n\t\t\tconst newFehlerState = fehlerDp ? await this.getStateAsync(fehlerDp) : null;\n\t\t\tconst newFehlerVal = newFehlerState?.val as string | undefined;\n\n\t\t\tawait checkAndSendErrorNotifications(this, oldFehlerVal, newFehlerVal);\n\n\t\t\t// ----------------------------------------------------\n\t\t\t// Abschalt-Historie abarbeiten & Alarmieren (Durchfluss)\n\t\t\t// ----------------------------------------------------\n\t\t\tconst abschaltungDp = getDpPath('Abschaltungen');\n\t\t\tconst oldAbschaltungState = abschaltungDp ? await this.getStateAsync(abschaltungDp) : null;\n\t\t\tconst oldAbschaltungVal = oldAbschaltungState?.val as string | undefined;\n\n\t\t\tawait updateOutageHistory(this, rawValues);\n\n\t\t\tconst newAbschaltungState = abschaltungDp ? await this.getStateAsync(abschaltungDp) : null;\n\t\t\tconst newAbschaltungVal = newAbschaltungState?.val as string | undefined;\n\n\t\t\tawait checkAndSendOutageNotifications(this, oldAbschaltungVal, newAbschaltungVal);\n\t\t\t// ----------------------------------------------------\n\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\n\t\t\t// Aktuellen Betriebszustand aus dem Cache oder live holen\n\t\t\tconst bzState = await this.getStateAsync(getDpPath('WP_BZ_akt'));\n\t\t\tconst currentBzVal = bzState && bzState.val !== null ? String(bzState.val).trim() : '';\n\n\t\t\twriteLog(`=> Rufe jetzt den COP Manager auf. BZ ist: ${currentBzVal}`, 'debug');\n\t\t\tawait processCopData(this, currentBzVal);\n\n\t\t\tawait this.runOptimizationSchedule(rawValues, rawParams);\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\tthis.clearTimeout(this.zipTimer);\n\t\t\t}\n\t\t\tif (this.zipCountdownInterval) {\n\t\t\t\tthis.clearInterval(this.zipCountdownInterval);\n\t\t\t}\n\n\t\t\tif (this.updateCronJob) {\n\t\t\t\tthis.updateCronJob.cancel();\n\t\t\t}\n\n\t\t\tstopAutoBackup(this);\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\tconst config = this.config as Record<string, any>;\n\t\tconst isReadOnly = config.operation_mode === 'readonly';\n\n\t\t// 1. Fremd-Datenpunkte (PV-\u00DCberschuss etc.) abfangen\n\t\tif (!id.startsWith(`${this.namespace}.`)) {\n\t\t\tif (isReadOnly) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\t// An PV-Manager weiterleiten (wird synchron verarbeitet)\n\t\t\thandlePvFeedInChange(this, id, state);\n\t\t}\n\n\t\t// Bewegungsmelder an den Manager auslagern (k\u00F6nnen technisch eigene oder fremde OIDs sein)\n\t\tif (!isReadOnly) {\n\t\t\tconst isMotionSensor = await checkAndHandleMotionSensor(this, id, state);\n\t\t\tif (isMotionSensor) {\n\t\t\t\treturn; // Der zipManager hat das Event verarbeitet, wir sind hier fertig\n\t\t\t}\n\t\t}\n\n\t\t// Falls wir hier noch bei einem Fremd-Datenpunkt sind, brechen wir ab\n\t\t// (eigene Logik unten ist nur f\u00FCr den internen Adapter-Namespace!)\n\t\tif (!id.startsWith(`${this.namespace}.`)) {\n\t\t\treturn;\n\t\t}\n\n\t\tif (state.ack) {\n\t\t\t// PV-Sicherheits-Check beim Verdichter-Status (nur bei Ack=true, wenn der Wert echt von der WP kommt)\n\t\t\tif (!isReadOnly && id.endsWith('WP_BZ_akt')) {\n\t\t\t\tawait handlePvCycleCheck(this, Number(state.val));\n\t\t\t}\n\t\t\treturn;\n\t\t}\n\n\t\t// Diagnose-Aktionen (auch im Read-Only Modus erlaubt, da kein Schreibzugriff auf die W\u00E4rmepumpe erfolgt)\n\t\tif (id.endsWith('check_firmware') && state.val === true) {\n\t\t\tthis.log.info('Manuelle Firmware-Update-Pr\u00FCfung durch Benutzer gestartet...');\n\n\t\t\t// Button direkt wieder auf false zur\u00FCcksetzen, um Doppel-Trigger zu blockieren\n\t\t\tvoid this.setState(id, false, true);\n\n\t\t\t// Update-Pr\u00FCfung starten\n\t\t\tvoid checkFirmwareUpdate(this);\n\t\t\treturn;\n\t\t}\n\n\t\tconst mappingKey = id.split('.').pop();\n\t\tconst relativeId = id.replace(`${this.namespace}.`, '');\n\n\t\tif (mappingKey === 'Schreibe_Debug_Log') {\n\t\t\tawait this.setState(relativeId, { val: state.val, ack: true });\n\n\t\t\tthis.isDebugLogActive = state.val === true;\n\t\t\tsetCustomDebug(this.isDebugLogActive);\n\t\t\twriteLog(\n\t\t\t\t`Extended debugging telemetry logging mode has been ${this.isDebugLogActive ? 'enabled' : 'disabled'}.`,\n\t\t\t\t'info',\n\t\t\t);\n\t\t\treturn;\n\t\t}\n\n\t\tif (mappingKey === 'Dump_Raw_To_Log' && state.val === true) {\n\t\t\tawait this.setState(relativeId, { val: false, ack: true });\n\t\t\tawait dumpAllRawToLog(this);\n\t\t\treturn;\n\t\t}\n\n\t\t// GLOBALE SCHREIBSPERRE IM READ-ONLY MODUS\n\t\tif (isReadOnly) {\n\t\t\twriteLog(\n\t\t\t\t`[Read-Only] Write attempt to '${id}' blocked! Change Operating Mode in adapter settings to enable hardware writes.`,\n\t\t\t\t'warn',\n\t\t\t);\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\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\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\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\n\t\t\t\t// FIX: Bricht einen eventuell laufenden PV-Boost hart ab, bevor die Standardwerte geladen werden\n\t\t\t\tawait forceResetPvBoost(this);\n\n\t\t\t\tawait this.setIdleDefaults();\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\tconst isModbusEnabled = Boolean(\n\t\t\t\tthis.modbusManager &&\n\t\t\t\tthis.modbusManager.isAvailable &&\n\t\t\t\tconfig.modbus_active &&\n\t\t\t\tdefinition.modbus &&\n\t\t\t\tconfig[definition.modbus.configKey] === true,\n\t\t\t);\n\n\t\t\tif (!definition.luxWriteId || (definition.write !== true && !isModbusEnabled)) {\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 appliedFactor = definition.factor;\n\t\t\tif (\n\t\t\t\tmappingKey === 'heating_system_circ_pump_voltage_nominal' ||\n\t\t\t\tmappingKey === 'heating_system_circ_pump_voltage_minimal'\n\t\t\t) {\n\t\t\t\tappliedFactor = config.hup_voltage_factor !== undefined ? Number(config.hup_voltage_factor) : 100;\n\t\t\t}\n\n\t\t\tlet valueToWrite: any = state.val;\n\n\t\t\tif (typeof valueToWrite === 'boolean') {\n\t\t\t\tvalueToWrite = valueToWrite ? 1 : 0;\n\t\t\t} else if (\n\t\t\t\tdefinition.isDurationFormat ||\n\t\t\t\tdefinition.role === 'value.datetime' ||\n\t\t\t\tdefinition.role === 'value.time'\n\t\t\t) {\n\t\t\t\tvalueToWrite = timeStringToSeconds(state.val);\n\t\t\t} else if (appliedFactor && typeof state.val === 'number') {\n\t\t\t\tvalueToWrite = state.val * appliedFactor;\n\t\t\t}\n\n\t\t\tif (definition.unit === '\u00B0C' && typeof state.val === 'number' && !appliedFactor) {\n\t\t\t\tvalueToWrite = state.val * 10;\n\t\t\t}\n\n\t\t\t// =========================================================\n\t\t\t// HYBRIDE SCHREIB-WEICHE (MODBUS VS. NATIV PORT 8889)\n\t\t\t// =========================================================\n\t\t\tif (isModbusEnabled && definition.modbus) {\n\t\t\t\tconst isCoil = definition.modbus.type === 'coil';\n\t\t\t\tconst register = definition.modbus.register;\n\n\t\t\t\tawait this.modbusManager.writeRegister(register, Number(valueToWrite), isCoil);\n\t\t\t\treturn; // NATIVE ROUTE 8889 UMGEHEN!\n\t\t\t}\n\n\t\t\t// =========================================================\n\t\t\t// NATIVE ROUTE (Fallback oder Standard-Parameter via 8889)\n\t\t\t// =========================================================\n\t\t\tconst targetWriteId = parseInt(definition.luxWriteId, 10);\n\t\t\t// Platzhalter-IDs (>= 9990) niemals nativ \u00FCber Port 8889 senden\n\t\t\tif (isNaN(targetWriteId) || targetWriteId >= 9990) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tawait queueWrite(this, targetWriteId, 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,eAA0B;AAC1B,4BAA2D;AAC3D,2BAA+C;AAC/C,qBAA8D;AAC9D,wBAA+B;AAC/B,wBAAsC;AACtC,oBAAqD;AACrD,2BAA8B;AAC9B,iCAKO;AACP,2BAOO;AACP,uBAOO;AAEP,0BAAwD;AACxD,0BAAyC;AACzC,0BAAqC;AAErC,2BAAoC;AACpC,2BAUO;AACP,wBAM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;AAEnC,cAAM,KAAK,cAAc,cAAc,UAAU,OAAO,YAAY,GAAG,MAAM;AAC7E;AAAA,MACD;AAKA,YAAM,gBAAgB,SAAS,WAAW,YAAY,EAAE;AAExD,UAAI,MAAM,aAAa,KAAK,iBAAiB,MAAM;AAClD;AAAA,MACD;AACA,gBAAM,gCAAW,MAAM,eAAe,YAAY;AAAA,IACnD,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;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/io-package.json
CHANGED
|
@@ -1,8 +1,21 @@
|
|
|
1
1
|
{
|
|
2
2
|
"common": {
|
|
3
3
|
"name": "luxtronik2-controller",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.24.0",
|
|
5
5
|
"news": {
|
|
6
|
+
"0.24.0": {
|
|
7
|
+
"en": "*🐛 Bugfixes & Tweaks**\n\n**Operating Mode & Write Protection (`jsonConfig.json`, `main.ts`):**\n**Explicit Operating Mode Selection:** Added a central \"Operating Mode\" selector in the Connection tab with color-coded status banners to clearly distinguish between **Read-Only (Monitoring)**, **Read & Write without Modbus (Native via Port 8889)**, and **Read & Write with Modbus TCP (Hybrid RAM access)**.\n**Dynamic UI Locking:** When \"Read-Only\" is selected, all write-related configuration tabs (Modbus, Idle Defaults, Cycle Optimization, HUP, ZIP, and PV Surplus) and their inputs are automatically grayed out and disabled. Selecting native write mode unlocks the optimization tabs while keeping the Modbus tab disabled.\n**Strict Backend Write Lock:** Enforced a global hardware write lock in Read-Only mode across `onReady`, `syncConfigValue`, `runOptimizationSchedule`, and `onStateChange` (while keeping diagnostic functions like debug logging, raw dumps, and firmware checks active).\n**Automatic Config Migration:** Existing installations are seamlessly migrated on startup to the matching operating mode based on their previously active Modbus and optimization settings.",
|
|
8
|
+
"de": "* 🐛 Bugfixes & Tweaks**\n\n**Betriebsart und Schreibschutz (`JSONConfig.JSON`, `main.ts`) :**\n**Explizite Betriebsmodusauswahl: ** Im Tab Verbindung wurde ein zentraler „Betriebsmodus“ mit farbcodierten Statusbannern hinzugefügt, um klar zwischen **Read-Only (Monitoring) **, **Read & Write ohne Modbus (Native via Port 8889) ** und **Read & Write mit Modbus TCP (Hybrid-RAM-Zugriff) ** zu unterscheiden.\n**Dynamic UI Locking: ** Wenn „Read-Only“ gewählt ist, werden alle Schreib-Tabs (Modbus, Idle Defaults, Cycle Optimization, HUP, ZIP und PV Surplus) und ihre Eingaben automatisch ausgegraut und deaktiviert. Im nativen Schreibmodus werden die Optimierungstabs freigeschaltet, Modbus aber deaktiviert.\n**Strikte Backend-Schreibsperre: ** Erzwang eine globale Hardware-Schreibsperre im Lesemodus für `onReady`, `syncConfigValue`, `runOptimizationSchedule` und `onStateChange` (wobei Diagnosefunktionen wie Debug-Logging, Rohdumps und Firmware-Checks aktiv blieben).\n**Automatische Konfigurationsmigration: ** Bestehende Anlagen werden beim Start nahtlos auf den zuvor aktiven Modbus- und Optimierungsmodus umgestellt.",
|
|
9
|
+
"ru": "* 🐛 Исправления ошибок и изменения**\n\n**Режим работы и защита от записи (`jsonConfig.json`, `main.ts`) :**\n**Явный выбор режима работы: ** На вкладке «Подключение» добавлен центральный переключатель «Режим работы» с цветными баннерами состояния, позволяющими четко различать **Только чтение (мониторинг) **, **Чтение и запись без Modbus (встроенный порт 8889) ** и **Чтение и запись с использованием Modbus TCP (гибридный доступ к оперативной памяти) **.\n**Динамическая блокировка пользовательского интерфейса: ** Если выбран режим «Только для чтения», все вкладки конфигурации, связанные с записью (Modbus, значения по умолчанию в режиме ожидания, оптимизация циклов, HUP, ZIP и PV Surplus), и их входные данные автоматически выделяются серым цветом и отключаются. При выборе основного режима записи открываются вкладки оптимизации, а вкладка Modbus остается отключенной.\n**Строгая блокировка записи в серверной части: ** Введена глобальная аппаратная блокировка записи в режиме «Только для чтения» в режимах «OnReady», «SyncConfigValue», «RunOptimizationSchedule» и «onStateChange» (при этом диагностические функции, такие как ведение журнала отладки, необработанные дампы и проверки микропрограммного обеспечения).\n**Автоматическая миграция конфигураций: ** Существующие установки легко переносятся при запуске в соответствующий режим работы на основе ранее активного Modbus и настроек оптимизации.",
|
|
10
|
+
"pt": "* 🐛 Correções e ajustas**\n\n**Modo operacional e proteção contra gravação (`jsonConfig.json`, `main.ts`) :**\n**Seleção explícita do modo operacional: ** Foi adicionado um seletor central de “Modo operacional” na guia Conexão com banners de status codificados por cores para distinguir claramente entre **Read-Only (Monitoramento) **, **Ler e Write with Modbus TCP (Hybrid RAM access) **.\n**Bloqueio dinâmico de UI: ** Ao selecionar “Somente leitura”, todas as guias de gravação (Modbus, Idle Defaults, Cycle Optimization, HUP, ZIP e PV Surplus) e suas entradas ficam acinzentadas e desativadas. Selecionar o modo de gravação nativo abre as guias de otimização e desativa a guia Modbus.\n**Bloqueio estrito de gravação de backend: ** Impôs um bloqueio global de gravação de hardware no modo Read-Only em `onReady`, `syncConfigValue`, `runOptimizationSchedule` e `onStateChange` (mantendo ativas funções de diagnóstico como log de depuração, despejos brutos e verificações de firmware).\n**Migração automática de configuração: ** As instalações existentes são facilmente migradas para o modo operacional correspondente, com base no Modbus e na otimização.",
|
|
11
|
+
"nl": "* 🐛 Oplossingen en aanpassingen van bug**\n\n**Bedrijfsmodus en schrijfbeveiliging (`JSONConfig.json`, `main.ts`) :**\n**Expliciete keuze van de bedrijfsmodus: ** Een centrale „Operating Mode” -selector toegevoegd op het tabblad Verbinding met statusbanners met kleurcodes om duidelijk onderscheid te maken tussen **Alleen-lezen (Monitoring) **, **Lezen en schrijven zonder Modbus (standaard via poort 8889) ** en **Lezen en schrijven met Modbus TCP (hybride RAM-toegang) **.\n**Dynamische UI-vergrendeling: ** Wanneer „Alleen-lezen” is geselecteerd, worden alle configuratietabbladen die verband houden met schrijven (Modbus, Idle Defaults, Cycle Optimization, HUP, ZIP en PV Surplus) en hun ingangen automatisch grijs weergegeven en uitgeschakeld. Als u de native schrijfmodus selecteert, worden de optimalisatietabbladen ontgrendeld terwijl het Modbus-tabblad uitgeschakeld blijft.\n**Strikte backend Write Lock: ** Zorgde voor een globale hardware-schrijfvergrendeling in de modus Alleen-lezen voor `OnReady`, `SyncConfigValue`, `RunOptimizationSchedule` en `OnStateChange` (terwijl diagnostische functies zoals het loggen van fouten, onbewerkte dumps en firmwarecontroles actief bleven).\n**Automatische configuratiemigratie: ** Bestaande installaties worden bij het opstarten naadloos gemigreerd naar de bijbehorende bedrijfsmodus op basis van hun voorheen actieve Modbus- en optimalisatie-instellingen.",
|
|
12
|
+
"fr": "* 🐛 Corrections et modifications**\n\n**Mode opératoire et protection en écriture (`JSONConfig.json`, `main.ts`) :**\n**Sélection explicite du mode de fonctionnement :** Ajout d'un sélecteur central « Mode de fonctionnement » dans l'onglet Connexion avec des bannières d'état codées par couleur pour faire clairement la distinction entre **ecture seule (surveillance)** **ecture et écriture sans Modbus (port natif via le port 8889)** et **ecture et écriture avec Modbus TCP (accès hybride à la RAM)** \n**Verrouillage dynamique de l'interface utilisateur :** En lecture seule, tous les onglets de configuration liés à l'écriture (Modbus, Idle Defaults, Cycle Optimization, HUP, ZIP et PV Surplus) et leurs entrées sont automatiquement grisés et désactivés. Le mode d'écriture natif déverrouille les onglets d'optimisation tout en désactivant l'onglet Modbus.\n**Strict Backend Write Lock :** A imposé un verrouillage matériel global en mode lecture seule sur OnReady, SyncConfigValue, RunOptimizationSchedule et OnStateChange (tout en maintenant les fonctions de diagnostic actives comme le debug logging, les raw dumps et la vérification du firmware).\n**Migration automatique de la configuration :** Les installations existantes sont migrées facilement au démarrage vers le mode de fonctionnement correspondant en fonction de leur Modbus actif et de leurs paramètres d'optimisation.",
|
|
13
|
+
"it": "* 🐛 Bugfix e tweak**\n\n**Modo operativo e protezione da scrittura (`JSONConfig.json`, `main.ts`) :**\n**Selezione esplicita della modalità operativa: ** Aggiunto un selettore centrale «Modalità operativa» nella scheda Connessione con banner di stato colorati per distinguere chiaramente tra **Sola lettura (monitoraggio) **, **Lettura e scrittura senza Modbus (nativa tramite porta 8889) ** e **Lettura e scrittura con Modbus TCP (accesso RAM ibrido) **.\n**Blocco dinamico dell'interfaccia utente: ** Se si seleziona «Sola lettura», tutte le schede di configurazione (Modbus, Idle Defaults, Cycle Optimization, HUP, ZIP e PV Surplus) sono automaticamente disattivate. La modalità di scrittura nativa sblocca le schede di ottimizzazione e disabilita Modbus.\n**Blocco di scrittura hardware globale in sola lettura su `onReady`, `syncConfigValue`, `runOptimizationSchedule` e `onStateChange` (mantenendo attive funzioni diagnostiche come debug logging, raw dump e controlli del firmware).\n**Migrazione automatica della configurazione: ** Le installazioni esistenti vengono migrate senza problemi all'avvio alla modalità operativa adatta in base a Modbus e ottimizzazione.",
|
|
14
|
+
"es": "* 🐛 Correcciones y ajustes**\n\n**Modo operativo y protección de escritura (`JsonConfig.JSON`, `main.ts`) :**\n**Selección explícita del modo de funcionamiento: ** Se ha añadido un selector central de «modo de funcionamiento» en la pestaña Conexión con anuncios de estado codificados por colores para distinguir claramente entre **Solo lectura (monitorización) **, **Leer y escribir sin Modbus (nativo a través del puerto 8889) ** y **Leer y escribir con Modbus TCP (acceso a RAM híbrida) **.\n**Bloqueo dinámico de la interfaz de usuario: ** Al seleccionar «Solo lectura», todas las pestañas de configuración de escritura (Modbus, Idle Defaults, Cycle Optimization, HUP, ZIP y PV Surplus) y sus entradas aparecen automáticamente en gris y se desactivan. Al seleccionar el modo de escritura nativo, se desbloquean las pestañas de optimización y la de Modbus\n**Estricto bloqueo de escritura de backend: ** Aplicó un bloqueo de escritura global de hardware en modo de solo lectura en OnReady, SyncConfigValue, RunOptimizationSchedule y OnStateChange` (manteniendo activas las funciones de diagnóstico como el registro de errores, los volcados sin procesar y las comprobaciones de firmware).\n**Migración automática de la configuración: ** Las instalaciones existentes migran sin problemas al inicio al modo de operación correspondiente según sus ajustes de Modbus y optimización previamente activos.",
|
|
15
|
+
"pl": "* 🐛 Poprawki błędów i poprawki**\n\n**Tryb pracy i ochrona przed zapisem (`JSONConfig.json`, `main.ts`) :**\n**Wyraźny wybór trybu pracy: ** Dodano centralny selektor „Tryb pracy” na karcie Połączenie z kolorowymi banerami stanu, aby wyraźnie rozróżnić pomiędzy **Tylko do odczytu (monitorowanie) **, **Odczyt i zapis bez Modbus (natywny przez port 8889) ** oraz **Odczyt i zapis z Modbus TCP (Hybrid RAM access) **.\n**Dynamiczne blokowanie interfejsu użytkownika: ** Po wybraniu opcji „Tylko do odczytu” wszystkie karty konfiguracyjne związane z zapisem (Modbus, domyślne ustawienia bezczynności, optymalizacja cyklu, HUP, ZIP i nadwyżka PV) oraz ich wejścia są automatycznie wyszarzone i wyłączane. Wybranie trybu zapisu natywnego odblokowuje karty optymalizacji, zachowując wyłączoną kartę Modbus.\n**Ścisła blokada zapisu zaplecza: ** Wymuszono globalną blokadę zapisu sprzętowego w trybie tylko do odczytu w `onReady`, `SyncConfigValue`, `RunOptimizationSchedule` i `OnStateChange` (zachowując aktywne funkcje diagnostyczne, takie jak rejestrowanie debugowania, surowe zrzuty i kontrole oprogramowania układowego).\n**Automatyczna migracja konfiguracji: ** Istniejące instalacje są bezproblemowo migrowane po uruchomieniu do odpowiedniego trybu pracy w oparciu o wcześniej aktywny Modbus i ustawienia optymalizacji.",
|
|
16
|
+
"uk": "* 🐛 Виправлення помилок та налаштування**\n\n**Режим роботи та захист від запису (`JsonConfig.json`, `main.ts`) :**\n**Вибір явного режиму роботи: ** Додано центральний селектор «Режим роботи» на вкладці Підключення з кольоровими банерами стану, щоб чітко розрізняти **Тільки для читання (моніторинг) **, **Читання та запис без Modbus (рідний через порт 8889) ** та **Читання та запис за допомогою Modbus TCP (гібридний доступ до оперативної пам'яті) **.\n**Динамічне блокування інтерфейсу користувача: ** Якщо вибрано пункт «Тільки для читання», всі вкладки конфігурації, пов'язані з записом (Modbus, Типові значення за замовчуванням, оптимізація циклу, HUP, ZIP та PV Surplus), а також їх вхідні дані автоматично відображаються сірим кольором та вимикаються. Вибір рідного режиму запису розблокує вкладки оптимізації, залишаючи вкладку Modbus вимкненою.\n**Суворе блокування запису на сервері: ** Примусово глобальне блокування запису апаратного забезпечення в режимі лише для читання в `onReady`, `SyncConfigValue`, `RunOptimizationSchedule` та `OnStateChange` (зберігаючи активними діагностичні функції, такі як журнал налагодження, необроблені дампи та перевірка мікропрограмного забезпечення).\n**Автоматична міграція конфігурацій: ** Існуючі інсталяції безперешкодно переносяться при запуску в відповідний режим роботи на основі раніше активних налаштувань Modbus та оптимізації.",
|
|
17
|
+
"zh-cn": "* 🐛 错误修复和调整**\n\n**操作模式和写入保护(`jsonConfig.json`,`main.ts`):**\n**明确的操作模式选择:** 在 “连接” 选项卡中添加了一个中央 “操作模式” 选择器,带有颜色编码的状态横幅,以明确区分**只读(监控)**、**不使用 Modbus 的读取和写入(通过端口 8889 本机访问)**和**使用 Modbus TCP 读取和写入(混合 RAM 访问权限)**。\n**动态用户界面锁定:** 选择 “只读” 时,所有与写入相关的配置选项卡(Modbus、空闲默认值、周期优化、HUP、ZIP 和 PV 剩余)及其输入将自动变灰并禁用。选择原生写入模式可解锁优化选项卡,同时禁用 Modbus 选项卡。\n**严格的后端写入锁定:** 在 `onReady`、`syncConfigValue`、`runOptimizationSchedule` 和 `onStateChange` 中强制执行全局硬件写入锁定(同时保持调试日志、原始转储和固件检查等诊断功能处于活动状态)。\n**自动配置迁移:** 现有安装在启动时会根据其先前处于活动状态的 Modbus 和优化设置无缝迁移到匹配的操作模式。"
|
|
18
|
+
},
|
|
6
19
|
"0.23.2": {
|
|
7
20
|
"en": "**COP & Efficiency Calculation (`copManager.ts`):**\n**Isolated Counter Tracking:** Introduced dedicated reference states for Total, Heating, and Hot Water counters (`last_raw_power_*` and `last_raw_thermal_*`). Each counter is now compared strictly against its own previous value, completely preventing cross-mode \"ghost deltas\" and astronomical COP spikes during cycle transitions.\n**Automatic Total-Delta Fallback:** Added seamless fallback detection for controllers with firmware bugs (e.g., Novelan LAV) where mode-specific counters like `energy_warmwater` remain permanently at `0`. If a specific counter reports a delta of `0` during an active cycle, the adapter automatically uses the live delta of the corresponding total counter (`energy_total` / `thermalenergy_total`) without requiring manual configuration workarounds.",
|
|
8
21
|
"de": "**COP und Effizienzberechnung (`CopManager.TS`) :**\n**Isolierte Zählermessung: ** Eigene Referenzzustände für Gesamt-, Heiz- und Warmwasserzähler eingeführt (`last_raw_power_*` und `last_raw_thermal_*`). Jeder Zähler wird nun streng mit seinem vorherigen Wert verglichen, sodass modusübergreifende „Geisterdeltas“ und astronomische COP-Spitzen bei Zyklusübergängen vermieden werden.\n**Automatischer Total-Delta-Fallback: ** Optimale Fallback-Erkennung für Controller mit Firmware-Bugs (z. B. Novelan LAV), bei der modusspezifische Zähler wie `energy_warmwater` permanent auf `0` stehen. Meldet ein bestimmter Zähler während eines aktiven Zyklus ein Delta von `0`, verwendet der Adapter automatisch das Live-Delta des entsprechenden Gesamtzählers (`energy_total`/`thermalenergy_total`), ohne dass eine manuelle Konfiguration nötig ist.",
|
|
@@ -80,19 +93,6 @@
|
|
|
80
93
|
"pl": "* 🐛 Poprawki błędów**\n\n**Optymalizacja cyklu i synchronizacja sprzętu (`main.ts`) :**\n**Poprawka typu limitu podgrzewania i ogrzewania: ** Naprawiono ścisłe błędy porównania typów („boolean” vs. „liczba”) podczas oceny „HeatingLimit” i „VD1out” („vd1”). Wcześniej wartości stanu logicznego powodowały, że „isHeatingAllowedByLimit” i „vd1” oceniały na „false”, co blokowało wstępne podgrzewanie przed wytwarzaniem ciepłej wody (podnosząc „heating_curve_parallel_offset” do 35°C), uniemożliwiło 10-minutowy reset punktu bazowego i pominęło optymalizację napięcia HUP.\n**Raw Data Fallbacks (`RawValues`/`RawParams`) :** Dodano bezpośrednie awarie do surowej telemetrii pomp ciepła i macierzy parametrów w `RunOptimizationSchedule`, więc optymalizacja cyklu, kontrola HUP i kontrola limitu ogrzewania pozostają w pełni funkcjonalne, nawet jeśli poszczególne punkty danych (`ThresholdHeatingLimit`, `Mitteltemperatur`, `HeatingLimit`, `VD1out` itp.) są wyłączone w drzewie obiektów ioBroker.\n**Weryfikacja braku synchronizacji sprzętu: ** Ulepszona „SyncConfigValue” do weryfikacji wartości docelowych w pamięci podręcznej parametrów sprzętowych („CurrentRawParams”), zapewniając niezawodne zapisywanie parametrów do kontrolera, nawet jeśli lokalny stan ioBroker jest wyłączony lub niezsynchronizowany z pompą ciepła.",
|
|
81
94
|
"uk": "* 🐛 Виправлення вадь**\n\n** Оптимізація циклу та синхронізація обладнання (`main.ts`) :**\n**Виправлено тип обмеження попереднього нагрівання та нагрівання: ** Виправлені суворі помилки порівняння типів (`буле` проти `числові`) під час оцінки ``BeatingLimit` та `Vd1out` (`vd1`). Раніше значення булевих станів викликали оцінку `iHeatingAllowedByLimit` і `vd1` до `false`, що блокувало попередній нагрів перед генерацією гарячої води (підвищення `heating_curve_parallel_offset` до 35°C), запобігало 10-хвилинному скидання базової точки та пропустило оптимізацію напруги HUP.\n**Необроблені запасні дані (`RawValues`/`RawParams`) :** Додано пряме резервне копіювання до телеметрії необроблених теплових насосів та масивів параметрів у `RunOptimizationSchedule`, тому оптимізація циклу, контроль HUP та перевірка межі нагрівання залишаються повністю функціональними, навіть якщо окремі точки даних (`ThresholdHeatingLimit`, `Mitteltemperatur`, ``HeatingLimit`, `VD1out` тощо).) вимкнені в дереві об'єктів IObroker.\n**Перевірка несинхронізації апаратного забезпечення: ** Розширена `SyncConfigValue` для перевірки цільових значень щодо кешу параметрів апаратного забезпечення в режимі реального часу (`CurrentraWParams`), гарантуючи надійний запис параметрів на контролер, навіть якщо локальний стан IObroker вимкнено або не синхронізовано з тепловим насосом.",
|
|
82
95
|
"zh-cn": "* 🐛 错误修复**\n\n**周期优化和硬件同步 (`main.ts`): **\n**预热和加热极限类型修复:** 修复了评估 “加热极限” 和 “vd1out”(“vd1”)时严格的类型比较错误(“布尔值” 与 “数字”)。以前,布尔状态值导致 “isHeatingAllowedByLimit” 和 “vd1” 的计算结果为 “false”,这阻碍了热水生成前的预热(将 “heating_curve_parallel_offset” 提高到35°C),阻止了10分钟的基点重置,并跳过了HUP电压优化。\n**原始数据回退(`RawValues`/`rawParams`):** 在 `runOptimizationSchedule` 中添加了对原始热泵遥测和参数数组的直接回退,因此即使单个数据点(`ThresholdHeatingLimit`、`Mittelertur`、`HeatingLimit`、`Vd1out`等),循环优化、HUP控制和加热极限检查仍能完全正常运行.) 在 IOBroker 对象树中被禁用。\n**硬件不同步验证:**增强的 “syncConfigValue” 可根据实时硬件参数缓存(`currentrawParams`)验证目标值,从而确保即使本地IOBroker状态被禁用或与热泵不同步,参数也能可靠地写入控制器。"
|
|
83
|
-
},
|
|
84
|
-
"0.22.5": {
|
|
85
|
-
"en": "*🔧 Maintenance & Compatibility**\n\n**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.",
|
|
86
|
-
"de": "* 🔧 Wartung und Kompatibilität**\n\n**Repository-Konformität: ** Fehlende Übersetzungen (i18n) für alle Konfigurationsmenüs (z. B. COP-Quellen, PV-Modi) hinzugefügt, um die strengen IOBroker-Anforderungen zu erfüllen.",
|
|
87
|
-
"ru": "* 🔧 Техническое обслуживание и совместимость**\n\n**Соответствие требованиям репозитория: ** Добавлены недостающие многоязычные переводы (i18n) для всех выпадающих меню конфигурации (например, исходники COP, режимы PV) для удовлетворения строгих требований стабильного репозитория IOBroker.",
|
|
88
|
-
"pt": "* 🔧 Manutenção e compatibilidade**\n\n**Conformidade do repositório: ** Foram adicionadas traduções faltantes em vários idiomas (i18n) em todos os menus (ex. fontes COP e modos PV) para atender aos requisitos rígidos de repositório estável do IOBroker.",
|
|
89
|
-
"nl": "* 🔧 Onderhoud en compatibiliteit**\n\n**Voldoet aan de repository: ** Ontbrekende meertalige vertalingen (i18n) toegevoegd voor alle keuzemenu's voor configuraties (bijv. COP-bronnen, PV-modi) om te voldoen aan strenge vereisten voor stabiele opslagplaatsen van IOBroker.",
|
|
90
|
-
"fr": "* 🔧 Entretien et compatibilité**\n\n**Conformité du dépôt :** Ajout de traductions multilingues manquantes (i18n) pour tous les menus déroulants de configuration (sources COP, modes PV, par exemple) afin de répondre aux exigences strictes d'IObroker.",
|
|
91
|
-
"it": "* 🔧 Cura e compatibilità**\n\n**Conformità al repository: ** Aggiunte traduzioni multilingue mancanti (i18n) per tutti i menu a discesa di configurazione (ad es. fonti COP, modalità PV) per soddisfare i rigidi requisiti IOBroker.",
|
|
92
|
-
"es": "* 🔧 Mantenimiento y compatibilidad**\n\n**Cumplimiento del repositorio: ** Faltan traducciones multilingües (i18n) en todos los menús desplegables de configuración (por ejemplo, fuentes COP, modos PV) para cumplir con los estrictos requisitos de repositorio estable de ioBroker.",
|
|
93
|
-
"pl": "* 🔧 Konserwacja i kompatybilność**\n\n**Zgodność z repozytorium: ** Dodano brakujące tłumaczenia wielojęzyczne (i18n) dla wszystkich menu rozwijanych konfiguracji (np. źródła COP, tryby PV), aby spełnić surowe wymagania dotyczące stabilnego repozytorium ioBroker.",
|
|
94
|
-
"uk": "* 🔧 Технічне обслуговування та сумісність**\n\n**Відповідність репозиторію: ** Додано відсутні багатомовні переклади (i18n) для всіх випадаючих меню конфігурації (наприклад, джерела COP, режими PV), щоб відповідати суворим вимогам стабільного сховища IObroker.",
|
|
95
|
-
"zh-cn": "* 🔧 维护和兼容性**\n\n**存储库合规性:** 为所有配置下拉菜单(例如 COP 来源、PV 模式)添加了缺少的多语言翻译 (i18n),以满足严格的 IOBroker 稳定存储库要求。"
|
|
96
96
|
}
|
|
97
97
|
},
|
|
98
98
|
"titleLang": {
|
|
@@ -193,7 +193,8 @@
|
|
|
193
193
|
"cop_source_power": "internal",
|
|
194
194
|
"cop_oid_power_total": "",
|
|
195
195
|
"cop_source_thermal": "internal",
|
|
196
|
-
"cop_oid_thermal_total": ""
|
|
196
|
+
"cop_oid_thermal_total": "",
|
|
197
|
+
"operation_mode": "readonly"
|
|
197
198
|
},
|
|
198
199
|
"notifications": [
|
|
199
200
|
{
|