iobroker.luxtronik2-controller 0.6.2 → 0.6.4
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 +46 -16
- package/admin/jsonConfig.json +333 -102
- package/build/actionHandlers.js +7 -9
- package/build/actionHandlers.js.map +2 -2
- package/build/codes.js +1 -0
- package/build/codes.js.map +2 -2
- package/build/convert.js +49 -0
- package/build/convert.js.map +7 -0
- package/build/main.js +54 -139
- package/build/main.js.map +2 -2
- package/build/objectManager.js +3 -3
- package/build/objectManager.js.map +2 -2
- package/build/rawFunctions.js +79 -6
- package/build/rawFunctions.js.map +2 -2
- package/build/stateMapping.js +375 -7
- package/build/stateMapping.js.map +2 -2
- package/build/utils.js +36 -0
- package/build/utils.js.map +7 -0
- package/build/virtualStates.js +53 -34
- package/build/virtualStates.js.map +3 -3
- package/build/zipManager.js +316 -48
- package/build/zipManager.js.map +2 -2
- package/io-package.json +27 -27
- package/package.json +4 -4
package/build/zipManager.js
CHANGED
|
@@ -18,23 +18,57 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
18
18
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
19
|
var zipManager_exports = {};
|
|
20
20
|
__export(zipManager_exports, {
|
|
21
|
+
checkAndHandleMotionSensor: () => checkAndHandleMotionSensor,
|
|
22
|
+
disableHardwareZipTimer: () => disableHardwareZipTimer,
|
|
21
23
|
handleActivateZip: () => handleActivateZip,
|
|
22
24
|
restoreOriginalZipConfig: () => restoreOriginalZipConfig,
|
|
23
|
-
stopZipAndDeaeration: () => stopZipAndDeaeration
|
|
25
|
+
stopZipAndDeaeration: () => stopZipAndDeaeration,
|
|
26
|
+
subscribeMotionSensors: () => subscribeMotionSensors
|
|
24
27
|
});
|
|
25
28
|
module.exports = __toCommonJS(zipManager_exports);
|
|
29
|
+
var import_convert = require("./convert");
|
|
26
30
|
var import_logger = require("./logger");
|
|
31
|
+
var import_rawFunctions = require("./rawFunctions");
|
|
27
32
|
var import_stateMapping = require("./stateMapping");
|
|
28
33
|
const CONSTANTS = {
|
|
29
|
-
/** Command ID for the deaeration program */
|
|
30
34
|
CMD_DEAERATE: 158,
|
|
31
|
-
/** Command ID for the circulation pump (ZIP) */
|
|
32
35
|
CMD_ZIP: 684,
|
|
33
|
-
/** Seconds representing the end of a day (23:59:00) */
|
|
34
36
|
END_OF_DAY: 86340,
|
|
35
|
-
/** Delay in milliseconds between consecutive hardware write operations */
|
|
36
37
|
WRITE_DELAY: 100
|
|
37
38
|
};
|
|
39
|
+
async function safeRawWrite(adapter, key, luxId, rawValue) {
|
|
40
|
+
const dpPath = (0, import_stateMapping.getDpPath)(key);
|
|
41
|
+
if (!dpPath) {
|
|
42
|
+
return;
|
|
43
|
+
}
|
|
44
|
+
const state = await adapter.getStateAsync(dpPath);
|
|
45
|
+
if (state && state.val !== null) {
|
|
46
|
+
let currentRaw = null;
|
|
47
|
+
if (typeof state.val === "boolean") {
|
|
48
|
+
currentRaw = state.val ? 1 : 0;
|
|
49
|
+
} else if (typeof state.val === "number") {
|
|
50
|
+
currentRaw = state.val;
|
|
51
|
+
} else if (typeof state.val === "string") {
|
|
52
|
+
currentRaw = (0, import_convert.timeStringToSeconds)(state.val);
|
|
53
|
+
}
|
|
54
|
+
if (currentRaw === rawValue) {
|
|
55
|
+
if (adapter.isDebugLogActive) {
|
|
56
|
+
(0, import_logger.writeLog)(
|
|
57
|
+
`[SafeWrite] Wert f\xFCr '${key}' ist bereits auf Zielwert (${rawValue}). Schreibvorgang blockiert!`,
|
|
58
|
+
"debug"
|
|
59
|
+
);
|
|
60
|
+
}
|
|
61
|
+
return;
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
if (adapter.isDebugLogActive) {
|
|
65
|
+
(0, import_logger.writeLog)(`[SafeWrite] \xC4nderung erkannt. Schreibe ${rawValue} in Register ${luxId} (${key})...`, "debug");
|
|
66
|
+
}
|
|
67
|
+
await (0, import_rawFunctions.queueWrite)(adapter, luxId, rawValue);
|
|
68
|
+
await new Promise((resolve) => {
|
|
69
|
+
adapter.setTimeout(resolve, CONSTANTS.WRITE_DELAY);
|
|
70
|
+
});
|
|
71
|
+
}
|
|
38
72
|
function clearZipTimer(adapter) {
|
|
39
73
|
if (!adapter.zipTimer) {
|
|
40
74
|
return;
|
|
@@ -42,6 +76,57 @@ function clearZipTimer(adapter) {
|
|
|
42
76
|
adapter.clearTimeout(adapter.zipTimer);
|
|
43
77
|
adapter.zipTimer = void 0;
|
|
44
78
|
}
|
|
79
|
+
async function isZipAllowedBySchedule(adapter) {
|
|
80
|
+
const config = adapter.config;
|
|
81
|
+
if (config.zip_hardware_timer_disable === true) {
|
|
82
|
+
return true;
|
|
83
|
+
}
|
|
84
|
+
try {
|
|
85
|
+
const tableState = await adapter.getStateAsync((0, import_stateMapping.getDpPath)("hotWaterCircPumpTimerTableSelected"));
|
|
86
|
+
const tableMode = tableState ? Number(tableState.val) : 0;
|
|
87
|
+
const now = /* @__PURE__ */ new Date();
|
|
88
|
+
const day = now.getDay();
|
|
89
|
+
const currentSeconds = now.getHours() * 3600 + now.getMinutes() * 60 + now.getSeconds();
|
|
90
|
+
let prefix = "Zirkulation_MoSo";
|
|
91
|
+
let endSuffix = "End";
|
|
92
|
+
if (tableMode === 1) {
|
|
93
|
+
prefix = day >= 1 && day <= 5 ? "Zirkulation_MoFr" : "Zirkulation_SaSo";
|
|
94
|
+
endSuffix = "Ende";
|
|
95
|
+
} else if (tableMode === 2) {
|
|
96
|
+
const days = ["Sonntag", "Montag", "Dienstag", "Mittwoch", "Donnerstag", "Freitag", "Samstag"];
|
|
97
|
+
prefix = `Zirkulation_${days[day]}`;
|
|
98
|
+
endSuffix = "Ende";
|
|
99
|
+
}
|
|
100
|
+
let isAllowed = false;
|
|
101
|
+
for (let i = 1; i <= 5; i++) {
|
|
102
|
+
const startKey = `${prefix}_Start${i}`;
|
|
103
|
+
const endKey = `${prefix}_${endSuffix}${i}`;
|
|
104
|
+
const startState = await adapter.getStateAsync((0, import_stateMapping.getDpPath)(startKey));
|
|
105
|
+
const endState = await adapter.getStateAsync((0, import_stateMapping.getDpPath)(endKey));
|
|
106
|
+
if (startState && startState.val && endState && endState.val) {
|
|
107
|
+
const startSec = (0, import_convert.timeStringToSeconds)(String(startState.val));
|
|
108
|
+
const endSec = (0, import_convert.timeStringToSeconds)(String(endState.val));
|
|
109
|
+
if (startSec !== endSec) {
|
|
110
|
+
let actualEndSec = endSec;
|
|
111
|
+
if (endSec === 0 && startSec > 0) {
|
|
112
|
+
actualEndSec = 86400;
|
|
113
|
+
}
|
|
114
|
+
if (currentSeconds >= startSec && currentSeconds <= actualEndSec) {
|
|
115
|
+
isAllowed = true;
|
|
116
|
+
break;
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
return isAllowed;
|
|
122
|
+
} catch (err) {
|
|
123
|
+
const msg = err instanceof Error ? err.message : String(err);
|
|
124
|
+
if (adapter.isDebugLogActive) {
|
|
125
|
+
(0, import_logger.writeLog)(`[ZIP] Fehler bei der Zeitplan-Pr\xFCfung: ${msg}`, "error");
|
|
126
|
+
}
|
|
127
|
+
return true;
|
|
128
|
+
}
|
|
129
|
+
}
|
|
45
130
|
async function restoreOriginalZipConfig(adapter) {
|
|
46
131
|
if (!adapter.originalZipConfig) {
|
|
47
132
|
return;
|
|
@@ -57,12 +142,7 @@ async function restoreOriginalZipConfig(adapter) {
|
|
|
57
142
|
}
|
|
58
143
|
let rawVal = val;
|
|
59
144
|
if (def.role === "value.datetime" && typeof val === "string") {
|
|
60
|
-
|
|
61
|
-
if (timeMatch) {
|
|
62
|
-
rawVal = parseInt(timeMatch[1], 10) * 3600 + parseInt(timeMatch[2], 10) * 60;
|
|
63
|
-
} else {
|
|
64
|
-
rawVal = 0;
|
|
65
|
-
}
|
|
145
|
+
rawVal = (0, import_convert.timeStringToSeconds)(val);
|
|
66
146
|
}
|
|
67
147
|
const targetPath = (0, import_stateMapping.getDpPath)(key);
|
|
68
148
|
if (targetPath) {
|
|
@@ -70,11 +150,9 @@ async function restoreOriginalZipConfig(adapter) {
|
|
|
70
150
|
}
|
|
71
151
|
const luxId = Number(def.luxWriteId);
|
|
72
152
|
if (!isNaN(luxId)) {
|
|
73
|
-
await
|
|
153
|
+
await (0, import_rawFunctions.queueWrite)(adapter, luxId, Number(rawVal));
|
|
74
154
|
await new Promise((resolve) => {
|
|
75
|
-
adapter.setTimeout(() =>
|
|
76
|
-
resolve();
|
|
77
|
-
}, CONSTANTS.WRITE_DELAY);
|
|
155
|
+
adapter.setTimeout(() => resolve(), CONSTANTS.WRITE_DELAY);
|
|
78
156
|
});
|
|
79
157
|
}
|
|
80
158
|
}
|
|
@@ -86,6 +164,21 @@ async function restoreOriginalZipConfig(adapter) {
|
|
|
86
164
|
}
|
|
87
165
|
}
|
|
88
166
|
async function stopZipAndDeaeration(adapter) {
|
|
167
|
+
const actors = adapter.config.actors || [];
|
|
168
|
+
const validActors = actors.filter((a) => a.zip_external_relay_id && a.zip_external_relay_id.trim() !== "");
|
|
169
|
+
if (validActors.length > 0) {
|
|
170
|
+
try {
|
|
171
|
+
for (const actor of validActors) {
|
|
172
|
+
await adapter.setForeignStateAsync(actor.zip_external_relay_id, false, false);
|
|
173
|
+
}
|
|
174
|
+
if (adapter.isDebugLogActive) {
|
|
175
|
+
(0, import_logger.writeLog)(`[ZIP] Not-Aus f\xFCr externe Relais gesendet.`, "debug");
|
|
176
|
+
}
|
|
177
|
+
} catch (err) {
|
|
178
|
+
const msg = err instanceof Error ? err.message : String(err);
|
|
179
|
+
(0, import_logger.writeLog)(`[ZIP] Fehler beim Ausschalten der externen Relais: ${msg}`, "error");
|
|
180
|
+
}
|
|
181
|
+
}
|
|
89
182
|
try {
|
|
90
183
|
const activateZipState = await adapter.getStateAsync((0, import_stateMapping.getDpPath)("Activate_Zip"));
|
|
91
184
|
const runDeaerateState = await adapter.getStateAsync((0, import_stateMapping.getDpPath)("runDeaerate"));
|
|
@@ -93,24 +186,20 @@ async function stopZipAndDeaeration(adapter) {
|
|
|
93
186
|
const isDeaerateActive = (runDeaerateState == null ? void 0 : runDeaerateState.val) === 1 || (runDeaerateState == null ? void 0 : runDeaerateState.val) === true;
|
|
94
187
|
if (isZipActive || isDeaerateActive) {
|
|
95
188
|
if (adapter.isDebugLogActive) {
|
|
96
|
-
(0, import_logger.writeLog)("
|
|
189
|
+
(0, import_logger.writeLog)("Stopping active ZIP macro and deaeration program...", "info");
|
|
97
190
|
}
|
|
98
191
|
clearZipTimer(adapter);
|
|
99
192
|
await restoreOriginalZipConfig(adapter);
|
|
100
|
-
await adapter
|
|
101
|
-
await
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
adapter.
|
|
109
|
-
|
|
110
|
-
}, CONSTANTS.WRITE_DELAY);
|
|
111
|
-
});
|
|
112
|
-
await adapter.syncConfigValue("runDeaerate", false);
|
|
113
|
-
await adapter.syncConfigValue("hotWaterCircPumpDeaerate", false);
|
|
193
|
+
await safeRawWrite(adapter, "runDeaerate", CONSTANTS.CMD_DEAERATE, 0);
|
|
194
|
+
await safeRawWrite(adapter, "hotWaterCircPumpDeaerate", CONSTANTS.CMD_ZIP, 0);
|
|
195
|
+
const dpDeaerate = (0, import_stateMapping.getDpPath)("runDeaerate");
|
|
196
|
+
const dpCircDeaerate = (0, import_stateMapping.getDpPath)("hotWaterCircPumpDeaerate");
|
|
197
|
+
if (dpDeaerate) {
|
|
198
|
+
await adapter.setOwnStateIfDifferent(dpDeaerate, false, true);
|
|
199
|
+
}
|
|
200
|
+
if (dpCircDeaerate) {
|
|
201
|
+
await adapter.setOwnStateIfDifferent(dpCircDeaerate, false, true);
|
|
202
|
+
}
|
|
114
203
|
const dpZip = (0, import_stateMapping.getDpPath)("Activate_Zip");
|
|
115
204
|
if (dpZip) {
|
|
116
205
|
await adapter.setOwnStateIfDifferent(dpZip, false, true);
|
|
@@ -122,13 +211,102 @@ async function stopZipAndDeaeration(adapter) {
|
|
|
122
211
|
}
|
|
123
212
|
}
|
|
124
213
|
async function handleActivateZip(adapter, id, durationSeconds) {
|
|
214
|
+
const actors = adapter.config.actors || [];
|
|
215
|
+
const validActors = actors.filter((a) => a.zip_external_relay_id && a.zip_external_relay_id.trim() !== "");
|
|
216
|
+
let isZipAlreadyRunning = false;
|
|
217
|
+
if (validActors.length > 0) {
|
|
218
|
+
for (const actor of validActors) {
|
|
219
|
+
try {
|
|
220
|
+
const foreignState = await adapter.getForeignStateAsync(actor.zip_external_relay_id);
|
|
221
|
+
if (foreignState && foreignState.val === true) {
|
|
222
|
+
isZipAlreadyRunning = true;
|
|
223
|
+
break;
|
|
224
|
+
}
|
|
225
|
+
} catch (err) {
|
|
226
|
+
const msg = err instanceof Error ? err.message : String(err);
|
|
227
|
+
if (adapter.isDebugLogActive) {
|
|
228
|
+
(0, import_logger.writeLog)(
|
|
229
|
+
`[ZIP] Konnte Status des externen Relais ${actor.zip_external_relay_id} nicht lesen: ${msg}`,
|
|
230
|
+
"debug"
|
|
231
|
+
);
|
|
232
|
+
}
|
|
233
|
+
}
|
|
234
|
+
}
|
|
235
|
+
} else {
|
|
236
|
+
try {
|
|
237
|
+
const internalZip = await adapter.getStateAsync((0, import_stateMapping.getDpPath)("ZIPout"));
|
|
238
|
+
if (internalZip && (internalZip.val === 1 || internalZip.val === true)) {
|
|
239
|
+
isZipAlreadyRunning = true;
|
|
240
|
+
}
|
|
241
|
+
} catch (err) {
|
|
242
|
+
const msg = err instanceof Error ? err.message : String(err);
|
|
243
|
+
if (adapter.isDebugLogActive) {
|
|
244
|
+
(0, import_logger.writeLog)(`[ZIP] ${msg}`, "debug");
|
|
245
|
+
}
|
|
246
|
+
}
|
|
247
|
+
}
|
|
125
248
|
const localId = id.replace(`${adapter.namespace}.`, "");
|
|
126
|
-
await adapter.
|
|
249
|
+
await adapter.setState(localId, { val: true, ack: true });
|
|
127
250
|
if (durationSeconds <= 0) {
|
|
128
|
-
await adapter.
|
|
251
|
+
await adapter.setState(localId, { val: false, ack: true });
|
|
129
252
|
return;
|
|
130
253
|
}
|
|
131
254
|
const safeDurationSeconds = Math.max(1, isNaN(durationSeconds) ? 60 : durationSeconds);
|
|
255
|
+
if (isZipAlreadyRunning) {
|
|
256
|
+
if (adapter.isDebugLogActive) {
|
|
257
|
+
(0, import_logger.writeLog)("[ZIP] Pumpe l\xE4uft bereits. Verl\xE4ngere Timer.", "debug");
|
|
258
|
+
}
|
|
259
|
+
if (adapter.zipTimer) {
|
|
260
|
+
adapter.clearTimeout(adapter.zipTimer);
|
|
261
|
+
}
|
|
262
|
+
adapter.zipTimer = adapter.setTimeout(async () => {
|
|
263
|
+
if (validActors.length > 0) {
|
|
264
|
+
for (const actor of validActors) {
|
|
265
|
+
try {
|
|
266
|
+
await adapter.setForeignStateAsync(actor.zip_external_relay_id, false, false);
|
|
267
|
+
} catch (err) {
|
|
268
|
+
const msg = err instanceof Error ? err.message : String(err);
|
|
269
|
+
(0, import_logger.writeLog)(`[ZIP] Fehler beim Ausschalten des Relais: ${msg}`, "error");
|
|
270
|
+
}
|
|
271
|
+
}
|
|
272
|
+
await adapter.setState(localId, { val: false, ack: true });
|
|
273
|
+
} else {
|
|
274
|
+
await stopZipAndDeaeration(adapter);
|
|
275
|
+
}
|
|
276
|
+
}, safeDurationSeconds * 1e3);
|
|
277
|
+
return;
|
|
278
|
+
}
|
|
279
|
+
if (validActors.length > 0) {
|
|
280
|
+
if (adapter.isDebugLogActive) {
|
|
281
|
+
(0, import_logger.writeLog)(`[ZIP] Schalte ${validActors.length} externe(n) Aktor(en) EIN`, "debug");
|
|
282
|
+
}
|
|
283
|
+
for (const actor of validActors) {
|
|
284
|
+
try {
|
|
285
|
+
await adapter.setForeignStateAsync(actor.zip_external_relay_id, true, false);
|
|
286
|
+
} catch (err) {
|
|
287
|
+
const msg = err instanceof Error ? err.message : String(err);
|
|
288
|
+
(0, import_logger.writeLog)(`[ZIP] Fehler beim Einschalten von ${actor.zip_external_relay_id}: ${msg}`, "error");
|
|
289
|
+
}
|
|
290
|
+
}
|
|
291
|
+
if (adapter.zipTimer) {
|
|
292
|
+
adapter.clearTimeout(adapter.zipTimer);
|
|
293
|
+
}
|
|
294
|
+
adapter.zipTimer = adapter.setTimeout(async () => {
|
|
295
|
+
for (const actor of validActors) {
|
|
296
|
+
try {
|
|
297
|
+
await adapter.setForeignStateAsync(actor.zip_external_relay_id, false, false);
|
|
298
|
+
} catch (err) {
|
|
299
|
+
const msg = err instanceof Error ? err.message : String(err);
|
|
300
|
+
(0, import_logger.writeLog)(`[ZIP] Fehler beim Ausschalten von ${actor.zip_external_relay_id}: ${msg}`, "error");
|
|
301
|
+
}
|
|
302
|
+
}
|
|
303
|
+
await adapter.setState(localId, { val: false, ack: true });
|
|
304
|
+
if (adapter.isDebugLogActive) {
|
|
305
|
+
(0, import_logger.writeLog)(`[ZIP] Zeit abgelaufen. Externe Relais AUS.`, "debug");
|
|
306
|
+
}
|
|
307
|
+
}, safeDurationSeconds * 1e3);
|
|
308
|
+
return;
|
|
309
|
+
}
|
|
132
310
|
const bzState = await adapter.getStateAsync((0, import_stateMapping.getDpPath)("WP_BZ_akt"));
|
|
133
311
|
const bzVal = bzState ? Number(bzState.val) : 5;
|
|
134
312
|
const [wwIstS, wwSollS, wwHystS, rLState, rSollState, hzHystState] = await Promise.all([
|
|
@@ -142,15 +320,16 @@ async function handleActivateZip(adapter, id, durationSeconds) {
|
|
|
142
320
|
const useDeaeration = bzVal === 5 && Number(wwIstS == null ? void 0 : wwIstS.val) > Number(wwSollS == null ? void 0 : wwSollS.val) - Number(wwHystS == null ? void 0 : wwHystS.val) && Number(rLState == null ? void 0 : rLState.val) > Number(rSollState == null ? void 0 : rSollState.val) - Number(hzHystState == null ? void 0 : hzHystState.val);
|
|
143
321
|
clearZipTimer(adapter);
|
|
144
322
|
if (useDeaeration) {
|
|
145
|
-
await adapter
|
|
146
|
-
await
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
323
|
+
await safeRawWrite(adapter, "runDeaerate", CONSTANTS.CMD_DEAERATE, 1);
|
|
324
|
+
await safeRawWrite(adapter, "hotWaterCircPumpDeaerate", CONSTANTS.CMD_ZIP, 1);
|
|
325
|
+
const dpDeaerate = (0, import_stateMapping.getDpPath)("runDeaerate");
|
|
326
|
+
const dpCircDeaerate = (0, import_stateMapping.getDpPath)("hotWaterCircPumpDeaerate");
|
|
327
|
+
if (dpDeaerate) {
|
|
328
|
+
await adapter.setOwnStateIfDifferent(dpDeaerate, true, true);
|
|
329
|
+
}
|
|
330
|
+
if (dpCircDeaerate) {
|
|
331
|
+
await adapter.setOwnStateIfDifferent(dpCircDeaerate, true, true);
|
|
332
|
+
}
|
|
154
333
|
} else {
|
|
155
334
|
const onTimeMinutes = Math.ceil(safeDurationSeconds / 60);
|
|
156
335
|
if (!adapter.originalZipConfig) {
|
|
@@ -189,12 +368,7 @@ async function handleActivateZip(adapter, id, durationSeconds) {
|
|
|
189
368
|
for (const u of updates) {
|
|
190
369
|
const def = import_stateMapping.STATE_MAPPING[u.key];
|
|
191
370
|
if (def && def.luxWriteId) {
|
|
192
|
-
await adapter.
|
|
193
|
-
await new Promise((resolve) => {
|
|
194
|
-
adapter.setTimeout(() => {
|
|
195
|
-
resolve();
|
|
196
|
-
}, CONSTANTS.WRITE_DELAY);
|
|
197
|
-
});
|
|
371
|
+
await safeRawWrite(adapter, u.key, parseInt(def.luxWriteId, 10), u.raw);
|
|
198
372
|
}
|
|
199
373
|
}
|
|
200
374
|
}
|
|
@@ -202,10 +376,104 @@ async function handleActivateZip(adapter, id, durationSeconds) {
|
|
|
202
376
|
await stopZipAndDeaeration(adapter);
|
|
203
377
|
}, safeDurationSeconds * 1e3);
|
|
204
378
|
}
|
|
379
|
+
function subscribeMotionSensors(adapter) {
|
|
380
|
+
const config = adapter.config;
|
|
381
|
+
if (config.motion_sensors_aktiv && Array.isArray(config.motionSensors)) {
|
|
382
|
+
for (const sensor of config.motionSensors) {
|
|
383
|
+
if (sensor.oid && typeof sensor.oid === "string" && sensor.oid.trim() !== "") {
|
|
384
|
+
adapter.subscribeForeignStates(sensor.oid.trim());
|
|
385
|
+
if (adapter.isDebugLogActive) {
|
|
386
|
+
(0, import_logger.writeLog)(`Motion sensor subscribed: ${sensor.name} (${sensor.oid})`, "info");
|
|
387
|
+
}
|
|
388
|
+
}
|
|
389
|
+
}
|
|
390
|
+
}
|
|
391
|
+
}
|
|
392
|
+
async function checkAndHandleMotionSensor(adapter, id, state) {
|
|
393
|
+
const config = adapter.config;
|
|
394
|
+
if (!config.motion_sensors_aktiv || !config.motionSensors || !Array.isArray(config.motionSensors)) {
|
|
395
|
+
return false;
|
|
396
|
+
}
|
|
397
|
+
const matchedSensor = config.motionSensors.find((s) => s.oid && s.oid.trim() === id);
|
|
398
|
+
if (!matchedSensor) {
|
|
399
|
+
return false;
|
|
400
|
+
}
|
|
401
|
+
if (state.val === true) {
|
|
402
|
+
const isAllowedBySchedule = await isZipAllowedBySchedule(adapter);
|
|
403
|
+
if (!isAllowedBySchedule) {
|
|
404
|
+
if (adapter.isDebugLogActive) {
|
|
405
|
+
(0, import_logger.writeLog)(
|
|
406
|
+
`Motion registered at sensor '${matchedSensor.name || id}', but action ignored because it is outside the configured Luxtronik ZIP schedule.`,
|
|
407
|
+
"debug"
|
|
408
|
+
);
|
|
409
|
+
}
|
|
410
|
+
return true;
|
|
411
|
+
}
|
|
412
|
+
const activateZipState = await adapter.getStateAsync((0, import_stateMapping.getDpPath)("Activate_Zip"));
|
|
413
|
+
const now = Date.now();
|
|
414
|
+
const lastZipChange = (activateZipState == null ? void 0 : activateZipState.lc) || 0;
|
|
415
|
+
const isCurrentlyActive = (activateZipState == null ? void 0 : activateZipState.val) === true;
|
|
416
|
+
if (isCurrentlyActive || now - lastZipChange > (config.zip_last_run_min || 600) * 1e3) {
|
|
417
|
+
if (adapter.isDebugLogActive) {
|
|
418
|
+
(0, import_logger.writeLog)(
|
|
419
|
+
`Motion registered at sensor '${matchedSensor.name || id}'. Launching or extending circulation pump ZIP macro sequence.`,
|
|
420
|
+
"debug"
|
|
421
|
+
);
|
|
422
|
+
}
|
|
423
|
+
await adapter.setState((0, import_stateMapping.getDpPath)("Activate_Zip"), { val: true, ack: false });
|
|
424
|
+
} else {
|
|
425
|
+
if (adapter.isDebugLogActive) {
|
|
426
|
+
(0, import_logger.writeLog)(
|
|
427
|
+
`Motion registered at sensor '${matchedSensor.name || id}' but circulation pump execution suppressed due to anti-cycling protective interval timer.`,
|
|
428
|
+
"debug"
|
|
429
|
+
);
|
|
430
|
+
}
|
|
431
|
+
}
|
|
432
|
+
}
|
|
433
|
+
return true;
|
|
434
|
+
}
|
|
435
|
+
async function disableHardwareZipTimer(adapter) {
|
|
436
|
+
const config = adapter.config;
|
|
437
|
+
if (config.zip_hardware_timer_disable === true) {
|
|
438
|
+
if (adapter.isDebugLogActive) {
|
|
439
|
+
(0, import_logger.writeLog)("Applying safe hardware defaults for ZIP timers...", "info");
|
|
440
|
+
}
|
|
441
|
+
try {
|
|
442
|
+
await safeRawWrite(adapter, "hotWaterCircPumpTimerTableSelected", 506, 0);
|
|
443
|
+
await adapter.setOwnStateIfDifferent((0, import_stateMapping.getDpPath)("hotWaterCircPumpTimerTableSelected"), 0, true);
|
|
444
|
+
await safeRawWrite(adapter, "hotWaterCircPumpOnTime", 697, 0);
|
|
445
|
+
await adapter.setOwnStateIfDifferent((0, import_stateMapping.getDpPath)("hotWaterCircPumpOnTime"), 0, true);
|
|
446
|
+
await safeRawWrite(adapter, "hotWaterCircPumpOffTime", 698, 60);
|
|
447
|
+
await adapter.setOwnStateIfDifferent((0, import_stateMapping.getDpPath)("hotWaterCircPumpOffTime"), 60, true);
|
|
448
|
+
const timeIds = [
|
|
449
|
+
{ key: "Zirkulation_MoSo_Start1", id: 507 },
|
|
450
|
+
{ key: "Zirkulation_MoSo_End1", id: 508 },
|
|
451
|
+
{ key: "Zirkulation_MoSo_Start2", id: 509 },
|
|
452
|
+
{ key: "Zirkulation_MoSo_End2", id: 510 },
|
|
453
|
+
{ key: "Zirkulation_MoSo_Start3", id: 511 },
|
|
454
|
+
{ key: "Zirkulation_MoSo_End3", id: 512 },
|
|
455
|
+
{ key: "Zirkulation_MoSo_Start4", id: 513 },
|
|
456
|
+
{ key: "Zirkulation_MoSo_End4", id: 514 },
|
|
457
|
+
{ key: "Zirkulation_MoSo_Start5", id: 515 },
|
|
458
|
+
{ key: "Zirkulation_MoSo_End5", id: 516 }
|
|
459
|
+
];
|
|
460
|
+
for (const t of timeIds) {
|
|
461
|
+
await safeRawWrite(adapter, t.key, t.id, 0);
|
|
462
|
+
await adapter.setOwnStateIfDifferent((0, import_stateMapping.getDpPath)(t.key), "00:00", true);
|
|
463
|
+
}
|
|
464
|
+
} catch (err) {
|
|
465
|
+
const msg = err instanceof Error ? err.message : String(err);
|
|
466
|
+
(0, import_logger.writeLog)(`Error applying safe ZIP defaults: ${msg}`, "error");
|
|
467
|
+
}
|
|
468
|
+
}
|
|
469
|
+
}
|
|
205
470
|
// Annotate the CommonJS export names for ESM import in node:
|
|
206
471
|
0 && (module.exports = {
|
|
472
|
+
checkAndHandleMotionSensor,
|
|
473
|
+
disableHardwareZipTimer,
|
|
207
474
|
handleActivateZip,
|
|
208
475
|
restoreOriginalZipConfig,
|
|
209
|
-
stopZipAndDeaeration
|
|
476
|
+
stopZipAndDeaeration,
|
|
477
|
+
subscribeMotionSensors
|
|
210
478
|
});
|
|
211
479
|
//# sourceMappingURL=zipManager.js.map
|
package/build/zipManager.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../src/zipManager.ts"],
|
|
4
|
-
"sourcesContent": ["import type { AdapterInstance } from '@iobroker/adapter-core';\nimport { writeLog } from './logger';\nimport { getDpPath, STATE_MAPPING } from './stateMapping';\n\n// =========================================================\n// CONSTANTS\n// =========================================================\n\n/**\n * Constants used for the circulation pump and deaeration configurations.\n */\nconst CONSTANTS = {\n\t/** Command ID for the deaeration program */\n\tCMD_DEAERATE: 158,\n\t/** Command ID for the circulation pump (ZIP) */\n\tCMD_ZIP: 684,\n\t/** Seconds representing the end of a day (23:59:00) */\n\tEND_OF_DAY: 86340,\n\t/** Delay in milliseconds between consecutive hardware write operations */\n\tWRITE_DELAY: 100,\n};\n\n// =========================================================\n// TYPES & INTERFACES\n// =========================================================\n\n/**\n * Defines the structure for saving and restoring the original circulation pump configuration.\n */\nexport type ZipConfig = Partial<Record<keyof typeof STATE_MAPPING, ioBroker.StateValue | null>>;\n\n/**\n * Extended adapter interface to provide type safety for dynamic properties and methods.\n */\ninterface ExtendedAdapter extends AdapterInstance {\n\t/** Cached copy of the original circulation pump settings before macro activation */\n\toriginalZipConfig?: ZipConfig | null;\n\t/** ioBroker timeout handle for the hot water circulation pump macro */\n\tzipTimer?: ioBroker.Timeout;\n\t/** Determines whether verbose debugging output is enabled */\n\tisDebugLogActive?: boolean;\n\t/**\n\t * Function to queue a hardware write operation.\n\t *\n\t * @param luxId - Target parameter register ID\n\t * @param value - The value payload to write\n\t * @returns A promise resolving once the task is queued\n\t */\n\tqueueWrite: (luxId: number, value: number) => Promise<void>;\n\t/**\n\t * Function to synchronize a configuration value.\n\t *\n\t * @param key - The unique key identifier within the STATE_MAPPING\n\t * @param value - The raw or parsed value to apply\n\t * @returns A promise resolving when the synchronization finishes\n\t */\n\tsyncConfigValue: (key: string, value: any) => Promise<void>;\n\t/**\n\t * Function to safely update an internal state if the value differs.\n\t *\n\t * @param dpPath - The state path ID\n\t * @param value - The updated value to process\n\t * @param ack - Explicit acknowledgment flag status\n\t * @returns A promise resolving when the write operation completes\n\t */\n\tsetOwnStateIfDifferent: (dpPath: string, value: any, ack?: boolean) => Promise<void>;\n}\n\n// =========================================================\n// HELPER FUNCTIONS\n// =========================================================\n\n/**\n * Safely clears the active circulation pump macro timer.\n *\n * @param adapter - The extended adapter instance\n */\nfunction clearZipTimer(adapter: ExtendedAdapter): void {\n\tif (!adapter.zipTimer) {\n\t\treturn;\n\t}\n\tadapter.clearTimeout(adapter.zipTimer);\n\tadapter.zipTimer = undefined;\n}\n\n// =========================================================\n// MAIN EXPORTS\n// =========================================================\n\n/**\n * Restores the original circulation pump configuration from the saved cache.\n *\n * @param adapter - The extended adapter instance\n * @returns A promise resolving when the restoration completes\n */\nexport async function restoreOriginalZipConfig(adapter: ExtendedAdapter): Promise<void> {\n\tif (!adapter.originalZipConfig) {\n\t\treturn;\n\t}\n\n\ttry {\n\t\tfor (const [key, val] of Object.entries(adapter.originalZipConfig)) {\n\t\t\tif (val === null || val === undefined) {\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tconst def = STATE_MAPPING[key];\n\t\t\tif (!def || !def.luxWriteId) {\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tlet rawVal = val;\n\n\t\t\tif (def.role === 'value.datetime' && typeof val === 'string') {\n\t\t\t\tconst timeMatch = val.match(/^(\\d{1,2}):(\\d{1,2})/);\n\t\t\t\tif (timeMatch) {\n\t\t\t\t\trawVal = parseInt(timeMatch[1], 10) * 3600 + parseInt(timeMatch[2], 10) * 60;\n\t\t\t\t} else {\n\t\t\t\t\trawVal = 0;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tconst targetPath = getDpPath(key);\n\t\t\tif (targetPath) {\n\t\t\t\tawait adapter.setState(targetPath, { val: val, ack: true });\n\t\t\t}\n\n\t\t\tconst luxId = Number(def.luxWriteId);\n\t\t\tif (!isNaN(luxId)) {\n\t\t\t\tawait adapter.queueWrite(luxId, Number(rawVal));\n\t\t\t\tawait new Promise<void>(resolve => {\n\t\t\t\t\tadapter.setTimeout(() => {\n\t\t\t\t\t\tresolve();\n\t\t\t\t\t}, CONSTANTS.WRITE_DELAY);\n\t\t\t\t});\n\t\t\t}\n\t\t}\n\t} catch (err: unknown) {\n\t\tconst msg = err instanceof Error ? err.message : String(err);\n\t\twriteLog(`Error restoring ZIP configuration: ${msg}`, 'error');\n\t} finally {\n\t\tadapter.originalZipConfig = null;\n\t}\n}\n\n/**\n * Stops the active circulation pump macro and deaeration program.\n *\n * @param adapter - The extended adapter instance\n * @returns A promise resolving when the processes are stopped\n */\nexport async function stopZipAndDeaeration(adapter: ExtendedAdapter): Promise<void> {\n\ttry {\n\t\tconst activateZipState = await adapter.getStateAsync(getDpPath('Activate_Zip'));\n\t\tconst runDeaerateState = await adapter.getStateAsync(getDpPath('runDeaerate'));\n\n\t\tconst isZipActive = activateZipState?.val === true || adapter.zipTimer || adapter.originalZipConfig !== null;\n\t\tconst isDeaerateActive = runDeaerateState?.val === 1 || runDeaerateState?.val === true;\n\n\t\tif (isZipActive || isDeaerateActive) {\n\t\t\tif (adapter.isDebugLogActive) {\n\t\t\t\twriteLog('Conditions met: Stopping active ZIP macro and deaeration program...', 'info');\n\t\t\t}\n\n\t\t\tclearZipTimer(adapter);\n\t\t\tawait restoreOriginalZipConfig(adapter);\n\n\t\t\tawait adapter.queueWrite(CONSTANTS.CMD_DEAERATE, 0);\n\t\t\tawait new Promise<void>(resolve => {\n\t\t\t\tadapter.setTimeout(() => {\n\t\t\t\t\tresolve();\n\t\t\t\t}, CONSTANTS.WRITE_DELAY);\n\t\t\t});\n\n\t\t\tawait adapter.queueWrite(CONSTANTS.CMD_ZIP, 0);\n\t\t\tawait new Promise<void>(resolve => {\n\t\t\t\tadapter.setTimeout(() => {\n\t\t\t\t\tresolve();\n\t\t\t\t}, CONSTANTS.WRITE_DELAY);\n\t\t\t});\n\n\t\t\tawait adapter.syncConfigValue('runDeaerate', false);\n\t\t\tawait adapter.syncConfigValue('hotWaterCircPumpDeaerate', false);\n\n\t\t\tconst dpZip = getDpPath('Activate_Zip');\n\t\t\tif (dpZip) {\n\t\t\t\tawait adapter.setOwnStateIfDifferent(dpZip, false, true);\n\t\t\t}\n\t\t}\n\t} catch (err: unknown) {\n\t\tconst msg = err instanceof Error ? err.message : String(err);\n\t\twriteLog(`Error stopping ZIP/Deaeration: ${msg}`, 'error');\n\t}\n}\n\n/**\n * Activates the circulation pump (ZIP) macro or deaeration program for a specified duration.\n *\n * @param adapter - The extended adapter instance\n * @param id - The ID of the triggered state\n * @param durationSeconds - The duration in seconds to keep the process active\n * @returns A promise resolving when the activation sequence completes\n */\nexport async function handleActivateZip(adapter: ExtendedAdapter, id: string, durationSeconds: number): Promise<void> {\n\tconst localId = id.replace(`${adapter.namespace}.`, '');\n\tawait adapter.setStateAsync(localId, { val: true, ack: true });\n\n\tif (durationSeconds <= 0) {\n\t\tawait adapter.setStateAsync(localId, { val: false, ack: true });\n\t\treturn;\n\t}\n\n\tconst safeDurationSeconds = Math.max(1, isNaN(durationSeconds) ? 60 : durationSeconds);\n\tconst bzState = await adapter.getStateAsync(getDpPath('WP_BZ_akt'));\n\tconst bzVal = bzState ? Number(bzState.val) : 5;\n\n\tconst [wwIstS, wwSollS, wwHystS, rLState, rSollState, hzHystState] = await Promise.all([\n\t\tadapter.getStateAsync(getDpPath('Wamwassertemperatur_Ist')),\n\t\tadapter.getStateAsync(getDpPath('Wamwassertemperatur_Soll')),\n\t\tadapter.getStateAsync(getDpPath('hotWaterTemperatureHysteresis')),\n\t\tadapter.getStateAsync(getDpPath('temperature_return')),\n\t\tadapter.getStateAsync(getDpPath('temperature_target_return')),\n\t\tadapter.getStateAsync(getDpPath('returnTemperatureHysteresis')),\n\t]);\n\n\tconst useDeaeration =\n\t\tbzVal === 5 &&\n\t\tNumber(wwIstS?.val) > Number(wwSollS?.val) - Number(wwHystS?.val) &&\n\t\tNumber(rLState?.val) > Number(rSollState?.val) - Number(hzHystState?.val);\n\n\tclearZipTimer(adapter);\n\n\tif (useDeaeration) {\n\t\tawait adapter.queueWrite(CONSTANTS.CMD_DEAERATE, 1);\n\t\tawait new Promise<void>(resolve => {\n\t\t\tadapter.setTimeout(() => {\n\t\t\t\tresolve();\n\t\t\t}, CONSTANTS.WRITE_DELAY);\n\t\t});\n\n\t\tawait adapter.queueWrite(CONSTANTS.CMD_ZIP, 1);\n\t\tawait adapter.syncConfigValue('runDeaerate', true);\n\t\tawait adapter.syncConfigValue('hotWaterCircPumpDeaerate', true);\n\t} else {\n\t\tconst onTimeMinutes = Math.ceil(safeDurationSeconds / 60);\n\t\tif (!adapter.originalZipConfig) {\n\t\t\tconst keysToSave = [\n\t\t\t\t'hotWaterCircPumpTimerTableSelected',\n\t\t\t\t'WW_MoSo_Start1',\n\t\t\t\t'WW_MoSo_End1',\n\t\t\t\t'WW_MoSo_Start2',\n\t\t\t\t'WW_MoSo_End2',\n\t\t\t\t'WW_MoSo_Start3',\n\t\t\t\t'WW_MoSo_End3',\n\t\t\t\t'WW_MoSo_Start4',\n\t\t\t\t'WW_MoSo_End4',\n\t\t\t\t'WW_MoSo_Start5',\n\t\t\t\t'WW_MoSo_End5',\n\t\t\t\t'hotWaterCircPumpOnTime',\n\t\t\t\t'hotWaterCircPumpOffTime',\n\t\t\t] as const;\n\n\t\t\tconst states = await Promise.all(keysToSave.map(key => adapter.getStateAsync(getDpPath(key as any))));\n\n\t\t\tadapter.originalZipConfig = {};\n\t\t\tkeysToSave.forEach((key, index) => {\n\t\t\t\tif (adapter.originalZipConfig) {\n\t\t\t\t\tadapter.originalZipConfig[key] = states[index] ? states[index].val : null;\n\t\t\t\t}\n\t\t\t});\n\t\t}\n\n\t\tconst updates = [\n\t\t\t{ key: 'hotWaterCircPumpTimerTableSelected', raw: 0 },\n\t\t\t{ key: 'WW_MoSo_Start1', raw: 0 },\n\t\t\t{ key: 'WW_MoSo_End1', raw: CONSTANTS.END_OF_DAY },\n\t\t\t{ key: 'WW_MoSo_Start2', raw: 0 },\n\t\t\t{ key: 'WW_MoSo_End2', raw: 0 },\n\t\t\t{ key: 'hotWaterCircPumpOnTime', raw: onTimeMinutes },\n\t\t\t{ key: 'hotWaterCircPumpOffTime', raw: 60 },\n\t\t];\n\n\t\tfor (const u of updates) {\n\t\t\tconst def = STATE_MAPPING[u.key];\n\t\t\tif (def && def.luxWriteId) {\n\t\t\t\tawait adapter.queueWrite(parseInt(def.luxWriteId, 10), u.raw);\n\t\t\t\tawait new Promise<void>(resolve => {\n\t\t\t\t\tadapter.setTimeout(() => {\n\t\t\t\t\t\tresolve();\n\t\t\t\t\t}, CONSTANTS.WRITE_DELAY);\n\t\t\t\t});\n\t\t\t}\n\t\t}\n\t}\n\n\tadapter.zipTimer = adapter.setTimeout(async () => {\n\t\tawait stopZipAndDeaeration(adapter);\n\t}, safeDurationSeconds * 1000);\n}\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,oBAAyB;AACzB,0BAAyC;AASzC,MAAM,YAAY;AAAA;AAAA,EAEjB,cAAc;AAAA;AAAA,EAEd,SAAS;AAAA;AAAA,EAET,YAAY;AAAA;AAAA,EAEZ,aAAa;AACd;AAyDA,SAAS,cAAc,SAAgC;AACtD,MAAI,CAAC,QAAQ,UAAU;AACtB;AAAA,EACD;AACA,UAAQ,aAAa,QAAQ,QAAQ;AACrC,UAAQ,WAAW;AACpB;AAYA,eAAsB,yBAAyB,SAAyC;AACvF,MAAI,CAAC,QAAQ,mBAAmB;AAC/B;AAAA,EACD;AAEA,MAAI;AACH,eAAW,CAAC,KAAK,GAAG,KAAK,OAAO,QAAQ,QAAQ,iBAAiB,GAAG;AACnE,UAAI,QAAQ,QAAQ,QAAQ,QAAW;AACtC;AAAA,MACD;AAEA,YAAM,MAAM,kCAAc,GAAG;AAC7B,UAAI,CAAC,OAAO,CAAC,IAAI,YAAY;AAC5B;AAAA,MACD;AAEA,UAAI,SAAS;AAEb,UAAI,IAAI,SAAS,oBAAoB,OAAO,QAAQ,UAAU;AAC7D,cAAM,YAAY,IAAI,MAAM,sBAAsB;AAClD,YAAI,WAAW;AACd,mBAAS,SAAS,UAAU,CAAC,GAAG,EAAE,IAAI,O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UAAM,UAAU;AAAA,MACf,EAAE,KAAK,sCAAsC,KAAK,EAAE;AAAA,MACpD,EAAE,KAAK,kBAAkB,KAAK,EAAE;AAAA,MAChC,EAAE,KAAK,gBAAgB,KAAK,UAAU,WAAW;AAAA,MACjD,EAAE,KAAK,kBAAkB,KAAK,EAAE;AAAA,MAChC,EAAE,KAAK,gBAAgB,KAAK,EAAE;AAAA,MAC9B,EAAE,KAAK,0BAA0B,KAAK,cAAc;AAAA,MACpD,EAAE,KAAK,2BAA2B,KAAK,GAAG;AAAA,IAC3C;AAEA,eAAW,KAAK,SAAS;AACxB,YAAM,MAAM,kCAAc,EAAE,GAAG;AAC/B,UAAI,OAAO,IAAI,YAAY;AAC1B,cAAM,QAAQ,WAAW,SAAS,IAAI,YAAY,EAAE,GAAG,EAAE,GAAG;AAC5D,cAAM,IAAI,QAAc,aAAW;AAClC,kBAAQ,WAAW,MAAM;AACxB,oBAAQ;AAAA,UACT,GAAG,UAAU,WAAW;AAAA,QACzB,CAAC;AAAA,MACF;AAAA,IACD;AAAA,EACD;AAEA,UAAQ,WAAW,QAAQ,WAAW,YAAY;AACjD,UAAM,qBAAqB,OAAO;AAAA,EACnC,GAAG,sBAAsB,GAAI;AAC9B;",
|
|
4
|
+
"sourcesContent": ["import type { AdapterInstance } from '@iobroker/adapter-core';\nimport { timeStringToSeconds } from './convert';\nimport { writeLog } from './logger';\nimport { queueWrite } from './rawFunctions';\nimport { getDpPath, STATE_MAPPING } from './stateMapping';\n// =========================================================\n// CONSTANTS\n// =========================================================\n\nconst CONSTANTS = {\n\tCMD_DEAERATE: 158,\n\tCMD_ZIP: 684,\n\tEND_OF_DAY: 86340,\n\tWRITE_DELAY: 100,\n};\n\n// =========================================================\n// TYPES & INTERFACES\n// =========================================================\n\nexport type ZipConfig = Partial<Record<keyof typeof STATE_MAPPING, ioBroker.StateValue | null>>;\n\ninterface ExtendedAdapter extends AdapterInstance {\n\tconfig: ioBroker.AdapterConfig & Record<string, any>;\n\toriginalZipConfig?: ZipConfig | null;\n\tzipTimer?: ioBroker.Timeout;\n\tisDebugLogActive?: boolean;\n\tsyncConfigValue: (key: string, value: any) => Promise<void>;\n\tsetOwnStateIfDifferent: (dpPath: string, value: any, ack?: boolean) => Promise<void>;\n\twriteCyclesToday: number;\n\twriteCyclesTotal: number;\n\twriteQueue: (() => Promise<void>)[];\n\tisWriting: boolean;\n}\n\n// =========================================================\n// HELPER FUNCTIONS\n// =========================================================\n\n/**\n * Sch\u00FCtzt den Speicher durch Read-Before-Write direkt auf Rohwert-Ebene.\n *\n * @param adapter The adapter instance used to read/write states and queue writes\n * @param key The state mapping key to write\n * @param luxId The Luxtronik register id to write to\n * @param rawValue The raw numeric value to write into the register\n */\nasync function safeRawWrite(\n\tadapter: ExtendedAdapter,\n\tkey: keyof typeof STATE_MAPPING,\n\tluxId: number,\n\trawValue: number,\n): Promise<void> {\n\tconst dpPath = getDpPath(key);\n\tif (!dpPath) {\n\t\treturn;\n\t}\n\n\tconst state = await adapter.getStateAsync(dpPath);\n\n\tif (state && state.val !== null) {\n\t\tlet currentRaw: number | null = null;\n\n\t\tif (typeof state.val === 'boolean') {\n\t\t\tcurrentRaw = state.val ? 1 : 0;\n\t\t} else if (typeof state.val === 'number') {\n\t\t\tcurrentRaw = state.val;\n\t\t} else if (typeof state.val === 'string') {\n\t\t\t// NEU: Fr\u00FChjahrsputz! Nutzt die zentrale Funktion anstatt Inline-RegEx\n\t\t\tcurrentRaw = timeStringToSeconds(state.val);\n\t\t}\n\n\t\tif (currentRaw === rawValue) {\n\t\t\tif (adapter.isDebugLogActive) {\n\t\t\t\twriteLog(\n\t\t\t\t\t`[SafeWrite] Wert f\u00FCr '${key}' ist bereits auf Zielwert (${rawValue}). Schreibvorgang blockiert!`,\n\t\t\t\t\t'debug',\n\t\t\t\t);\n\t\t\t}\n\t\t\treturn;\n\t\t}\n\t}\n\n\tif (adapter.isDebugLogActive) {\n\t\twriteLog(`[SafeWrite] \u00C4nderung erkannt. Schreibe ${rawValue} in Register ${luxId} (${key})...`, 'debug');\n\t}\n\tawait queueWrite(adapter, luxId, rawValue);\n\n\tawait new Promise<void>(resolve => {\n\t\tadapter.setTimeout(resolve, CONSTANTS.WRITE_DELAY);\n\t});\n}\n\nfunction clearZipTimer(adapter: ExtendedAdapter): void {\n\tif (!adapter.zipTimer) {\n\t\treturn;\n\t}\n\tadapter.clearTimeout(adapter.zipTimer);\n\tadapter.zipTimer = undefined;\n}\n\n/**\n * Pr\u00FCft dynamisch, ob die aktuelle Uhrzeit laut den Luxtronik-Zeitpl\u00E4nen f\u00FCr die Zirkulation freigegeben ist.\n *\n * @param adapter - Instanz des Adapters, verwendet zum Lesen von States und Konfigurationen\n */\nasync function isZipAllowedBySchedule(adapter: ExtendedAdapter): Promise<boolean> {\n\tconst config = adapter.config;\n\n\t// Wenn Hardware-Timer deaktivert sind -> Dauerfreigabe\n\tif (config.zip_hardware_timer_disable === true) {\n\t\treturn true;\n\t}\n\n\ttry {\n\t\tconst tableState = await adapter.getStateAsync(getDpPath('hotWaterCircPumpTimerTableSelected'));\n\t\tconst tableMode = tableState ? Number(tableState.val) : 0;\n\n\t\tconst now = new Date();\n\t\tconst day = now.getDay();\n\t\tconst currentSeconds = now.getHours() * 3600 + now.getMinutes() * 60 + now.getSeconds();\n\n\t\tlet prefix = 'Zirkulation_MoSo';\n\t\tlet endSuffix = 'End';\n\n\t\tif (tableMode === 1) {\n\t\t\t// 5+2\n\t\t\tprefix = day >= 1 && day <= 5 ? 'Zirkulation_MoFr' : 'Zirkulation_SaSo';\n\t\t\tendSuffix = 'Ende';\n\t\t} else if (tableMode === 2) {\n\t\t\t// Einzeltage\n\t\t\tconst days = ['Sonntag', 'Montag', 'Dienstag', 'Mittwoch', 'Donnerstag', 'Freitag', 'Samstag'];\n\t\t\tprefix = `Zirkulation_${days[day]}`;\n\t\t\tendSuffix = 'Ende';\n\t\t}\n\n\t\tlet isAllowed = false;\n\n\t\tfor (let i = 1; i <= 5; i++) {\n\t\t\tconst startKey = `${prefix}_Start${i}`;\n\t\t\tconst endKey = `${prefix}_${endSuffix}${i}`;\n\n\t\t\tconst startState = await adapter.getStateAsync(getDpPath(startKey));\n\t\t\tconst endState = await adapter.getStateAsync(getDpPath(endKey));\n\n\t\t\tif (startState && startState.val && endState && endState.val) {\n\t\t\t\tconst startSec = timeStringToSeconds(String(startState.val));\n\t\t\t\tconst endSec = timeStringToSeconds(String(endState.val));\n\n\t\t\t\tif (startSec !== endSec) {\n\t\t\t\t\tlet actualEndSec = endSec;\n\t\t\t\t\tif (endSec === 0 && startSec > 0) {\n\t\t\t\t\t\tactualEndSec = 86400; // Mitternacht\n\t\t\t\t\t}\n\t\t\t\t\tif (currentSeconds >= startSec && currentSeconds <= actualEndSec) {\n\t\t\t\t\t\tisAllowed = true;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn isAllowed;\n\t} catch (err: unknown) {\n\t\tconst msg = err instanceof Error ? err.message : String(err);\n\t\tif (adapter.isDebugLogActive) {\n\t\t\twriteLog(`[ZIP] Fehler bei der Zeitplan-Pr\u00FCfung: ${msg}`, 'error');\n\t\t}\n\t\treturn true; // Fallback: Erlauben, damit es im Fehlerfall warm bleibt\n\t}\n}\n\n// =========================================================\n// MAIN EXPORTS\n// =========================================================\n\n/**\n * Restores the original circulation pump configuration from the saved cache.\n *\n * @param adapter - The extended adapter instance\n * @returns A promise resolving when the restoration completes\n */\nexport async function restoreOriginalZipConfig(adapter: ExtendedAdapter): Promise<void> {\n\tif (!adapter.originalZipConfig) {\n\t\treturn;\n\t}\n\n\ttry {\n\t\tfor (const [key, val] of Object.entries(adapter.originalZipConfig)) {\n\t\t\tif (val === null || val === undefined) {\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tconst def = STATE_MAPPING[key];\n\t\t\tif (!def || !def.luxWriteId) {\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tlet rawVal = val;\n\n\t\t\tif (def.role === 'value.datetime' && typeof val === 'string') {\n\t\t\t\t// NEU: Fr\u00FChjahrsputz! Nutzt die zentrale Funktion\n\t\t\t\trawVal = timeStringToSeconds(val);\n\t\t\t}\n\n\t\t\tconst targetPath = getDpPath(key);\n\t\t\tif (targetPath) {\n\t\t\t\tawait adapter.setState(targetPath, { val: val, ack: true });\n\t\t\t}\n\n\t\t\tconst luxId = Number(def.luxWriteId);\n\t\t\tif (!isNaN(luxId)) {\n\t\t\t\tawait queueWrite(adapter, luxId, Number(rawVal));\n\t\t\t\tawait new Promise<void>(resolve => {\n\t\t\t\t\tadapter.setTimeout(() => resolve(), CONSTANTS.WRITE_DELAY);\n\t\t\t\t});\n\t\t\t}\n\t\t}\n\t} catch (err: unknown) {\n\t\tconst msg = err instanceof Error ? err.message : String(err);\n\t\twriteLog(`Error restoring ZIP configuration: ${msg}`, 'error');\n\t} finally {\n\t\tadapter.originalZipConfig = null;\n\t}\n}\n\n/**\n * Stops the active circulation pump macro and deaeration program.\n *\n * @param adapter - The extended adapter instance\n * @returns A promise resolving when the processes are stopped\n */\nexport async function stopZipAndDeaeration(adapter: ExtendedAdapter): Promise<void> {\n\tconst actors = adapter.config.actors || [];\n\tconst validActors = actors.filter((a: any) => a.zip_external_relay_id && a.zip_external_relay_id.trim() !== '');\n\n\tif (validActors.length > 0) {\n\t\ttry {\n\t\t\tfor (const actor of validActors) {\n\t\t\t\tawait adapter.setForeignStateAsync(actor.zip_external_relay_id, false, false);\n\t\t\t}\n\t\t\tif (adapter.isDebugLogActive) {\n\t\t\t\twriteLog(`[ZIP] Not-Aus f\u00FCr externe Relais gesendet.`, 'debug');\n\t\t\t}\n\t\t} catch (err: unknown) {\n\t\t\tconst msg = err instanceof Error ? err.message : String(err);\n\t\t\twriteLog(`[ZIP] Fehler beim Ausschalten der externen Relais: ${msg}`, 'error');\n\t\t}\n\t}\n\n\ttry {\n\t\tconst activateZipState = await adapter.getStateAsync(getDpPath('Activate_Zip'));\n\t\tconst runDeaerateState = await adapter.getStateAsync(getDpPath('runDeaerate'));\n\n\t\tconst isZipActive = activateZipState?.val === true || adapter.zipTimer || adapter.originalZipConfig !== null;\n\t\tconst isDeaerateActive = runDeaerateState?.val === 1 || runDeaerateState?.val === true;\n\n\t\tif (isZipActive || isDeaerateActive) {\n\t\t\tif (adapter.isDebugLogActive) {\n\t\t\t\twriteLog('Stopping active ZIP macro and deaeration program...', 'info');\n\t\t\t}\n\n\t\t\tclearZipTimer(adapter);\n\t\t\tawait restoreOriginalZipConfig(adapter);\n\n\t\t\tawait safeRawWrite(adapter, 'runDeaerate', CONSTANTS.CMD_DEAERATE, 0);\n\t\t\tawait safeRawWrite(adapter, 'hotWaterCircPumpDeaerate', CONSTANTS.CMD_ZIP, 0);\n\n\t\t\tconst dpDeaerate = getDpPath('runDeaerate');\n\t\t\tconst dpCircDeaerate = getDpPath('hotWaterCircPumpDeaerate');\n\t\t\tif (dpDeaerate) {\n\t\t\t\tawait adapter.setOwnStateIfDifferent(dpDeaerate, false, true);\n\t\t\t}\n\t\t\tif (dpCircDeaerate) {\n\t\t\t\tawait adapter.setOwnStateIfDifferent(dpCircDeaerate, false, true);\n\t\t\t}\n\n\t\t\tconst dpZip = getDpPath('Activate_Zip');\n\t\t\tif (dpZip) {\n\t\t\t\tawait adapter.setOwnStateIfDifferent(dpZip, false, true);\n\t\t\t}\n\t\t}\n\t} catch (err: unknown) {\n\t\tconst msg = err instanceof Error ? err.message : String(err);\n\t\twriteLog(`Error stopping ZIP/Deaeration: ${msg}`, 'error');\n\t}\n}\n\n/**\n * Activates the circulation pump (ZIP) macro or deaeration program for a specified duration.\n *\n * @param adapter - The extended adapter instance\n * @param id - The ID of the triggered state\n * @param durationSeconds - The duration in seconds to keep the process active\n * @returns A promise resolving when the activation sequence completes\n */\nexport async function handleActivateZip(adapter: ExtendedAdapter, id: string, durationSeconds: number): Promise<void> {\n\tconst actors = adapter.config.actors || [];\n\tconst validActors = actors.filter((a: any) => a.zip_external_relay_id && a.zip_external_relay_id.trim() !== '');\n\n\tlet isZipAlreadyRunning = false;\n\n\tif (validActors.length > 0) {\n\t\tfor (const actor of validActors) {\n\t\t\ttry {\n\t\t\t\tconst foreignState = await adapter.getForeignStateAsync(actor.zip_external_relay_id);\n\t\t\t\tif (foreignState && foreignState.val === true) {\n\t\t\t\t\tisZipAlreadyRunning = true;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t} catch (err: unknown) {\n\t\t\t\tconst msg = err instanceof Error ? err.message : String(err);\n\t\t\t\tif (adapter.isDebugLogActive) {\n\t\t\t\t\twriteLog(\n\t\t\t\t\t\t`[ZIP] Konnte Status des externen Relais ${actor.zip_external_relay_id} nicht lesen: ${msg}`,\n\t\t\t\t\t\t'debug',\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t} else {\n\t\ttry {\n\t\t\tconst internalZip = await adapter.getStateAsync(getDpPath('ZIPout'));\n\t\t\tif (internalZip && (internalZip.val === 1 || internalZip.val === true)) {\n\t\t\t\tisZipAlreadyRunning = true;\n\t\t\t}\n\t\t} catch (err) {\n\t\t\tconst msg = err instanceof Error ? err.message : String(err);\n\t\t\tif (adapter.isDebugLogActive) {\n\t\t\t\twriteLog(`[ZIP] ${msg}`, 'debug');\n\t\t\t}\n\t\t}\n\t}\n\n\tconst localId = id.replace(`${adapter.namespace}.`, '');\n\tawait adapter.setState(localId, { val: true, ack: true });\n\n\tif (durationSeconds <= 0) {\n\t\tawait adapter.setState(localId, { val: false, ack: true });\n\t\treturn;\n\t}\n\n\tconst safeDurationSeconds = Math.max(1, isNaN(durationSeconds) ? 60 : durationSeconds);\n\n\tif (isZipAlreadyRunning) {\n\t\tif (adapter.isDebugLogActive) {\n\t\t\twriteLog('[ZIP] Pumpe l\u00E4uft bereits. Verl\u00E4ngere Timer.', 'debug');\n\t\t}\n\n\t\tif (adapter.zipTimer) {\n\t\t\tadapter.clearTimeout(adapter.zipTimer);\n\t\t}\n\n\t\tadapter.zipTimer = adapter.setTimeout(async () => {\n\t\t\tif (validActors.length > 0) {\n\t\t\t\tfor (const actor of validActors) {\n\t\t\t\t\ttry {\n\t\t\t\t\t\tawait adapter.setForeignStateAsync(actor.zip_external_relay_id, false, false);\n\t\t\t\t\t} catch (err) {\n\t\t\t\t\t\tconst msg = err instanceof Error ? err.message : String(err);\n\t\t\t\t\t\twriteLog(`[ZIP] Fehler beim Ausschalten des Relais: ${msg}`, 'error');\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tawait adapter.setState(localId, { val: false, ack: true }); // Reset Button\n\t\t\t} else {\n\t\t\t\tawait stopZipAndDeaeration(adapter);\n\t\t\t}\n\t\t}, safeDurationSeconds * 1000);\n\n\t\treturn;\n\t}\n\n\tif (validActors.length > 0) {\n\t\tif (adapter.isDebugLogActive) {\n\t\t\twriteLog(`[ZIP] Schalte ${validActors.length} externe(n) Aktor(en) EIN`, 'debug');\n\t\t}\n\n\t\tfor (const actor of validActors) {\n\t\t\ttry {\n\t\t\t\tawait adapter.setForeignStateAsync(actor.zip_external_relay_id, true, false);\n\t\t\t} catch (err) {\n\t\t\t\tconst msg = err instanceof Error ? err.message : String(err);\n\t\t\t\twriteLog(`[ZIP] Fehler beim Einschalten von ${actor.zip_external_relay_id}: ${msg}`, 'error');\n\t\t\t}\n\t\t}\n\n\t\tif (adapter.zipTimer) {\n\t\t\tadapter.clearTimeout(adapter.zipTimer);\n\t\t}\n\n\t\tadapter.zipTimer = adapter.setTimeout(async () => {\n\t\t\tfor (const actor of validActors) {\n\t\t\t\ttry {\n\t\t\t\t\tawait adapter.setForeignStateAsync(actor.zip_external_relay_id, false, false);\n\t\t\t\t} catch (err) {\n\t\t\t\t\tconst msg = err instanceof Error ? err.message : String(err);\n\t\t\t\t\twriteLog(`[ZIP] Fehler beim Ausschalten von ${actor.zip_external_relay_id}: ${msg}`, 'error');\n\t\t\t\t}\n\t\t\t}\n\t\t\tawait adapter.setState(localId, { val: false, ack: true }); // Reset Button\n\t\t\tif (adapter.isDebugLogActive) {\n\t\t\t\twriteLog(`[ZIP] Zeit abgelaufen. Externe Relais AUS.`, 'debug');\n\t\t\t}\n\t\t}, safeDurationSeconds * 1000);\n\n\t\treturn;\n\t}\n\n\tconst bzState = await adapter.getStateAsync(getDpPath('WP_BZ_akt'));\n\tconst bzVal = bzState ? Number(bzState.val) : 5;\n\n\tconst [wwIstS, wwSollS, wwHystS, rLState, rSollState, hzHystState] = await Promise.all([\n\t\tadapter.getStateAsync(getDpPath('Wamwassertemperatur_Ist')),\n\t\tadapter.getStateAsync(getDpPath('Wamwassertemperatur_Soll')),\n\t\tadapter.getStateAsync(getDpPath('hotWaterTemperatureHysteresis')),\n\t\tadapter.getStateAsync(getDpPath('temperature_return')),\n\t\tadapter.getStateAsync(getDpPath('temperature_target_return')),\n\t\tadapter.getStateAsync(getDpPath('returnTemperatureHysteresis')),\n\t]);\n\n\tconst useDeaeration =\n\t\tbzVal === 5 &&\n\t\tNumber(wwIstS?.val) > Number(wwSollS?.val) - Number(wwHystS?.val) &&\n\t\tNumber(rLState?.val) > Number(rSollState?.val) - Number(hzHystState?.val);\n\n\tclearZipTimer(adapter);\n\n\tif (useDeaeration) {\n\t\tawait safeRawWrite(adapter, 'runDeaerate', CONSTANTS.CMD_DEAERATE, 1);\n\t\tawait safeRawWrite(adapter, 'hotWaterCircPumpDeaerate', CONSTANTS.CMD_ZIP, 1);\n\n\t\tconst dpDeaerate = getDpPath('runDeaerate');\n\t\tconst dpCircDeaerate = getDpPath('hotWaterCircPumpDeaerate');\n\t\tif (dpDeaerate) {\n\t\t\tawait adapter.setOwnStateIfDifferent(dpDeaerate, true, true);\n\t\t}\n\t\tif (dpCircDeaerate) {\n\t\t\tawait adapter.setOwnStateIfDifferent(dpCircDeaerate, true, true);\n\t\t}\n\t} else {\n\t\tconst onTimeMinutes = Math.ceil(safeDurationSeconds / 60);\n\t\tif (!adapter.originalZipConfig) {\n\t\t\tconst keysToSave = [\n\t\t\t\t'hotWaterCircPumpTimerTableSelected',\n\t\t\t\t'WW_MoSo_Start1',\n\t\t\t\t'WW_MoSo_End1',\n\t\t\t\t'WW_MoSo_Start2',\n\t\t\t\t'WW_MoSo_End2',\n\t\t\t\t'WW_MoSo_Start3',\n\t\t\t\t'WW_MoSo_End3',\n\t\t\t\t'WW_MoSo_Start4',\n\t\t\t\t'WW_MoSo_End4',\n\t\t\t\t'WW_MoSo_Start5',\n\t\t\t\t'WW_MoSo_End5',\n\t\t\t\t'hotWaterCircPumpOnTime',\n\t\t\t\t'hotWaterCircPumpOffTime',\n\t\t\t] as const;\n\n\t\t\tconst states = await Promise.all(keysToSave.map(key => adapter.getStateAsync(getDpPath(key as any))));\n\n\t\t\tadapter.originalZipConfig = {};\n\t\t\tkeysToSave.forEach((key, index) => {\n\t\t\t\tif (adapter.originalZipConfig) {\n\t\t\t\t\tadapter.originalZipConfig[key] = states[index] ? states[index].val : null;\n\t\t\t\t}\n\t\t\t});\n\t\t}\n\n\t\tconst updates = [\n\t\t\t{ key: 'hotWaterCircPumpTimerTableSelected', raw: 0 },\n\t\t\t{ key: 'WW_MoSo_Start1', raw: 0 },\n\t\t\t{ key: 'WW_MoSo_End1', raw: CONSTANTS.END_OF_DAY },\n\t\t\t{ key: 'WW_MoSo_Start2', raw: 0 },\n\t\t\t{ key: 'WW_MoSo_End2', raw: 0 },\n\t\t\t{ key: 'hotWaterCircPumpOnTime', raw: onTimeMinutes },\n\t\t\t{ key: 'hotWaterCircPumpOffTime', raw: 60 },\n\t\t];\n\n\t\tfor (const u of updates) {\n\t\t\tconst def = STATE_MAPPING[u.key];\n\t\t\tif (def && def.luxWriteId) {\n\t\t\t\tawait safeRawWrite(adapter, u.key, parseInt(def.luxWriteId, 10), u.raw);\n\t\t\t}\n\t\t}\n\t}\n\n\tadapter.zipTimer = adapter.setTimeout(async () => {\n\t\tawait stopZipAndDeaeration(adapter);\n\t}, safeDurationSeconds * 1000);\n}\n\n/**\n * Abonniert die in der Konfiguration hinterlegten Bewegungsmelder (Foreign States).\n * Aufruf erfolgt einmalig in der onReady() des Adapters.\n *\n * @param adapter - Die erweiterte Adapter-Instanz\n */\nexport function subscribeMotionSensors(adapter: ExtendedAdapter): void {\n\tconst config = adapter.config;\n\tif (config.motion_sensors_aktiv && Array.isArray(config.motionSensors)) {\n\t\tfor (const sensor of config.motionSensors) {\n\t\t\tif (sensor.oid && typeof sensor.oid === 'string' && sensor.oid.trim() !== '') {\n\t\t\t\tadapter.subscribeForeignStates(sensor.oid.trim());\n\t\t\t\tif (adapter.isDebugLogActive) {\n\t\t\t\t\twriteLog(`Motion sensor subscribed: ${sensor.name} (${sensor.oid})`, 'info');\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n}\n\n/**\n * Pr\u00FCft bei einem StateChange, ob ein abonnierter Bewegungsmelder ausgel\u00F6st hat.\n * Wendet die Cooldown-Logik an und triggert bei Bedarf das ZIP-Makro.\n *\n * @param adapter - Die erweiterte Adapter-Instanz\n * @param id - Die ID des Datenpunkts, der sich ge\u00E4ndert hat\n * @param state - Der neue ioBroker-Zustand\n * @returns true, wenn das Event von einem Bewegungsmelder stammte (sodass onStateChange abbrechen kann)\n */\nexport async function checkAndHandleMotionSensor(\n\tadapter: ExtendedAdapter,\n\tid: string,\n\tstate: ioBroker.State,\n): Promise<boolean> {\n\tconst config = adapter.config;\n\n\tif (!config.motion_sensors_aktiv || !config.motionSensors || !Array.isArray(config.motionSensors)) {\n\t\treturn false;\n\t}\n\n\tconst matchedSensor = config.motionSensors.find((s: any) => s.oid && s.oid.trim() === id);\n\tif (!matchedSensor) {\n\t\treturn false;\n\t}\n\n\tif (state.val === true) {\n\t\tconst isAllowedBySchedule = await isZipAllowedBySchedule(adapter);\n\n\t\tif (!isAllowedBySchedule) {\n\t\t\tif (adapter.isDebugLogActive) {\n\t\t\t\twriteLog(\n\t\t\t\t\t`Motion registered at sensor '${matchedSensor.name || id}', but action ignored because it is outside the configured Luxtronik ZIP schedule.`,\n\t\t\t\t\t'debug',\n\t\t\t\t);\n\t\t\t}\n\t\t\treturn true;\n\t\t}\n\n\t\tconst activateZipState = await adapter.getStateAsync(getDpPath('Activate_Zip'));\n\t\tconst now = Date.now();\n\t\tconst lastZipChange = activateZipState?.lc || 0;\n\t\tconst isCurrentlyActive = activateZipState?.val === true;\n\n\t\tif (isCurrentlyActive || now - lastZipChange > (config.zip_last_run_min || 600) * 1000) {\n\t\t\tif (adapter.isDebugLogActive) {\n\t\t\t\twriteLog(\n\t\t\t\t\t`Motion registered at sensor '${matchedSensor.name || id}'. Launching or extending circulation pump ZIP macro sequence.`,\n\t\t\t\t\t'debug',\n\t\t\t\t);\n\t\t\t}\n\t\t\tawait adapter.setState(getDpPath('Activate_Zip'), { val: true, ack: false });\n\t\t} else {\n\t\t\tif (adapter.isDebugLogActive) {\n\t\t\t\twriteLog(\n\t\t\t\t\t`Motion registered at sensor '${matchedSensor.name || id}' but circulation pump execution suppressed due to anti-cycling protective interval timer.`,\n\t\t\t\t\t'debug',\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\t}\n\n\treturn true;\n}\n\n/**\n * Deaktiviert die regul\u00E4ren Hardware-Timer der Zirkulationspumpe beim Adapter-Start.\n * Schreibt die Hardware-schonenden Vorgabewerte (00:00, 60 Min Aus, 0 Min An) in die Luxtronik.\n * Dank 'safeRawWrite' passiert dies physisch nur, wenn die Werte abweichen.\n *\n * @param adapter - Die erweiterte Adapter-Instanz\n */\nexport async function disableHardwareZipTimer(adapter: ExtendedAdapter): Promise<void> {\n\tconst config = adapter.config;\n\n\tif (config.zip_hardware_timer_disable === true) {\n\t\tif (adapter.isDebugLogActive) {\n\t\t\twriteLog('Applying safe hardware defaults for ZIP timers...', 'info');\n\t\t}\n\n\t\ttry {\n\t\t\tawait safeRawWrite(adapter, 'hotWaterCircPumpTimerTableSelected', 506, 0);\n\t\t\tawait adapter.setOwnStateIfDifferent(getDpPath('hotWaterCircPumpTimerTableSelected'), 0, true);\n\n\t\t\tawait safeRawWrite(adapter, 'hotWaterCircPumpOnTime', 697, 0);\n\t\t\tawait adapter.setOwnStateIfDifferent(getDpPath('hotWaterCircPumpOnTime'), 0, true);\n\n\t\t\tawait safeRawWrite(adapter, 'hotWaterCircPumpOffTime', 698, 60);\n\t\t\tawait adapter.setOwnStateIfDifferent(getDpPath('hotWaterCircPumpOffTime'), 60, true);\n\n\t\t\tconst timeIds = [\n\t\t\t\t{ key: 'Zirkulation_MoSo_Start1', id: 507 },\n\t\t\t\t{ key: 'Zirkulation_MoSo_End1', id: 508 },\n\t\t\t\t{ key: 'Zirkulation_MoSo_Start2', id: 509 },\n\t\t\t\t{ key: 'Zirkulation_MoSo_End2', id: 510 },\n\t\t\t\t{ key: 'Zirkulation_MoSo_Start3', id: 511 },\n\t\t\t\t{ key: 'Zirkulation_MoSo_End3', id: 512 },\n\t\t\t\t{ key: 'Zirkulation_MoSo_Start4', id: 513 },\n\t\t\t\t{ key: 'Zirkulation_MoSo_End4', id: 514 },\n\t\t\t\t{ key: 'Zirkulation_MoSo_Start5', id: 515 },\n\t\t\t\t{ key: 'Zirkulation_MoSo_End5', id: 516 },\n\t\t\t];\n\n\t\t\tfor (const t of timeIds) {\n\t\t\t\tawait safeRawWrite(adapter, t.key, t.id, 0);\n\t\t\t\tawait adapter.setOwnStateIfDifferent(getDpPath(t.key), '00:00', true);\n\t\t\t}\n\t\t} catch (err: unknown) {\n\t\t\tconst msg = err instanceof Error ? err.message : String(err);\n\t\t\twriteLog(`Error applying safe ZIP defaults: ${msg}`, 'error');\n\t\t}\n\t}\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,qBAAoC;AACpC,oBAAyB;AACzB,0BAA2B;AAC3B,0BAAyC;AAKzC,MAAM,YAAY;AAAA,EACjB,cAAc;AAAA,EACd,SAAS;AAAA,EACT,YAAY;AAAA,EACZ,aAAa;AACd;AAiCA,eAAe,aACd,SACA,K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AI;AAAA,QACxC,EAAE,KAAK,2BAA2B,IAAI,IAAI;AAAA,QAC1C,EAAE,KAAK,yBAAyB,IAAI,IAAI;AAAA,QACxC,EAAE,KAAK,2BAA2B,IAAI,IAAI;AAAA,QAC1C,EAAE,KAAK,yBAAyB,IAAI,IAAI;AAAA,MACzC;AAEA,iBAAW,KAAK,SAAS;AACxB,cAAM,aAAa,SAAS,EAAE,KAAK,EAAE,IAAI,CAAC;AAC1C,cAAM,QAAQ,2BAAuB,+BAAU,EAAE,GAAG,GAAG,SAAS,IAAI;AAAA,MACrE;AAAA,IACD,SAAS,KAAc;AACtB,YAAM,MAAM,eAAe,QAAQ,IAAI,UAAU,OAAO,GAAG;AAC3D,kCAAS,qCAAqC,GAAG,IAAI,OAAO;AAAA,IAC7D;AAAA,EACD;AACD;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/io-package.json
CHANGED
|
@@ -1,8 +1,34 @@
|
|
|
1
1
|
{
|
|
2
2
|
"common": {
|
|
3
3
|
"name": "luxtronik2-controller",
|
|
4
|
-
"version": "0.6.
|
|
4
|
+
"version": "0.6.4",
|
|
5
5
|
"news": {
|
|
6
|
+
"0.6.4": {
|
|
7
|
+
"en": "Refactoring",
|
|
8
|
+
"de": "Refactoring",
|
|
9
|
+
"ru": "Рефакторинг",
|
|
10
|
+
"pt": "Refatorização",
|
|
11
|
+
"nl": "Refactoring",
|
|
12
|
+
"fr": "Refactoration",
|
|
13
|
+
"it": "Refactoring",
|
|
14
|
+
"es": "Refactoring",
|
|
15
|
+
"pl": "Refaktoring",
|
|
16
|
+
"uk": "Рефакторинг",
|
|
17
|
+
"zh-cn": "正在重构"
|
|
18
|
+
},
|
|
19
|
+
"0.6.3": {
|
|
20
|
+
"en": "Technical Changes (Under the Hood)\n\n- Separation of Concerns (zipManager):\n- Network Queue Isolation:\n- Comprehensive Code Refactoring (DRY):\n- Global Time Refactoring:\n- i18n Support for State Names:",
|
|
21
|
+
"de": "Technische Änderungen (Unter der Hood)\n\n- Trennung von Anliegen (zipManager):\nNetzwerk Queue Isolation:\nUmfassendes Code Refactoring (DRY):\nGlobal Time Refactoring:\n- i18n Unterstützung für staatliche Namen:",
|
|
22
|
+
"ru": "Технические изменения (под капотом)\n\nРазделение интересов (zipManager):\nИзоляция сетевых очередей:\nКомплексный рефакторинг кода (DRY):\nРефактор глобального времени:\ni18n Поддержка государственных имен:",
|
|
23
|
+
"pt": "Alterações técnicas (sob a capa)\n\n- Separação de preocupações (ZipManager):\n- Isolamento da Fila de Rede:\n- Refactoramento de código abrangente (DRY):\n- Refactoração do Tempo Global:\n- Suporte i18n para Nomes de Estado:",
|
|
24
|
+
"nl": "Technische wijzigingen (onder de kap)\n\n- Scheiding van zorgen (zipManager):\n- Netwerk wachtrij isolatie:\n- Comprehensive Code Refactoring (DRY):\n- Global Time Refactoring:\n- i18n Ondersteuning voor staatsnamen:",
|
|
25
|
+
"fr": "Changements techniques (sous le capot)\n\n- Séparation des préoccupations (zipManager):\n- Requête en réseau :\n- Refacturation complète du code (DRY) :\n- Refacturation de l'heure mondiale :\n- i18n Soutien aux noms d'État :",
|
|
26
|
+
"it": "Modifiche tecniche (Sotto il cappuccio)\n\n- Separazione delle preoccupazioni (zipManager):\n- Network Queue Isolation:\n- Refactoring completo del codice (DRY):\n- Global Time Refactoring:\n- i18n Supporto per i nomi di stato:",
|
|
27
|
+
"es": "Cambios técnicos (bajo el Hood)\n\n- Separación de preocupaciones (zipManager):\n- Isolación de cola de red:\n- Refactorización del Código Integral (DRY):\n- Refactorización del tiempo global:\n- i18n Apoyo a los Nombres del Estado:",
|
|
28
|
+
"pl": "Zmiany techniczne (pod kapturem)\n\n- Separacja koncernów (ZipManager):\n- Sieciowa izolacja kolejki:\n- Kompleksowa wymiana kodów (DRY):\n- Global Time Refactoring:\n- i18n Wsparcie dla nazw państwowych:",
|
|
29
|
+
"uk": "Технічні зміни\n\n- Сепарація концерну (zipManager):\n- Isolation мережі:\n- Комплексне рефакторування коду (DRY):\n- Рефакторинг глобального часу:\n- i18n Підтримка державних імен:",
|
|
30
|
+
"zh-cn": "技术变化(在兜帽之下)\n\n- 分离关注(zipManager):\n- 网络队列隔离:\n- 综合代码重构(德里):\n- 全球时间预测:\n- i18n 支持国名:"
|
|
31
|
+
},
|
|
6
32
|
"0.6.2": {
|
|
7
33
|
"en": "Added\n\n- Bilingual support (i18n): Full support for English and German (adapter settings, state names, dropdown menus, and dynamic status texts).\n- Language selection: Added a new dropdown menu in the adapter settings to freely choose the preferred output language for the ioBroker object tree.\n- Firmware 3.x compatibility: Implemented an intelligent fallback system that dynamically calculates the status texts (heatpump_state_string) and runtime (heatpump_duration) from the main operating state. This is required because modern Luxtronik controllers no longer transmit the old LCD text lines.\n\nFixed\n\n- Incorrect heating state (Frost protection): Fixed an issue where a switched-off heating system was incorrectly displayed as \"Frost protection\".\n The code now evaluates the correct index for the heating operating state (opStateHeating / 125) instead of incorrectly calculating it via the parameter.\n- Timer display: Restored the clean HH:MM:SS formatting in the ioBroker UI without the annoying \"s\" (seconds) by introducing an internal isDurationFormat flag.\n- Timer glitch fixed: When the compressor is idle, 00:00:01 (1 second) was often incorrectly displayed. This is now cleanly filtered to 00:00:00.\n- ioBroker Repo-Checker warnings: Added the missing write: true property to the timer table selection states (role: \"level\") to fix the E1011 error.\n\nTechnical\n\n- Fixed ESLint warnings (dot-notation) for object properties.",
|
|
8
34
|
"de": "Hinzugefügt\n\n- Zweisprachige Unterstützung (i18n): Vollständige Unterstützung für Englisch und Deutsch (Adaptereinstellungen, Statusbezeichnungen, Dropdown-Menüs und dynamische Statustexte).\n- Sprachauswahl: In den Adaptereinstellungen wurde ein neues Dropdown-Menü hinzugefügt, um die bevorzugte Ausgabesprache für den ioBroker-Objektbaum frei auszuwählen.\n- Firmware-3.x-Kompatibilität: Ein intelligentes Fallback-System wurde implementiert, das die Statusmeldungen (heatpump_state_string) und die Laufzeit (heatpump_duration) dynamisch aus dem Hauptbetriebszustand berechnet. Dies ist erforderlich, da moderne Luxtronik-Steuerungen die alten LCD-Textzeilen nicht mehr übertragen.\n\nBehoben\n\n- Falscher Heizzustand (Frostschutz): Es wurde ein Problem behoben, bei dem ein ausgeschaltetes Heizsystem fälschlicherweise als \"Frostschutz\" angezeigt wurde.\nDer Code wertet nun den korrekten Index für den Heizbetriebszustand (opStateHeating / 125) aus, anstatt ihn fälschlicherweise über den Parameter zu berechnen.\n- Timer-Anzeige: Die saubere HH:MM:SS-Formatierung in der ioBroker-Benutzeroberfläche ohne das störende \"s\" (Sekunden) wurde durch die Einführung eines internen isDurationFormat-Flags wiederhergestellt.\n- Timer-Fehler behoben: Im Leerlauf des Kompressors wurde häufig fälschlicherweise 00:00:01 (1 Sekunde) angezeigt. Dies wird nun korrekt auf 00:00:00 gefiltert.\n- ioBroker Repo-Checker Warnungen: Die fehlende Eigenschaft write: true wurde den Timer-Tabellenauswahlzuständen (Rolle: \"level\") hinzugefügt, um den Fehler E1011 zu beheben.\n\nTechnisch\n\n- Behobene ESLint-Warnungen (Punktnotation) für Objekteigenschaften.",
|
|
@@ -67,32 +93,6 @@
|
|
|
67
93
|
"pl": "Rozwiąż problemy zgłoszone przez moduł sprawdzający repozytorium",
|
|
68
94
|
"uk": "Вирішення проблем, про які повідомляє перевірник репозиторію",
|
|
69
95
|
"zh-cn": "解决存储库检查器报告的问题"
|
|
70
|
-
},
|
|
71
|
-
"0.5.1": {
|
|
72
|
-
"en": "Fix issue notify last error after instance restart",
|
|
73
|
-
"de": "Problem behoben: Benachrichtigung über letzten Fehler nach Neustart der Instanz.",
|
|
74
|
-
"ru": "Исправлена ошибка, из-за которой после перезапуска экземпляра отображалось уведомление о последней ошибке.",
|
|
75
|
-
"pt": "Corrigido o problema que impedia a notificação do último erro após a reinicialização da instância.",
|
|
76
|
-
"nl": "Probleem opgelost: melding van laatste foutmelding na herstart van instantie",
|
|
77
|
-
"fr": "Correction d'un problème de notification de la dernière erreur après le redémarrage de l'instance",
|
|
78
|
-
"it": "Risolvi il problema notificando l'ultimo errore dopo il riavvio dell'istanza",
|
|
79
|
-
"es": "Solucionar el problema de notificación del último error tras el reinicio de la instancia",
|
|
80
|
-
"pl": "Naprawiono problem z powiadomieniem o ostatnim błędzie po ponownym uruchomieniu instancji",
|
|
81
|
-
"uk": "Виправлено помилку, що повідомляє про останню помилку після перезапуску екземпляра",
|
|
82
|
-
"zh-cn": "修复实例重启后通知最后错误的问题"
|
|
83
|
-
},
|
|
84
|
-
"0.5.0": {
|
|
85
|
-
"en": "Code-Refactoring",
|
|
86
|
-
"de": "Code-Verbesserung",
|
|
87
|
-
"ru": "Рефакторинг кода",
|
|
88
|
-
"pt": "Refatoração de código",
|
|
89
|
-
"nl": "Code-refactoring",
|
|
90
|
-
"fr": "Refactorisation de code",
|
|
91
|
-
"it": "Refactoring del codice",
|
|
92
|
-
"es": "Refactorización de código",
|
|
93
|
-
"pl": "Refaktoryzacja kodu",
|
|
94
|
-
"uk": "Рефакторинг коду",
|
|
95
|
-
"zh-cn": "代码重构"
|
|
96
96
|
}
|
|
97
97
|
},
|
|
98
98
|
"titleLang": {
|