iobroker.luxtronik2-controller 1.0.4 → 1.1.1
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 +14 -8
- package/build/actionHandlers.js +13 -9
- package/build/actionHandlers.js.map +2 -2
- package/build/main.js +284 -135
- package/build/main.js.map +2 -2
- package/build/pvManager.js +41 -29
- package/build/pvManager.js.map +2 -2
- package/build/types.js.map +1 -1
- package/build/virtualStates.js +6 -6
- package/build/virtualStates.js.map +2 -2
- package/io-package.json +27 -27
- package/package.json +1 -1
package/build/main.js
CHANGED
|
@@ -62,8 +62,8 @@ class Luxtronik2Controller extends utils.Adapter {
|
|
|
62
62
|
updateRunning = false;
|
|
63
63
|
/** Timestamp tracking the last dynamic pump voltage optimization execution */
|
|
64
64
|
lastPumpOptimization = 0;
|
|
65
|
-
/** Merkt sich, ob Takt-Optimierung oder Zwangsheizen aktuell
|
|
66
|
-
|
|
65
|
+
/** Merkt sich, ob Takt-Optimierung oder Zwangsheizen aktuell einen temporären Heiz-Offset hält */
|
|
66
|
+
forcedHeatingBoostActive = false;
|
|
67
67
|
/** Internal array storing pending serial hardware write tasks */
|
|
68
68
|
writeQueue = [];
|
|
69
69
|
/** Lock flag indicating that the write queue is currently being processed */
|
|
@@ -83,6 +83,10 @@ class Luxtronik2Controller extends utils.Adapter {
|
|
|
83
83
|
zipEndTime;
|
|
84
84
|
/** Cron-Job Handle für die Firmware-Update-Prüfung */
|
|
85
85
|
updateCronJob;
|
|
86
|
+
/** Merker für Heizgrund */
|
|
87
|
+
forcedHeatingReason = "";
|
|
88
|
+
/** Merkt sich den ursprünglichen WW-Sollwert, falls forceSoll temporär erhöht hat */
|
|
89
|
+
forcedWwOriginalTarget = null;
|
|
86
90
|
/**
|
|
87
91
|
* Initializes a new instance of the Luxtronik2Controller class.
|
|
88
92
|
*
|
|
@@ -417,73 +421,6 @@ class Luxtronik2Controller extends utils.Adapter {
|
|
|
417
421
|
config.operation_mode !== "readonly" && config.modbus_active && this.modbusManager && this.modbusManager.isAvailable && this.modbusManager.protocolVersion === "shi" && config.sync_modbus_holding_23 === true
|
|
418
422
|
);
|
|
419
423
|
}
|
|
420
|
-
/**
|
|
421
|
-
* Aktiviert eine temporäre Heizungsanhebung (Takt-Optimierung, Vorheizen oder Zwangsheizen).
|
|
422
|
-
* Nutzt im V3.9x-SHI-Modus flüchtiges Modbus-RAM (+10.0 K über Holding 23 -> SHI 10002),
|
|
423
|
-
* sonst wie bisher den Heizkurven-Fußpunkt (35 °C).
|
|
424
|
-
*
|
|
425
|
-
* @param reason - Optionaler Kontext für das Debug-Log.
|
|
426
|
-
*/
|
|
427
|
-
async activateForcedHeatingBoost(reason = "CycleOpt") {
|
|
428
|
-
if (this.isShiModbusActive()) {
|
|
429
|
-
if (!this.forcedHeatingShiActive) {
|
|
430
|
-
await this.modbusManager.writeRegister(23, 100, false);
|
|
431
|
-
this.forcedHeatingShiActive = true;
|
|
432
|
-
const dpHeatingTemp = (0, import_stateMapping.getDpPath)("heating_temperature");
|
|
433
|
-
if (dpHeatingTemp) {
|
|
434
|
-
await this.setOwnStateIfDifferent(dpHeatingTemp, 10, true);
|
|
435
|
-
}
|
|
436
|
-
if (this.isDebugLogActive) {
|
|
437
|
-
(0, import_logger.writeLog)(
|
|
438
|
-
`[${reason}] SHI Modbus active: Setting volatile heating offset to +10.0 K (Holding 23 -> SHI 10002, 0 EEPROM writes).`,
|
|
439
|
-
"info"
|
|
440
|
-
);
|
|
441
|
-
}
|
|
442
|
-
}
|
|
443
|
-
return;
|
|
444
|
-
}
|
|
445
|
-
await this.syncConfigValue("heating_curve_parallel_offset", 35);
|
|
446
|
-
}
|
|
447
|
-
/**
|
|
448
|
-
* Setzt eine aktive temporäre Heizungsanhebung sauber zurück.
|
|
449
|
-
* Im SHI-Modus wird der flüchtige Offset auf den Basiswert zurückgesetzt und ein aktiver PV-Boost optional wiederhergestellt.
|
|
450
|
-
*
|
|
451
|
-
* @param reapplyPv - Stellt bei aktivem PV-Boost dessen Sollwert im Anschluss sofort wieder her.
|
|
452
|
-
*/
|
|
453
|
-
async resetForcedHeatingBoost(reapplyPv = true) {
|
|
454
|
-
var _a, _b;
|
|
455
|
-
const config = this.config;
|
|
456
|
-
if (this.isShiModbusActive()) {
|
|
457
|
-
const heatingTempState = await this.getStateAsync((0, import_stateMapping.getDpPath)("heating_temperature"));
|
|
458
|
-
const isShiOffsetStuckHigh = typeof (heatingTempState == null ? void 0 : heatingTempState.val) === "number" && heatingTempState.val >= 10;
|
|
459
|
-
if (!this.forcedHeatingShiActive && !isShiOffsetStuckHigh) {
|
|
460
|
-
return;
|
|
461
|
-
}
|
|
462
|
-
this.forcedHeatingShiActive = false;
|
|
463
|
-
const baseOffset = Number((_a = config.sync_heating_temperature) != null ? _a : 0);
|
|
464
|
-
await this.modbusManager.writeRegister(23, Math.round(baseOffset * 10), false);
|
|
465
|
-
const dpHeatingTemp = (0, import_stateMapping.getDpPath)("heating_temperature");
|
|
466
|
-
if (dpHeatingTemp) {
|
|
467
|
-
await this.setOwnStateIfDifferent(dpHeatingTemp, baseOffset, true);
|
|
468
|
-
}
|
|
469
|
-
if (this.isDebugLogActive) {
|
|
470
|
-
(0, import_logger.writeLog)(
|
|
471
|
-
`[CycleOpt] SHI Modbus active: Resetting volatile heating offset back to ${baseOffset} K (Holding 23 -> SHI 10002).`,
|
|
472
|
-
"info"
|
|
473
|
-
);
|
|
474
|
-
}
|
|
475
|
-
if (reapplyPv && import_pvManager.pvIsBoostActive) {
|
|
476
|
-
await (0, import_pvManager.evaluatePvBoost)(this, true);
|
|
477
|
-
}
|
|
478
|
-
return;
|
|
479
|
-
}
|
|
480
|
-
const fusspunktState = await this.getStateAsync((0, import_stateMapping.getDpPath)("heating_curve_parallel_offset"));
|
|
481
|
-
const currentFusspunkt = typeof (fusspunktState == null ? void 0 : fusspunktState.val) === "number" ? fusspunktState.val : this.currentRawParams[12] !== void 0 ? this.currentRawParams[12] / 10 : 0;
|
|
482
|
-
if (currentFusspunkt === 35) {
|
|
483
|
-
const fallbackFusspunkt = (_b = config.fusspunkt) != null ? _b : 21.7;
|
|
484
|
-
await this.syncConfigValue("heating_curve_parallel_offset", fallbackFusspunkt);
|
|
485
|
-
}
|
|
486
|
-
}
|
|
487
424
|
/**
|
|
488
425
|
* Configures fallback factory parameter baselines for the heat pump when in an idle state.
|
|
489
426
|
*
|
|
@@ -492,45 +429,235 @@ class Luxtronik2Controller extends utils.Adapter {
|
|
|
492
429
|
async setIdleDefaults() {
|
|
493
430
|
var _a, _b, _c, _d, _e, _f, _g, _h, _i;
|
|
494
431
|
try {
|
|
432
|
+
this.forcedWwOriginalTarget = null;
|
|
495
433
|
const config = this.config;
|
|
496
|
-
|
|
434
|
+
const isPvControlling = import_pvManager.pvIsBoostActive && !import_pvManager.pvWaitingForCycleEnd;
|
|
497
435
|
if (!this.isShiModbusActive()) {
|
|
498
436
|
await this.syncConfigValue("heating_curve_end_point", (_a = config.endpunkt) != null ? _a : 23);
|
|
499
437
|
await this.syncConfigValue("heating_curve_parallel_offset", (_b = config.fusspunkt) != null ? _b : 21.7);
|
|
500
438
|
}
|
|
501
|
-
await this.syncConfigValue("heating_temperature", (_c = config.sync_heating_temperature) != null ? _c : 0);
|
|
502
439
|
if (config.hup_optimierung_aktiv === true) {
|
|
503
440
|
await this.syncConfigValue(
|
|
504
441
|
"heating_system_circ_pump_voltage_minimal",
|
|
505
|
-
(
|
|
442
|
+
(_c = config.sync_heating_system_circ_pump_voltage_minimal_heating) != null ? _c : 3
|
|
506
443
|
);
|
|
507
444
|
await this.syncConfigValue(
|
|
508
445
|
"heating_system_circ_pump_voltage_nominal",
|
|
509
|
-
(
|
|
446
|
+
(_d = config.sync_heating_system_circ_pump_voltage_nominal_heating) != null ? _d : 7
|
|
510
447
|
);
|
|
511
448
|
}
|
|
512
|
-
await this.syncConfigValue("
|
|
513
|
-
await this.syncConfigValue("
|
|
514
|
-
await this.syncConfigValue("
|
|
515
|
-
|
|
516
|
-
|
|
449
|
+
await this.syncConfigValue("returnTemperatureHysteresis", (_e = config.sync_return_temperature_hysteresis) != null ? _e : 1.5);
|
|
450
|
+
await this.syncConfigValue("zip_aktiv", (_f = config.zip_aktiv) != null ? _f : 0);
|
|
451
|
+
await this.syncConfigValue("Heizen_nach_Wasser", (_g = config.Heating_after_warmwater) != null ? _g : false);
|
|
452
|
+
if (isPvControlling) {
|
|
453
|
+
this.forcedHeatingBoostActive = false;
|
|
454
|
+
this.forcedHeatingReason = "";
|
|
517
455
|
await (0, import_pvManager.evaluatePvBoost)(this, true);
|
|
456
|
+
} else {
|
|
457
|
+
const baseOffset = parseFloat(String((_h = config.sync_heating_temperature) != null ? _h : 0).replace(",", ".")) || 0;
|
|
458
|
+
const baseWw = parseFloat(String((_i = config.sync_warmwater_target_temperature) != null ? _i : 54).replace(",", ".")) || 54;
|
|
459
|
+
await this.resetForcedHeatingBoost(false);
|
|
460
|
+
await this.syncConfigValue("heating_temperature", baseOffset);
|
|
461
|
+
await this.syncConfigValue("temperature_hot_water_target", baseWw);
|
|
518
462
|
}
|
|
519
463
|
} catch (err) {
|
|
520
464
|
(0, import_logger.writeLog)(`Failed to apply the baseline idle configuration defaults: ${err.message}`, "error");
|
|
521
465
|
}
|
|
522
466
|
}
|
|
523
467
|
/**
|
|
524
|
-
*
|
|
468
|
+
* Prüft, ob die Heizung aktuell generell heizen darf (nicht Aus/Urlaub, nicht Heizgrenze/Frostschutz).
|
|
469
|
+
*
|
|
470
|
+
* @param rawValues - Aktuelle Rohwerte (CMD 3004).
|
|
471
|
+
* @param rawParams - Aktuelle Rohparameter (CMD 3003).
|
|
472
|
+
* @param isHeatingAllowedByLimit - Ergebnis der konfigurierten Heizgrenzen-Prüfung.
|
|
473
|
+
* @returns true, wenn Heizen erlaubt ist.
|
|
474
|
+
*/
|
|
475
|
+
isHeatingAllowed(rawValues, rawParams, isHeatingAllowedByLimit) {
|
|
476
|
+
if (!isHeatingAllowedByLimit) {
|
|
477
|
+
return false;
|
|
478
|
+
}
|
|
479
|
+
const heatingOpMode = rawParams[3];
|
|
480
|
+
if (heatingOpMode === 3 || heatingOpMode === 4) {
|
|
481
|
+
return false;
|
|
482
|
+
}
|
|
483
|
+
const opStateHeating = rawValues[125];
|
|
484
|
+
if (opStateHeating === 2 || opStateHeating === 3 || opStateHeating === 4) {
|
|
485
|
+
return false;
|
|
486
|
+
}
|
|
487
|
+
return true;
|
|
488
|
+
}
|
|
489
|
+
/**
|
|
490
|
+
* Prüft anhand der Luxtronik-WW-Zeitschaltuhr (P405..P505 = Sperrzeiten),
|
|
491
|
+
* ob Warmwasser zum angegebenen Zeitpunkt gesperrt ist (inkl. Mitternachts-Übergang).
|
|
525
492
|
*
|
|
526
|
-
* @
|
|
493
|
+
* @param rawParams - Aktuelle Rohparameter (CMD 3003).
|
|
494
|
+
* @param targetDate - Zu prüfender Zeitpunkt.
|
|
495
|
+
* @returns true, wenn zu diesem Zeitpunkt eine WW-Sperrzeit aktiv ist.
|
|
527
496
|
*/
|
|
528
|
-
|
|
497
|
+
isHotWaterLockedAt(rawParams, targetDate) {
|
|
498
|
+
var _a;
|
|
499
|
+
if (!rawParams || rawParams.length <= 505) {
|
|
500
|
+
return false;
|
|
501
|
+
}
|
|
502
|
+
const tableMode = (_a = rawParams[405]) != null ? _a : 0;
|
|
503
|
+
const dayOfWeek = targetDate.getDay();
|
|
504
|
+
const prevDayOfWeek = (dayOfWeek + 6) % 7;
|
|
505
|
+
const secOfDay = targetDate.getHours() * 3600 + targetDate.getMinutes() * 60 + targetDate.getSeconds();
|
|
506
|
+
const getBaseIndex = (day) => {
|
|
507
|
+
if (tableMode === 1) {
|
|
508
|
+
return day >= 1 && day <= 5 ? 416 : 426;
|
|
509
|
+
}
|
|
510
|
+
if (tableMode === 2) {
|
|
511
|
+
return 436 + day * 10;
|
|
512
|
+
}
|
|
513
|
+
return 406;
|
|
514
|
+
};
|
|
515
|
+
const todayBase = getBaseIndex(dayOfWeek);
|
|
516
|
+
for (let i = 0; i < 5; i++) {
|
|
517
|
+
const start = rawParams[todayBase + i * 2];
|
|
518
|
+
const end = rawParams[todayBase + i * 2 + 1];
|
|
519
|
+
if (start === void 0 || end === void 0 || start === end) {
|
|
520
|
+
continue;
|
|
521
|
+
}
|
|
522
|
+
if (start < end) {
|
|
523
|
+
if (secOfDay >= start && secOfDay < end) {
|
|
524
|
+
return true;
|
|
525
|
+
}
|
|
526
|
+
} else {
|
|
527
|
+
if (secOfDay >= start) {
|
|
528
|
+
return true;
|
|
529
|
+
}
|
|
530
|
+
}
|
|
531
|
+
}
|
|
532
|
+
const prevBase = getBaseIndex(prevDayOfWeek);
|
|
533
|
+
for (let i = 0; i < 5; i++) {
|
|
534
|
+
const start = rawParams[prevBase + i * 2];
|
|
535
|
+
const end = rawParams[prevBase + i * 2 + 1];
|
|
536
|
+
if (start === void 0 || end === void 0 || start <= end) {
|
|
537
|
+
continue;
|
|
538
|
+
}
|
|
539
|
+
if (secOfDay < end) {
|
|
540
|
+
return true;
|
|
541
|
+
}
|
|
542
|
+
}
|
|
543
|
+
return false;
|
|
544
|
+
}
|
|
545
|
+
/**
|
|
546
|
+
* Prüft, ob Warmwasser aktuell (leadMinutes = 0) oder in X Minuten freigegeben ist.
|
|
547
|
+
*
|
|
548
|
+
* @param rawValues - Aktuelle Rohwerte (CMD 3004).
|
|
549
|
+
* @param rawParams - Aktuelle Rohparameter (CMD 3003).
|
|
550
|
+
* @param leadMinutes - Vorschau in Minuten (0 = jetzt sofort, z.B. 25 = Vorheiz-Check).
|
|
551
|
+
* @returns true, wenn Warmwasser erlaubt ist.
|
|
552
|
+
*/
|
|
553
|
+
isHotWaterAllowed(rawValues, rawParams, leadMinutes = 0) {
|
|
554
|
+
const wwOpMode = rawParams[4];
|
|
555
|
+
if (wwOpMode === 3 || wwOpMode === 4) {
|
|
556
|
+
return false;
|
|
557
|
+
}
|
|
558
|
+
if (wwOpMode === 2) {
|
|
559
|
+
return true;
|
|
560
|
+
}
|
|
561
|
+
if (leadMinutes <= 0) {
|
|
562
|
+
const opStateWw = rawValues[124];
|
|
563
|
+
if (opStateWw !== void 0) {
|
|
564
|
+
return opStateWw !== 0 && opStateWw !== 3;
|
|
565
|
+
}
|
|
566
|
+
}
|
|
567
|
+
const targetDate = new Date(Date.now() + leadMinutes * 6e4);
|
|
568
|
+
return !this.isHotWaterLockedAt(rawParams, targetDate);
|
|
569
|
+
}
|
|
570
|
+
/**
|
|
571
|
+
* Aktiviert eine temporäre Heizungsanhebung (Takt-Optimierung, Vorheizen oder Zwangsheizen)
|
|
572
|
+
* über die Parallelverschiebung (`heating_temperature`) mit automatischem, relativem Offset.
|
|
573
|
+
*
|
|
574
|
+
* @param reason - Optionaler Kontext für das Debug-Log.
|
|
575
|
+
* @param deltaK - Relative Anhebung in Kelvin über dem Basis-Offset (z.B. Hysterese + 0.5 K).
|
|
576
|
+
*/
|
|
577
|
+
async activateForcedHeatingBoost(reason = "CycleOpt", deltaK = 2) {
|
|
578
|
+
var _a;
|
|
579
|
+
this.forcedHeatingReason = reason;
|
|
580
|
+
const config = this.config;
|
|
581
|
+
const baseOffset = parseFloat(String((_a = config.sync_heating_temperature) != null ? _a : 0).replace(",", ".")) || 0;
|
|
582
|
+
const maxAllowedOffset = this.isShiModbusActive() ? 10 : 5;
|
|
583
|
+
let targetOffset = Math.round((baseOffset + Math.max(0.5, deltaK)) * 10) / 10;
|
|
584
|
+
targetOffset = Math.min(targetOffset, maxAllowedOffset);
|
|
585
|
+
if (import_pvManager.pvIsBoostActive) {
|
|
586
|
+
const currentState = await this.getStateAsync((0, import_stateMapping.getDpPath)("heating_temperature"));
|
|
587
|
+
if (typeof (currentState == null ? void 0 : currentState.val) === "number" && currentState.val > targetOffset) {
|
|
588
|
+
targetOffset = currentState.val;
|
|
589
|
+
}
|
|
590
|
+
}
|
|
591
|
+
const currentHeatingState = await this.getStateAsync((0, import_stateMapping.getDpPath)("heating_temperature"));
|
|
592
|
+
if (this.forcedHeatingBoostActive && (currentHeatingState == null ? void 0 : currentHeatingState.val) === targetOffset) {
|
|
593
|
+
return;
|
|
594
|
+
}
|
|
595
|
+
this.forcedHeatingBoostActive = true;
|
|
596
|
+
await this.syncConfigValue("heating_temperature", targetOffset);
|
|
597
|
+
if (this.isDebugLogActive) {
|
|
598
|
+
(0, import_logger.writeLog)(
|
|
599
|
+
`[${reason}] Setting dynamic heating offset to +${targetOffset} K (base: ${baseOffset} K, delta: +${deltaK} K, SHI: ${this.isShiModbusActive()}).`,
|
|
600
|
+
"info"
|
|
601
|
+
);
|
|
602
|
+
}
|
|
603
|
+
}
|
|
604
|
+
/**
|
|
605
|
+
* Setzt eine aktive temporäre Heizungsanhebung sauber auf den Basis-Offset zurück
|
|
606
|
+
* und stellt einen eventuell aktiven PV-Boost wieder her.
|
|
607
|
+
*
|
|
608
|
+
* @param reapplyPv - Stellt bei aktivem PV-Boost dessen Sollwert im Anschluss sofort wieder her.
|
|
609
|
+
*/
|
|
610
|
+
async resetForcedHeatingBoost(reapplyPv = true) {
|
|
611
|
+
var _a;
|
|
612
|
+
if (!this.forcedHeatingBoostActive) {
|
|
613
|
+
return;
|
|
614
|
+
}
|
|
615
|
+
this.forcedHeatingBoostActive = false;
|
|
616
|
+
this.forcedHeatingReason = "";
|
|
617
|
+
if (reapplyPv && import_pvManager.pvIsBoostActive && !import_pvManager.pvWaitingForCycleEnd) {
|
|
618
|
+
await (0, import_pvManager.evaluatePvBoost)(this, true);
|
|
619
|
+
return;
|
|
620
|
+
}
|
|
621
|
+
const config = this.config;
|
|
622
|
+
const baseOffset = parseFloat(String((_a = config.sync_heating_temperature) != null ? _a : 0).replace(",", ".")) || 0;
|
|
623
|
+
await this.syncConfigValue("heating_temperature", baseOffset);
|
|
624
|
+
if (this.isDebugLogActive) {
|
|
625
|
+
(0, import_logger.writeLog)(`[CycleOpt] Resetting temporary heating offset back to ${baseOffset} K.`, "info");
|
|
626
|
+
}
|
|
627
|
+
}
|
|
628
|
+
/**
|
|
629
|
+
* Setzt eine temporäre WW-Anhebung (z.B. durch forceSoll) nach dem WW-Takt zurück,
|
|
630
|
+
* ohne einen aktiven PV-Boost unnötig umzuschalten.
|
|
631
|
+
*/
|
|
632
|
+
async restoreForcedWwTarget() {
|
|
633
|
+
var _a, _b;
|
|
634
|
+
const config = this.config;
|
|
635
|
+
const fallbackWw = parseFloat(String((_a = config.sync_warmwater_target_temperature) != null ? _a : 54).replace(",", ".")) || 54;
|
|
636
|
+
const targetWw = (_b = this.forcedWwOriginalTarget) != null ? _b : fallbackWw;
|
|
637
|
+
this.forcedWwOriginalTarget = null;
|
|
638
|
+
if (import_pvManager.pvIsBoostActive && !import_pvManager.pvWaitingForCycleEnd) {
|
|
639
|
+
await (0, import_pvManager.evaluatePvBoost)(this, true);
|
|
640
|
+
return;
|
|
641
|
+
}
|
|
642
|
+
await this.syncConfigValue("temperature_hot_water_target", targetWw);
|
|
643
|
+
}
|
|
644
|
+
/**
|
|
645
|
+
* Prüft, ob der aktuelle Betriebszustand (WP_BZ_akt) mindestens `minutes` Minuten anliegt.
|
|
646
|
+
*
|
|
647
|
+
* @param minutes - Mindestdauer in Minuten.
|
|
648
|
+
* @param rawValues - Optionale Rohwerte (CMD 3004) zur Auswertung der Verweildauer (Index 120).
|
|
649
|
+
* @returns true, wenn die letzte Änderung mindestens `minutes` Minuten zurückliegt.
|
|
650
|
+
*/
|
|
651
|
+
async istBetriebszustandAelterAls(minutes, rawValues = []) {
|
|
529
652
|
var _a;
|
|
530
653
|
try {
|
|
654
|
+
const controllerSec = rawValues[120];
|
|
655
|
+
if (typeof controllerSec === "number" && controllerSec > 0 && controllerSec / 60 >= minutes) {
|
|
656
|
+
return true;
|
|
657
|
+
}
|
|
531
658
|
const state = await this.getStateAsync((0, import_stateMapping.getDpPath)("WP_BZ_akt"));
|
|
532
659
|
const lastChange = (_a = state == null ? void 0 : state.lc) != null ? _a : 0;
|
|
533
|
-
return (Date.now() - lastChange) / 6e4 >=
|
|
660
|
+
return (Date.now() - lastChange) / 6e4 >= minutes;
|
|
534
661
|
} catch {
|
|
535
662
|
return false;
|
|
536
663
|
}
|
|
@@ -544,12 +671,13 @@ class Luxtronik2Controller extends utils.Adapter {
|
|
|
544
671
|
* @returns A promise that resolves when the execution cycle finishes.
|
|
545
672
|
*/
|
|
546
673
|
async runOptimizationSchedule(rawValues = [], rawParams = []) {
|
|
547
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
|
|
674
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l;
|
|
548
675
|
try {
|
|
549
676
|
const config = this.config;
|
|
550
677
|
if (config.operation_mode === "readonly") {
|
|
551
678
|
return;
|
|
552
679
|
}
|
|
680
|
+
const effectiveParams = rawParams.length > 0 ? rawParams : this.currentRawParams;
|
|
553
681
|
const bzState = await this.getStateAsync((0, import_stateMapping.getDpPath)("WP_BZ_akt"));
|
|
554
682
|
const bzVal = bzState && bzState.val !== null ? String(bzState.val).trim() : rawValues[80] !== void 0 ? String(rawValues[80]) : "";
|
|
555
683
|
const regelungAktivState = await this.getStateAsync((0, import_stateMapping.getDpPath)("Regelung_Aktiv"));
|
|
@@ -565,61 +693,64 @@ class Luxtronik2Controller extends utils.Adapter {
|
|
|
565
693
|
if (istLeerlauf) {
|
|
566
694
|
if (config.idle_defaults_aktiv === true) {
|
|
567
695
|
await this.setIdleDefaults();
|
|
568
|
-
} else
|
|
569
|
-
|
|
696
|
+
} else {
|
|
697
|
+
if (this.forcedHeatingBoostActive) {
|
|
698
|
+
await this.resetForcedHeatingBoost();
|
|
699
|
+
}
|
|
700
|
+
if (this.forcedWwOriginalTarget !== null) {
|
|
701
|
+
await this.restoreForcedWwTarget();
|
|
702
|
+
}
|
|
570
703
|
}
|
|
571
704
|
} else if (istHeizen) {
|
|
572
|
-
if (this.lastBzVal === "1" && config.idle_defaults_aktiv === true) {
|
|
573
|
-
await this.
|
|
574
|
-
"temperature_hot_water_target",
|
|
575
|
-
(_a = config.sync_warmwater_target_temperature) != null ? _a : 54
|
|
576
|
-
);
|
|
577
|
-
if (import_pvManager.pvIsBoostActive) {
|
|
578
|
-
await (0, import_pvManager.evaluatePvBoost)(this, true);
|
|
579
|
-
}
|
|
705
|
+
if (this.lastBzVal === "1" && (config.idle_defaults_aktiv === true || this.forcedWwOriginalTarget !== null)) {
|
|
706
|
+
await this.restoreForcedWwTarget();
|
|
580
707
|
}
|
|
581
708
|
if (config.zip_optimierung_aktiv === true) {
|
|
582
|
-
await this.syncConfigValue("zip_aktiv", (
|
|
709
|
+
await this.syncConfigValue("zip_aktiv", (_a = config.zip_aktiv) != null ? _a : 0);
|
|
583
710
|
}
|
|
584
711
|
if (config.hup_optimierung_aktiv === true) {
|
|
585
712
|
await this.syncConfigValue(
|
|
586
713
|
"heating_system_circ_pump_voltage_minimal",
|
|
587
|
-
(
|
|
714
|
+
(_b = config.sync_heating_system_circ_pump_voltage_minimal_heating) != null ? _b : 3
|
|
588
715
|
);
|
|
589
716
|
await this.syncConfigValue(
|
|
590
717
|
"heating_system_circ_pump_voltage_nominal",
|
|
591
|
-
(
|
|
718
|
+
(_c = config.sync_heating_system_circ_pump_voltage_nominal_heating) != null ? _c : 7
|
|
592
719
|
);
|
|
593
720
|
}
|
|
594
721
|
if (isRegelungAktiv) {
|
|
595
|
-
await this.syncConfigValue("Heizen_nach_Wasser", (
|
|
722
|
+
await this.syncConfigValue("Heizen_nach_Wasser", (_d = config.Heating_after_warmwater) != null ? _d : false);
|
|
596
723
|
}
|
|
597
724
|
} else if (istWarmwasser) {
|
|
725
|
+
const nachWasserTransition = await this.getStateAsync((0, import_stateMapping.getDpPath)("Heizen_nach_Wasser"));
|
|
726
|
+
if (!(nachWasserTransition == null ? void 0 : nachWasserTransition.val) && this.forcedHeatingBoostActive) {
|
|
727
|
+
await this.resetForcedHeatingBoost();
|
|
728
|
+
}
|
|
598
729
|
if (config.zip_optimierung_aktiv === true) {
|
|
599
730
|
const mode = config.zip_control_mode || "controller";
|
|
600
731
|
const actors = config.actors || [];
|
|
601
732
|
const validActors = actors.filter(
|
|
602
733
|
(a) => a.zip_external_relay_id && a.zip_external_relay_id.trim() !== ""
|
|
603
734
|
);
|
|
604
|
-
const canRunWearFree = mode === "actor" && validActors.length > 0 || mode === "modbus" && ((
|
|
735
|
+
const canRunWearFree = mode === "actor" && validActors.length > 0 || mode === "modbus" && ((_e = this.modbusManager) == null ? void 0 : _e.isAvailable);
|
|
605
736
|
if (canRunWearFree) {
|
|
606
737
|
if (this.isDebugLogActive) {
|
|
607
738
|
this.log.debug(
|
|
608
739
|
`[ZIP] Wear-free mode (${mode}) active. Starting circulation synchronous to hot water generation.`
|
|
609
740
|
);
|
|
610
741
|
}
|
|
611
|
-
await this.syncConfigValue("zip_aktiv", (
|
|
742
|
+
await this.syncConfigValue("zip_aktiv", (_f = config.zip_aktiv_ww) != null ? _f : 120);
|
|
612
743
|
await this.setOwnStateIfDifferent((0, import_stateMapping.getDpPath)("Activate_Zip"), true, false);
|
|
613
744
|
}
|
|
614
745
|
}
|
|
615
746
|
if (config.hup_optimierung_aktiv === true) {
|
|
616
747
|
await this.syncConfigValue(
|
|
617
748
|
"heating_system_circ_pump_voltage_minimal",
|
|
618
|
-
(
|
|
749
|
+
(_g = config.sync_heating_system_circ_pump_voltage_minimal_water) != null ? _g : 3
|
|
619
750
|
);
|
|
620
751
|
await this.syncConfigValue(
|
|
621
752
|
"heating_system_circ_pump_voltage_nominal",
|
|
622
|
-
(
|
|
753
|
+
(_h = config.sync_heating_system_circ_pump_voltage_nominal_water) != null ? _h : 10
|
|
623
754
|
);
|
|
624
755
|
}
|
|
625
756
|
}
|
|
@@ -640,7 +771,8 @@ class Luxtronik2Controller extends utils.Adapter {
|
|
|
640
771
|
mitteltempState,
|
|
641
772
|
thresholdHeatingLimitState,
|
|
642
773
|
heatingLimitState,
|
|
643
|
-
aelterAls10
|
|
774
|
+
aelterAls10,
|
|
775
|
+
aelterAls3
|
|
644
776
|
] = await Promise.all([
|
|
645
777
|
this.getStateAsync((0, import_stateMapping.getDpPath)("Wamwassertemperatur_Soll")),
|
|
646
778
|
this.getStateAsync((0, import_stateMapping.getDpPath)("temperature_hot_water_target")),
|
|
@@ -656,26 +788,30 @@ class Luxtronik2Controller extends utils.Adapter {
|
|
|
656
788
|
this.getStateAsync((0, import_stateMapping.getDpPath)("Mitteltemperatur")),
|
|
657
789
|
this.getStateAsync((0, import_stateMapping.getDpPath)("thresholdHeatingLimit")),
|
|
658
790
|
this.getStateAsync((0, import_stateMapping.getDpPath)("heatingLimit")),
|
|
659
|
-
this.
|
|
791
|
+
this.istBetriebszustandAelterAls(10, rawValues),
|
|
792
|
+
this.istBetriebszustandAelterAls(3, rawValues)
|
|
660
793
|
]);
|
|
661
|
-
const wwSoll = typeof (wwSollState == null ? void 0 : wwSollState.val) === "number" ? wwSollState.val : typeof (wwTargetParamState == null ? void 0 : wwTargetParamState.val) === "number" ? wwTargetParamState.val : rawValues[18] !== void 0 ? rawValues[18] / 10 :
|
|
794
|
+
const wwSoll = typeof (wwSollState == null ? void 0 : wwSollState.val) === "number" ? wwSollState.val : typeof (wwTargetParamState == null ? void 0 : wwTargetParamState.val) === "number" ? wwTargetParamState.val : rawValues[18] !== void 0 ? rawValues[18] / 10 : effectiveParams[105] !== void 0 ? effectiveParams[105] / 10 : 54;
|
|
662
795
|
const wwIst = typeof (wwIstState == null ? void 0 : wwIstState.val) === "number" ? wwIstState.val : rawValues[17] !== void 0 ? rawValues[17] / 10 : 0;
|
|
663
796
|
const ruecklauf = typeof (ruecklaufState == null ? void 0 : ruecklaufState.val) === "number" ? ruecklaufState.val : rawValues[11] !== void 0 ? rawValues[11] / 10 : 0;
|
|
664
797
|
const ruecklaufSoll = typeof (ruecklaufSollState == null ? void 0 : ruecklaufSollState.val) === "number" ? ruecklaufSollState.val : rawValues[12] !== void 0 ? rawValues[12] / 10 : 0;
|
|
665
798
|
const spreizung = typeof (spreizungState == null ? void 0 : spreizungState.val) === "number" ? spreizungState.val : rawValues[10] !== void 0 && rawValues[11] !== void 0 ? (rawValues[10] - rawValues[11]) / 10 : 0;
|
|
666
799
|
const vd1 = (vd1State == null ? void 0 : vd1State.val) !== void 0 && (vd1State == null ? void 0 : vd1State.val) !== null ? vd1State.val === 1 || vd1State.val === true || String(vd1State.val).toLowerCase() === "true" : rawValues[44] === 1;
|
|
667
|
-
const wwHysterese = typeof (wwHystereseState == null ? void 0 : wwHystereseState.val) === "number" ? wwHystereseState.val :
|
|
668
|
-
const currentHupVolt = (
|
|
669
|
-
const heizenHysterese = typeof (heizenHystereseState == null ? void 0 : heizenHystereseState.val) === "number" ? heizenHystereseState.val :
|
|
800
|
+
const wwHysterese = typeof (wwHystereseState == null ? void 0 : wwHystereseState.val) === "number" ? wwHystereseState.val : effectiveParams[74] !== void 0 ? effectiveParams[74] / 10 : 2;
|
|
801
|
+
const currentHupVolt = (_i = currentHupVoltState == null ? void 0 : currentHupVoltState.val) != null ? _i : 7;
|
|
802
|
+
const heizenHysterese = typeof (heizenHystereseState == null ? void 0 : heizenHystereseState.val) === "number" ? heizenHystereseState.val : effectiveParams[88] !== void 0 ? effectiveParams[88] / 10 : 1.5;
|
|
670
803
|
const mitteltemperatur = typeof (mitteltempState == null ? void 0 : mitteltempState.val) === "number" ? mitteltempState.val : rawValues[16] !== void 0 ? rawValues[16] / 10 : 0;
|
|
671
|
-
const thresholdHeatingLimit = typeof (thresholdHeatingLimitState == null ? void 0 : thresholdHeatingLimitState.val) === "number" ? thresholdHeatingLimitState.val :
|
|
672
|
-
const isHeatingLimitEnabled = (heatingLimitState == null ? void 0 : heatingLimitState.val) !== void 0 && (heatingLimitState == null ? void 0 : heatingLimitState.val) !== null ? heatingLimitState.val === 1 || heatingLimitState.val === true || String(heatingLimitState.val) === "1" || String(heatingLimitState.val).toLowerCase() === "true" :
|
|
804
|
+
const thresholdHeatingLimit = typeof (thresholdHeatingLimitState == null ? void 0 : thresholdHeatingLimitState.val) === "number" ? thresholdHeatingLimitState.val : effectiveParams[700] !== void 0 ? effectiveParams[700] / 10 : 15;
|
|
805
|
+
const isHeatingLimitEnabled = (heatingLimitState == null ? void 0 : heatingLimitState.val) !== void 0 && (heatingLimitState == null ? void 0 : heatingLimitState.val) !== null ? heatingLimitState.val === 1 || heatingLimitState.val === true || String(heatingLimitState.val) === "1" || String(heatingLimitState.val).toLowerCase() === "true" : effectiveParams[699] === 1;
|
|
673
806
|
const nachWasser = Boolean(nachWasserState == null ? void 0 : nachWasserState.val);
|
|
807
|
+
const isHeatingAllowedByLimit = !isHeatingLimitEnabled || mitteltemperatur < thresholdHeatingLimit;
|
|
808
|
+
const heatingAllowed = this.isHeatingAllowed(rawValues, effectiveParams, isHeatingAllowedByLimit);
|
|
809
|
+
const wwAllowedNow = this.isHotWaterAllowed(rawValues, effectiveParams, 0);
|
|
810
|
+
const wwAllowedSoon = this.isHotWaterAllowed(rawValues, effectiveParams, 25);
|
|
811
|
+
const dynamicDeltaK = Math.round((heizenHysterese + 0.5) * 10) / 10;
|
|
674
812
|
if (istHeizen) {
|
|
675
813
|
if (aelterAls10 && vd1) {
|
|
676
814
|
await this.resetForcedHeatingBoost();
|
|
677
|
-
}
|
|
678
|
-
if (aelterAls10 && vd1) {
|
|
679
815
|
this.lastPumpOptimization = await (0, import_hupManager.handleHupOptimization)(
|
|
680
816
|
this,
|
|
681
817
|
istHeizen,
|
|
@@ -685,33 +821,44 @@ class Luxtronik2Controller extends utils.Adapter {
|
|
|
685
821
|
);
|
|
686
822
|
}
|
|
687
823
|
if (isRegelungAktiv) {
|
|
688
|
-
|
|
689
|
-
|
|
824
|
+
const rlZielErreicht = ruecklauf >= ruecklaufSoll + heizenHysterese - 0.1;
|
|
825
|
+
if (rlZielErreicht) {
|
|
826
|
+
if (aelterAls3) {
|
|
690
827
|
await this.syncConfigValue("Heizen_nach_Wasser", false);
|
|
691
828
|
}
|
|
829
|
+
if (aelterAls3 && wwAllowedNow && wwSoll - wwIst > 2) {
|
|
830
|
+
if (this.forcedWwOriginalTarget === null) {
|
|
831
|
+
const fallbackWw = parseFloat(
|
|
832
|
+
String((_j = config.sync_warmwater_target_temperature) != null ? _j : 54).replace(",", ".")
|
|
833
|
+
) || 54;
|
|
834
|
+
this.forcedWwOriginalTarget = config.idle_defaults_aktiv === true ? fallbackWw : wwSoll;
|
|
835
|
+
}
|
|
836
|
+
let forceSoll = wwIst + wwHysterese + 1.5;
|
|
837
|
+
if (import_pvManager.pvIsBoostActive) {
|
|
838
|
+
const baseWw = parseFloat(
|
|
839
|
+
String((_k = config.sync_warmwater_target_temperature) != null ? _k : 54).replace(",", ".")
|
|
840
|
+
) || 54;
|
|
841
|
+
const boostWw = parseFloat(String((_l = config.pv_boost_ww) != null ? _l : 0).replace(",", ".")) || 0;
|
|
842
|
+
const pvTarget = baseWw + boostWw;
|
|
843
|
+
forceSoll = Math.max(forceSoll, pvTarget);
|
|
844
|
+
}
|
|
845
|
+
if (forceSoll > 70) {
|
|
846
|
+
forceSoll = 70;
|
|
847
|
+
}
|
|
848
|
+
forceSoll = Math.round(forceSoll * 10) / 10;
|
|
849
|
+
await this.syncConfigValue("temperature_hot_water_target", forceSoll);
|
|
850
|
+
}
|
|
692
851
|
} else if (!nachWasser && config.Heating_after_warmwater === true) {
|
|
693
852
|
await this.syncConfigValue("Heizen_nach_Wasser", true);
|
|
694
853
|
}
|
|
695
|
-
if (wwSoll - wwIst > 2 && ruecklauf >= ruecklaufSoll + heizenHysterese - 0.1) {
|
|
696
|
-
let forceSoll = wwIst + wwHysterese + 1.5;
|
|
697
|
-
if (import_pvManager.pvIsBoostActive) {
|
|
698
|
-
const baseWw = parseFloat(String(config.sync_warmwater_target_temperature).replace(",", ".")) || 54;
|
|
699
|
-
const boostWw = parseFloat(String(config.pv_boost_ww).replace(",", ".")) || 0;
|
|
700
|
-
const pvTarget = baseWw + boostWw;
|
|
701
|
-
forceSoll = Math.max(forceSoll, pvTarget);
|
|
702
|
-
}
|
|
703
|
-
if (forceSoll > 70) {
|
|
704
|
-
forceSoll = 70;
|
|
705
|
-
}
|
|
706
|
-
forceSoll = Math.round(forceSoll * 10) / 10;
|
|
707
|
-
await this.syncConfigValue("temperature_hot_water_target", forceSoll);
|
|
708
|
-
}
|
|
709
854
|
}
|
|
710
855
|
}
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
856
|
+
if (istWarmwasser) {
|
|
857
|
+
if (vd1 && this.forcedWwOriginalTarget !== null) {
|
|
858
|
+
await this.restoreForcedWwTarget();
|
|
859
|
+
}
|
|
860
|
+
if (nachWasser && isRegelungAktiv && heatingAllowed) {
|
|
861
|
+
await this.activateForcedHeatingBoost("CycleOpt-AfterWW", dynamicDeltaK);
|
|
715
862
|
}
|
|
716
863
|
}
|
|
717
864
|
if (istLeerlauf) {
|
|
@@ -721,14 +868,16 @@ class Luxtronik2Controller extends utils.Adapter {
|
|
|
721
868
|
}
|
|
722
869
|
}
|
|
723
870
|
if (isRegelungAktiv) {
|
|
724
|
-
if (wwSoll - wwIst >= wwHysterese - 1.5 && ruecklauf <= ruecklaufSoll
|
|
871
|
+
if (wwAllowedSoon && heatingAllowed && wwSoll - wwIst >= wwHysterese - 1.5 && ruecklauf <= ruecklaufSoll) {
|
|
725
872
|
if (this.isDebugLogActive) {
|
|
726
873
|
(0, import_logger.writeLog)(
|
|
727
|
-
`[CycleOpt] Pre-starting heating before WW (WW: ${wwIst}/${wwSoll}\xB0C, Hyst: ${wwHysterese}K, RL: ${ruecklauf}/${ruecklaufSoll}\xB0C).`,
|
|
874
|
+
`[CycleOpt] Pre-starting heating before WW (WW: ${wwIst}/${wwSoll}\xB0C, Hyst: ${wwHysterese}K, RL: ${ruecklauf}/${ruecklaufSoll}\xB0C, Offset: +${dynamicDeltaK}K).`,
|
|
728
875
|
"info"
|
|
729
876
|
);
|
|
730
877
|
}
|
|
731
|
-
await this.activateForcedHeatingBoost("CycleOpt-PreHeat");
|
|
878
|
+
await this.activateForcedHeatingBoost("CycleOpt-PreHeat", dynamicDeltaK);
|
|
879
|
+
} else if (this.forcedHeatingBoostActive && this.forcedHeatingReason === "CycleOpt-PreHeat") {
|
|
880
|
+
await this.resetForcedHeatingBoost();
|
|
732
881
|
}
|
|
733
882
|
}
|
|
734
883
|
}
|
|
@@ -913,7 +1062,7 @@ class Luxtronik2Controller extends utils.Adapter {
|
|
|
913
1062
|
}
|
|
914
1063
|
await Promise.all(statePromises);
|
|
915
1064
|
await (0, import_virtualStates.calculateTotalThermalEnergy)(this, rawValues);
|
|
916
|
-
await (0, import_virtualStates.calculateTotalEnergy)(this,
|
|
1065
|
+
await (0, import_virtualStates.calculateTotalEnergy)(this, rawParams);
|
|
917
1066
|
const fehlerDp = (0, import_stateMapping.getDpPath)("Fehlerspeicher");
|
|
918
1067
|
const oldFehlerState = fehlerDp ? await this.getStateAsync(fehlerDp) : null;
|
|
919
1068
|
const oldFehlerVal = oldFehlerState == null ? void 0 : oldFehlerState.val;
|