iobroker.poolcontrol 1.2.0 → 1.2.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +285 -292
- package/admin/i18n/de/translations.json +158 -4
- package/admin/i18n/en/translations.json +161 -3
- package/admin/i18n/es/translations.json +158 -4
- package/admin/i18n/fr/translations.json +158 -4
- package/admin/i18n/it/translations.json +158 -4
- package/admin/i18n/nl/translations.json +158 -4
- package/admin/i18n/pl/translations.json +158 -4
- package/admin/i18n/pt/translations.json +158 -4
- package/admin/i18n/ru/translations.json +158 -4
- package/admin/i18n/uk/translations.json +158 -4
- package/admin/i18n/zh-cn/translations.json +158 -4
- package/admin/jsonConfig.json +180 -602
- package/io-package.json +121 -101
- package/lib/helpers/actuatorsHelper.js +6 -8
- package/lib/helpers/aiChemistryHelpHelper.js +7 -7
- package/lib/helpers/aiForecastHelper.js +21 -21
- package/lib/helpers/aiHelper.js +53 -63
- package/lib/helpers/consumptionHelper.js +23 -25
- package/lib/helpers/controlHelper.js +24 -24
- package/lib/helpers/controlHelper2.js +17 -17
- package/lib/helpers/debugLogHelper.js +12 -14
- package/lib/helpers/frostHelper.js +6 -6
- package/lib/helpers/heatHelper.js +14 -14
- package/lib/helpers/infoHelper.js +2 -2
- package/lib/helpers/migrationHelper.js +16 -16
- package/lib/helpers/photovoltaicHelper.js +28 -28
- package/lib/helpers/pumpHelper.js +16 -18
- package/lib/helpers/pumpHelper2.js +8 -10
- package/lib/helpers/pumpHelper3.js +9 -9
- package/lib/helpers/pumpHelper4.js +9 -9
- package/lib/helpers/pumpSpeedHelper.js +6 -6
- package/lib/helpers/runtimeHelper.js +14 -14
- package/lib/helpers/solarHelper.js +9 -9
- package/lib/helpers/speechHelper.js +13 -15
- package/lib/helpers/speechTextHelper.js +13 -13
- package/lib/helpers/statisticsHelper.js +9 -9
- package/lib/helpers/statisticsHelperMonth.js +15 -15
- package/lib/helpers/statisticsHelperWeek.js +11 -11
- package/lib/helpers/statusHelper.js +9 -9
- package/lib/helpers/temperatureHelper.js +9 -11
- package/lib/helpers/timeHelper.js +7 -9
- package/lib/stateDefinitions/actuatorsStates.js +19 -19
- package/lib/stateDefinitions/aiChemistryHelpStates.js +59 -28
- package/lib/stateDefinitions/aiStates.js +119 -31
- package/lib/stateDefinitions/consumptionStates.js +20 -14
- package/lib/stateDefinitions/controlStates.js +90 -37
- package/lib/stateDefinitions/debugLogStates.js +28 -13
- package/lib/stateDefinitions/generalStates.js +4 -4
- package/lib/stateDefinitions/heatStates.js +21 -21
- package/lib/stateDefinitions/infoStates.js +11 -5
- package/lib/stateDefinitions/photovoltaicStates.js +52 -24
- package/lib/stateDefinitions/pumpSpeedStates.js +11 -11
- package/lib/stateDefinitions/pumpStates.js +24 -15
- package/lib/stateDefinitions/pumpStates2.js +22 -10
- package/lib/stateDefinitions/pumpStates3.js +63 -24
- package/lib/stateDefinitions/pumpStates4.js +62 -32
- package/lib/stateDefinitions/runtimeStates.js +10 -10
- package/lib/stateDefinitions/solarStates.js +9 -9
- package/lib/stateDefinitions/speechStates.js +24 -21
- package/lib/stateDefinitions/statisticsStates.js +107 -29
- package/lib/stateDefinitions/statusStates.js +14 -12
- package/lib/stateDefinitions/temperatureStates.js +18 -12
- package/lib/stateDefinitions/timeStates.js +5 -5
- package/main.js +38 -0
- package/package.json +7 -8
|
@@ -54,11 +54,11 @@ const heatHelper = {
|
|
|
54
54
|
|
|
55
55
|
// ggf. vorhandene Foreign-ID abonnieren
|
|
56
56
|
this._refreshForeignSubscription().catch(err =>
|
|
57
|
-
this.adapter.log.warn(`[heatHelper] Foreign
|
|
57
|
+
this.adapter.log.warn(`[heatHelper] Foreign subscription error: ${err.message}`),
|
|
58
58
|
);
|
|
59
59
|
|
|
60
60
|
this._safeEvaluate('init');
|
|
61
|
-
this.adapter.log.info('[heatHelper]
|
|
61
|
+
this.adapter.log.info('[heatHelper] Initialization completed.');
|
|
62
62
|
},
|
|
63
63
|
|
|
64
64
|
async handleStateChange(id, state) {
|
|
@@ -101,7 +101,7 @@ const heatHelper = {
|
|
|
101
101
|
return;
|
|
102
102
|
}
|
|
103
103
|
} catch (err) {
|
|
104
|
-
this.adapter.log.warn(`[heatHelper]
|
|
104
|
+
this.adapter.log.warn(`[heatHelper] Error in handleStateChange: ${err.message}`);
|
|
105
105
|
}
|
|
106
106
|
},
|
|
107
107
|
|
|
@@ -235,7 +235,7 @@ const heatHelper = {
|
|
|
235
235
|
// - Pumpe aktuell AUS
|
|
236
236
|
// - kein Prerun aktiv
|
|
237
237
|
if (prerunMin > 0 && !pumpIsOn && !this._prerunTimer) {
|
|
238
|
-
this.adapter.log.info(`[heatHelper]
|
|
238
|
+
this.adapter.log.info(`[heatHelper] Starting pump pre-run (${prerunMin} min)`);
|
|
239
239
|
|
|
240
240
|
// Pumpe einschalten + Ownership übernehmen
|
|
241
241
|
this._ownsPump = true;
|
|
@@ -317,7 +317,7 @@ const heatHelper = {
|
|
|
317
317
|
// Pumpen-Nachlauf nur, wenn wir die Pumpe eingeschaltet hatten
|
|
318
318
|
await this._startAfterrunIfNeeded(afterrunMin, reason);
|
|
319
319
|
|
|
320
|
-
this.adapter.log.info(`[heatHelper]
|
|
320
|
+
this.adapter.log.info(`[heatHelper] Heating OFF (${reason})`);
|
|
321
321
|
},
|
|
322
322
|
|
|
323
323
|
async _applyBlockedState(mode, reason, afterrunMin) {
|
|
@@ -382,7 +382,7 @@ const heatHelper = {
|
|
|
382
382
|
await this.adapter.setStateAsync('heat.afterrun_active', { val: false, ack: true });
|
|
383
383
|
}
|
|
384
384
|
} catch (err) {
|
|
385
|
-
this.adapter.log.warn(`[heatHelper]
|
|
385
|
+
this.adapter.log.warn(`[heatHelper] Could not turn on pump: ${err.message}`);
|
|
386
386
|
}
|
|
387
387
|
},
|
|
388
388
|
|
|
@@ -408,12 +408,12 @@ const heatHelper = {
|
|
|
408
408
|
await this.adapter.setStateAsync('heat.afterrun_active', { val: true, ack: true });
|
|
409
409
|
|
|
410
410
|
const holdMs = Math.round(afterrunMin * 60 * 1000);
|
|
411
|
-
this.adapter.log.debug(`[heatHelper]
|
|
411
|
+
this.adapter.log.debug(`[heatHelper] Pump after-run started: ${afterrunMin} min (${reason})`);
|
|
412
412
|
|
|
413
413
|
this._afterrunTimer = setTimeout(async () => {
|
|
414
414
|
// Wenn inzwischen wieder Heizbedarf aktiv ist -> Nachlauf abbrechen
|
|
415
415
|
if (this._desiredHeat === true) {
|
|
416
|
-
this.adapter.log.debug('[heatHelper]
|
|
416
|
+
this.adapter.log.debug('[heatHelper] After-run cancelled - heating is active again.');
|
|
417
417
|
return;
|
|
418
418
|
}
|
|
419
419
|
await this._stopPumpNow('afterrun_done');
|
|
@@ -424,12 +424,12 @@ const heatHelper = {
|
|
|
424
424
|
try {
|
|
425
425
|
await this.adapter.setStateAsync('pump.pump_switch', { val: false, ack: false });
|
|
426
426
|
} catch (err) {
|
|
427
|
-
this.adapter.log.warn(`[heatHelper]
|
|
427
|
+
this.adapter.log.warn(`[heatHelper] Could not turn off pump: ${err.message}`);
|
|
428
428
|
} finally {
|
|
429
429
|
this._ownsPump = false;
|
|
430
430
|
await this.adapter.setStateAsync('heat.afterrun_active', { val: false, ack: true });
|
|
431
431
|
await this.adapter.setStateAsync('heat.prerun_active', { val: false, ack: true });
|
|
432
|
-
this.adapter.log.info(`[heatHelper]
|
|
432
|
+
this.adapter.log.info(`[heatHelper] Pump OFF (${tag})`);
|
|
433
433
|
}
|
|
434
434
|
},
|
|
435
435
|
|
|
@@ -446,7 +446,7 @@ const heatHelper = {
|
|
|
446
446
|
try {
|
|
447
447
|
await this.adapter.setForeignStateAsync(id, { val: !!on, ack: false });
|
|
448
448
|
} catch (err) {
|
|
449
|
-
this.adapter.log.warn(`[heatHelper]
|
|
449
|
+
this.adapter.log.warn(`[heatHelper] Could not set heating device (${id}): ${err.message}`);
|
|
450
450
|
}
|
|
451
451
|
},
|
|
452
452
|
|
|
@@ -460,7 +460,7 @@ const heatHelper = {
|
|
|
460
460
|
await this.adapter.setStateAsync('heat.heating_request', { val: !!heatingRequest, ack: true });
|
|
461
461
|
await this.adapter.setStateAsync('heat.last_change', { val: Date.now(), ack: true });
|
|
462
462
|
} catch (err) {
|
|
463
|
-
this.adapter.log.warn(`[heatHelper]
|
|
463
|
+
this.adapter.log.warn(`[heatHelper] Error while writing heat states: ${err.message}`);
|
|
464
464
|
}
|
|
465
465
|
},
|
|
466
466
|
|
|
@@ -477,7 +477,7 @@ const heatHelper = {
|
|
|
477
477
|
this.adapter.subscribeForeignStates(nextId);
|
|
478
478
|
this.adapter.log.info(`[heatHelper] Subscribed Foreign-Heat-Control: "${nextId}"`);
|
|
479
479
|
} catch (err) {
|
|
480
|
-
this.adapter.log.warn(`[heatHelper]
|
|
480
|
+
this.adapter.log.warn(`[heatHelper] Could not subscribe to foreign state (${nextId}): ${err.message}`);
|
|
481
481
|
}
|
|
482
482
|
this._heatControlForeignId = nextId;
|
|
483
483
|
}
|
|
@@ -491,7 +491,7 @@ const heatHelper = {
|
|
|
491
491
|
try {
|
|
492
492
|
await this._evaluate(tag);
|
|
493
493
|
} catch (err) {
|
|
494
|
-
this.adapter.log.warn(`[heatHelper] Evaluate
|
|
494
|
+
this.adapter.log.warn(`[heatHelper] Evaluate error (${tag}): ${err.message}`);
|
|
495
495
|
}
|
|
496
496
|
},
|
|
497
497
|
|
|
@@ -20,7 +20,7 @@ const infoHelper = {
|
|
|
20
20
|
*/
|
|
21
21
|
init(adapter) {
|
|
22
22
|
this.adapter = adapter;
|
|
23
|
-
this.adapter.log.debug('[infoHelper]
|
|
23
|
+
this.adapter.log.debug('[infoHelper] Initialized');
|
|
24
24
|
|
|
25
25
|
// Adapterversion setzen
|
|
26
26
|
this._updateAdapterVersion();
|
|
@@ -42,7 +42,7 @@ const infoHelper = {
|
|
|
42
42
|
|
|
43
43
|
this.adapter.setState('info.adapter_version', version, true);
|
|
44
44
|
} catch (err) {
|
|
45
|
-
this.adapter.log.error(`[infoHelper]
|
|
45
|
+
this.adapter.log.error(`[infoHelper] Error while reading adapter version: ${err}`);
|
|
46
46
|
}
|
|
47
47
|
},
|
|
48
48
|
|
|
@@ -23,7 +23,7 @@ const migrationHelper = {
|
|
|
23
23
|
*/
|
|
24
24
|
async init(adapter) {
|
|
25
25
|
this.adapter = adapter;
|
|
26
|
-
this.adapter.log.info('[migrationHelper]
|
|
26
|
+
this.adapter.log.info('[migrationHelper] Starting migration check ...');
|
|
27
27
|
|
|
28
28
|
try {
|
|
29
29
|
// ------------------------------------------------------
|
|
@@ -34,12 +34,12 @@ const migrationHelper = {
|
|
|
34
34
|
await this._fixPumpModeStates(); // NEU: PV-Automatik hinzufügen
|
|
35
35
|
await this._removeInvalidResetButtons(); // NEU: Entfernt Week/Month-Reset-Buttons
|
|
36
36
|
|
|
37
|
-
this.adapter.log.debug('[migrationHelper] Migration
|
|
37
|
+
this.adapter.log.debug('[migrationHelper] Migration checks completed.');
|
|
38
38
|
} catch (err) {
|
|
39
|
-
this.adapter.log.warn(`[migrationHelper]
|
|
39
|
+
this.adapter.log.warn(`[migrationHelper] Error during migration check: ${err.message}`);
|
|
40
40
|
}
|
|
41
41
|
|
|
42
|
-
this.adapter.log.info('[migrationHelper] Migration
|
|
42
|
+
this.adapter.log.info('[migrationHelper] Migration helper finished.');
|
|
43
43
|
},
|
|
44
44
|
|
|
45
45
|
// ------------------------------------------------------
|
|
@@ -55,7 +55,7 @@ const migrationHelper = {
|
|
|
55
55
|
|
|
56
56
|
const isReadOnly = obj.common?.write === false;
|
|
57
57
|
if (isReadOnly) {
|
|
58
|
-
this.adapter.log.info(`[migrationHelper]
|
|
58
|
+
this.adapter.log.info(`[migrationHelper] Updating write permission for ${id} → write:true`);
|
|
59
59
|
await this.adapter.extendObjectAsync(id, {
|
|
60
60
|
common: {
|
|
61
61
|
write: true,
|
|
@@ -64,7 +64,7 @@ const migrationHelper = {
|
|
|
64
64
|
});
|
|
65
65
|
}
|
|
66
66
|
} catch (err) {
|
|
67
|
-
this.adapter.log.warn(`[migrationHelper]
|
|
67
|
+
this.adapter.log.warn(`[migrationHelper] Error while checking ${id}: ${err.message}`);
|
|
68
68
|
}
|
|
69
69
|
},
|
|
70
70
|
|
|
@@ -81,7 +81,7 @@ const migrationHelper = {
|
|
|
81
81
|
|
|
82
82
|
const hasPersist = obj.common?.persist === true;
|
|
83
83
|
if (!hasPersist) {
|
|
84
|
-
this.adapter.log.info(`[migrationHelper]
|
|
84
|
+
this.adapter.log.info(`[migrationHelper] Adding persist:true for ${id}`);
|
|
85
85
|
await this.adapter.extendObjectAsync(id, {
|
|
86
86
|
common: {
|
|
87
87
|
persist: true,
|
|
@@ -90,7 +90,7 @@ const migrationHelper = {
|
|
|
90
90
|
});
|
|
91
91
|
}
|
|
92
92
|
} catch (err) {
|
|
93
|
-
this.adapter.log.warn(`[migrationHelper]
|
|
93
|
+
this.adapter.log.warn(`[migrationHelper] Error while checking ${id}: ${err.message}`);
|
|
94
94
|
}
|
|
95
95
|
},
|
|
96
96
|
|
|
@@ -108,11 +108,11 @@ const migrationHelper = {
|
|
|
108
108
|
const states = obj.common?.states || {};
|
|
109
109
|
if (!states.auto_pv) {
|
|
110
110
|
states.auto_pv = 'Automatik (PV)';
|
|
111
|
-
this.adapter.log.info(
|
|
111
|
+
this.adapter.log.info('[migrationHelper] Adding new mode "Automatic (PV)" to pump.mode');
|
|
112
112
|
await this.adapter.extendObjectAsync(id, { common: { states } });
|
|
113
113
|
}
|
|
114
114
|
} catch (err) {
|
|
115
|
-
this.adapter.log.warn(`[migrationHelper]
|
|
115
|
+
this.adapter.log.warn(`[migrationHelper] Error while checking ${id}: ${err.message}`);
|
|
116
116
|
}
|
|
117
117
|
},
|
|
118
118
|
|
|
@@ -133,27 +133,27 @@ const migrationHelper = {
|
|
|
133
133
|
// Erst Statewert entfernen
|
|
134
134
|
await this.adapter.delStateAsync(id);
|
|
135
135
|
} catch {
|
|
136
|
-
this.adapter.log.debug(`[migrationHelper]
|
|
136
|
+
this.adapter.log.debug(`[migrationHelper] No state value found for ${id} (skipping).`);
|
|
137
137
|
}
|
|
138
138
|
|
|
139
139
|
// Danach Objekt löschen (auch wenn persist=true)
|
|
140
140
|
try {
|
|
141
141
|
await this.adapter.delObjectAsync(id, { recursive: false });
|
|
142
|
-
this.adapter.log.info(`[migrationHelper]
|
|
142
|
+
this.adapter.log.info(`[migrationHelper] Removed obsolete reset button: ${id}`);
|
|
143
143
|
removed++;
|
|
144
144
|
} catch (err) {
|
|
145
|
-
this.adapter.log.warn(`[migrationHelper]
|
|
145
|
+
this.adapter.log.warn(`[migrationHelper] Could not delete ${id}: ${err.message}`);
|
|
146
146
|
}
|
|
147
147
|
}
|
|
148
148
|
}
|
|
149
149
|
|
|
150
150
|
if (removed === 0) {
|
|
151
|
-
this.adapter.log.debug('[migrationHelper]
|
|
151
|
+
this.adapter.log.debug('[migrationHelper] No old reset buttons found.');
|
|
152
152
|
} else {
|
|
153
|
-
this.adapter.log.info(`[migrationHelper]
|
|
153
|
+
this.adapter.log.info(`[migrationHelper] Removed ${removed} old reset buttons in total.`);
|
|
154
154
|
}
|
|
155
155
|
} catch (err) {
|
|
156
|
-
this.adapter.log.warn(`[migrationHelper]
|
|
156
|
+
this.adapter.log.warn(`[migrationHelper] Error while removing old reset buttons: ${err.message}`);
|
|
157
157
|
}
|
|
158
158
|
},
|
|
159
159
|
};
|
|
@@ -28,15 +28,15 @@ const photovoltaicHelper = {
|
|
|
28
28
|
|
|
29
29
|
if (!this.genId || !this.houseId) {
|
|
30
30
|
this.adapter.log.info(
|
|
31
|
-
'[photovoltaicHelper] PV
|
|
31
|
+
'[photovoltaicHelper] PV IDs are missing in the instance configuration. Surplus detection remains inactive.',
|
|
32
32
|
);
|
|
33
33
|
} else {
|
|
34
34
|
try {
|
|
35
35
|
this.adapter.subscribeForeignStates(this.genId);
|
|
36
36
|
this.adapter.subscribeForeignStates(this.houseId);
|
|
37
|
-
this.adapter.log.info(`[photovoltaicHelper] Subscribed: PV="${this.genId}",
|
|
37
|
+
this.adapter.log.info(`[photovoltaicHelper] Subscribed: PV="${this.genId}", house="${this.houseId}"`);
|
|
38
38
|
} catch (err) {
|
|
39
|
-
this.adapter.log.warn(`[photovoltaicHelper]
|
|
39
|
+
this.adapter.log.warn(`[photovoltaicHelper] Could not subscribe to foreign states: ${err.message}`);
|
|
40
40
|
}
|
|
41
41
|
}
|
|
42
42
|
|
|
@@ -46,7 +46,7 @@ const photovoltaicHelper = {
|
|
|
46
46
|
this.adapter.subscribeStates('pump.mode');
|
|
47
47
|
|
|
48
48
|
this._safeRecalc('init');
|
|
49
|
-
this.adapter.log.info('[photovoltaicHelper]
|
|
49
|
+
this.adapter.log.info('[photovoltaicHelper] Initialization completed.');
|
|
50
50
|
},
|
|
51
51
|
|
|
52
52
|
async handleStateChange(id, state) {
|
|
@@ -66,12 +66,12 @@ const photovoltaicHelper = {
|
|
|
66
66
|
}
|
|
67
67
|
|
|
68
68
|
if (id.endsWith('photovoltaic.afterrun_min')) {
|
|
69
|
-
this.adapter.log.debug(`[photovoltaicHelper]
|
|
69
|
+
this.adapter.log.debug(`[photovoltaicHelper] Afterrun time changed to ${Number(state.val) || 0} min`);
|
|
70
70
|
return;
|
|
71
71
|
}
|
|
72
72
|
if (id.endsWith('photovoltaic.ignore_on_circulation')) {
|
|
73
73
|
this.adapter.log.debug(
|
|
74
|
-
`[photovoltaicHelper] Flag "PV
|
|
74
|
+
`[photovoltaicHelper] Flag "Ignore PV when circulation target reached" = ${!!state.val}`,
|
|
75
75
|
);
|
|
76
76
|
return;
|
|
77
77
|
}
|
|
@@ -81,7 +81,7 @@ const photovoltaicHelper = {
|
|
|
81
81
|
return;
|
|
82
82
|
}
|
|
83
83
|
} catch (err) {
|
|
84
|
-
this.adapter.log.warn(`[photovoltaicHelper]
|
|
84
|
+
this.adapter.log.warn(`[photovoltaicHelper] Error in handleStateChange: ${err.message}`);
|
|
85
85
|
}
|
|
86
86
|
},
|
|
87
87
|
|
|
@@ -117,12 +117,14 @@ const photovoltaicHelper = {
|
|
|
117
117
|
const collectorWarning = !!(await this.adapter.getStateAsync('solar.collector_warning'))?.val;
|
|
118
118
|
if (collectorWarning) {
|
|
119
119
|
this.adapter.log.warn(
|
|
120
|
-
'[photovoltaicHelper]
|
|
120
|
+
'[photovoltaicHelper] Collector overheating detected → pump FORCED ON (safety override active)',
|
|
121
121
|
);
|
|
122
122
|
return this._maybeStartPump('solar_overheat_protection');
|
|
123
123
|
}
|
|
124
124
|
} catch (err) {
|
|
125
|
-
this.adapter.log.warn(
|
|
125
|
+
this.adapter.log.warn(
|
|
126
|
+
`[photovoltaicHelper] Error while checking solar overheating protection: ${err.message}`,
|
|
127
|
+
);
|
|
126
128
|
}
|
|
127
129
|
|
|
128
130
|
// Überschussberechnung
|
|
@@ -142,12 +144,12 @@ const photovoltaicHelper = {
|
|
|
142
144
|
|
|
143
145
|
// Saison/Modus prüfen
|
|
144
146
|
if (!seasonActive) {
|
|
145
|
-
this.adapter.log.debug('[photovoltaicHelper]
|
|
147
|
+
this.adapter.log.debug('[photovoltaicHelper] Season inactive → PV switching logic disabled.');
|
|
146
148
|
return this._maybeStopPump(false, 0, 'season_inactive');
|
|
147
149
|
}
|
|
148
150
|
if (pumpMode !== 'auto_pv') {
|
|
149
151
|
this.adapter.log.debug(
|
|
150
|
-
`[photovoltaicHelper]
|
|
152
|
+
`[photovoltaicHelper] Pump mode is '${pumpMode}' ≠ 'auto_pv' → PV switching logic disabled.`,
|
|
151
153
|
);
|
|
152
154
|
return this._maybeStopPump(false, 0, 'mode_not_auto_pv');
|
|
153
155
|
}
|
|
@@ -164,7 +166,7 @@ const photovoltaicHelper = {
|
|
|
164
166
|
// RULE: Wenn Umwälzung bereits erfüllt → Pumpe sofort AUS (ohne Nachlauf)
|
|
165
167
|
if (remaining <= 0) {
|
|
166
168
|
this.adapter.log.info(
|
|
167
|
-
`[photovoltaicHelper]
|
|
169
|
+
`[photovoltaicHelper] Daily circulation target reached (daily_remaining=${remaining}) → PV control stopped, pump OFF.`,
|
|
168
170
|
);
|
|
169
171
|
return this._maybeStopPump(true, 0, 'circulation_reached_force_off');
|
|
170
172
|
}
|
|
@@ -172,14 +174,12 @@ const photovoltaicHelper = {
|
|
|
172
174
|
// RULE: Wenn Umwälzung noch nicht erfüllt → nur dann darf bei Überschuss eingeschaltet werden
|
|
173
175
|
if (remaining > 0 && surplusActive) {
|
|
174
176
|
this.adapter.log.debug(
|
|
175
|
-
`[photovoltaicHelper]
|
|
177
|
+
`[photovoltaicHelper] Daily circulation target not yet reached (${remaining}) → PV control active.`,
|
|
176
178
|
);
|
|
177
179
|
}
|
|
178
180
|
}
|
|
179
181
|
} catch (err) {
|
|
180
|
-
this.adapter.log.debug(
|
|
181
|
-
`[photovoltaicHelper] daily_remaining konnte nicht gelesen werden: ${err.message}`,
|
|
182
|
-
);
|
|
182
|
+
this.adapter.log.debug(`[photovoltaicHelper] Could not read daily_remaining: ${err.message}`);
|
|
183
183
|
}
|
|
184
184
|
}
|
|
185
185
|
|
|
@@ -194,7 +194,7 @@ const photovoltaicHelper = {
|
|
|
194
194
|
// RULE: Einschalten nur, wenn Umwälzung noch nicht erfüllt
|
|
195
195
|
if (Number.isFinite(remaining) && remaining <= 0) {
|
|
196
196
|
this.adapter.log.info(
|
|
197
|
-
`[photovoltaicHelper]
|
|
197
|
+
`[photovoltaicHelper] Daily circulation target already reached (${remaining}) → pump stays OFF (no start despite surplus).`,
|
|
198
198
|
);
|
|
199
199
|
return this._maybeStopPump(true, 0, 'circulation_already_reached');
|
|
200
200
|
}
|
|
@@ -202,7 +202,7 @@ const photovoltaicHelper = {
|
|
|
202
202
|
// RULE: Überschuss aktiv UND Umwälzung noch nicht erfüllt → einschalten
|
|
203
203
|
return this._maybeStartPump('pv_surplus');
|
|
204
204
|
} catch (err) {
|
|
205
|
-
this.adapter.log.warn(`[photovoltaicHelper]
|
|
205
|
+
this.adapter.log.warn(`[photovoltaicHelper] Error while checking daily_remaining: ${err.message}`);
|
|
206
206
|
return this._maybeStartPump('pv_surplus');
|
|
207
207
|
}
|
|
208
208
|
}
|
|
@@ -221,7 +221,7 @@ const photovoltaicHelper = {
|
|
|
221
221
|
this.afterrunTimer = null;
|
|
222
222
|
}
|
|
223
223
|
this._pvPumpHoldUntil = 0;
|
|
224
|
-
this.adapter.log.info(`[photovoltaicHelper]
|
|
224
|
+
this.adapter.log.info(`[photovoltaicHelper] Pump ON (reason: ${reason})`);
|
|
225
225
|
await this._setPumpSwitch(true);
|
|
226
226
|
},
|
|
227
227
|
|
|
@@ -231,7 +231,7 @@ const photovoltaicHelper = {
|
|
|
231
231
|
return;
|
|
232
232
|
}
|
|
233
233
|
this._desiredPump = false;
|
|
234
|
-
this.adapter.log.info(`[photovoltaicHelper]
|
|
234
|
+
this.adapter.log.info(`[photovoltaicHelper] Pump OFF (${tag}, no afterrun)`);
|
|
235
235
|
await this._setPumpSwitch(false);
|
|
236
236
|
return;
|
|
237
237
|
}
|
|
@@ -244,21 +244,21 @@ const photovoltaicHelper = {
|
|
|
244
244
|
this.afterrunTimer = setTimeout(async () => {
|
|
245
245
|
const active = !!(await this.adapter.getStateAsync('photovoltaic.surplus_active'))?.val;
|
|
246
246
|
if (active) {
|
|
247
|
-
this.adapter.log.debug('[photovoltaicHelper]
|
|
247
|
+
this.adapter.log.debug('[photovoltaicHelper] Afterrun canceled – surplus active again.');
|
|
248
248
|
return;
|
|
249
249
|
}
|
|
250
250
|
this._desiredPump = false;
|
|
251
|
-
this.adapter.log.info('[photovoltaicHelper]
|
|
251
|
+
this.adapter.log.info('[photovoltaicHelper] Pump OFF (afterrun finished)');
|
|
252
252
|
await this._setPumpSwitch(false);
|
|
253
253
|
}, holdMs);
|
|
254
|
-
this.adapter.log.debug(`[photovoltaicHelper]
|
|
254
|
+
this.adapter.log.debug(`[photovoltaicHelper] Afterrun started: ${afterrunMin} min (${tag})`);
|
|
255
255
|
},
|
|
256
256
|
|
|
257
257
|
async _setPumpSwitch(on) {
|
|
258
258
|
try {
|
|
259
259
|
await this.adapter.setStateAsync('pump.pump_switch', { val: !!on, ack: false });
|
|
260
260
|
} catch (err) {
|
|
261
|
-
this.adapter.log.warn(`[photovoltaicHelper]
|
|
261
|
+
this.adapter.log.warn(`[photovoltaicHelper] Could not set pump.pump_switch: ${err.message}`);
|
|
262
262
|
}
|
|
263
263
|
},
|
|
264
264
|
|
|
@@ -266,21 +266,21 @@ const photovoltaicHelper = {
|
|
|
266
266
|
try {
|
|
267
267
|
await this.adapter.setStateAsync(id, { val: Number(val) || 0, ack: true });
|
|
268
268
|
} catch (e) {
|
|
269
|
-
this.adapter.log.warn(`[photovoltaicHelper] setNumber ${id}
|
|
269
|
+
this.adapter.log.warn(`[photovoltaicHelper] setNumber ${id} failed: ${e.message}`);
|
|
270
270
|
}
|
|
271
271
|
},
|
|
272
272
|
async _updateBoolState(id, val) {
|
|
273
273
|
try {
|
|
274
274
|
await this.adapter.setStateAsync(id, { val: !!val, ack: true });
|
|
275
275
|
} catch (e) {
|
|
276
|
-
this.adapter.log.warn(`[photovoltaicHelper] setBool ${id}
|
|
276
|
+
this.adapter.log.warn(`[photovoltaicHelper] setBool ${id} failed: ${e.message}`);
|
|
277
277
|
}
|
|
278
278
|
},
|
|
279
279
|
async _updateStringState(id, val) {
|
|
280
280
|
try {
|
|
281
281
|
await this.adapter.setStateAsync(id, { val: String(val ?? ''), ack: true });
|
|
282
282
|
} catch (e) {
|
|
283
|
-
this.adapter.log.warn(`[photovoltaicHelper] setString ${id}
|
|
283
|
+
this.adapter.log.warn(`[photovoltaicHelper] setString ${id} failed: ${e.message}`);
|
|
284
284
|
}
|
|
285
285
|
},
|
|
286
286
|
|
|
@@ -288,7 +288,7 @@ const photovoltaicHelper = {
|
|
|
288
288
|
try {
|
|
289
289
|
await this._recalc(tag);
|
|
290
290
|
} catch (err) {
|
|
291
|
-
this.adapter.log.warn(`[photovoltaicHelper] Recalc
|
|
291
|
+
this.adapter.log.warn(`[photovoltaicHelper] Recalc error (${tag}): ${err.message}`);
|
|
292
292
|
}
|
|
293
293
|
},
|
|
294
294
|
|
|
@@ -39,20 +39,20 @@ const pumpHelper = {
|
|
|
39
39
|
const val = this._parseNumber(s?.val);
|
|
40
40
|
this.adapter.setStateAsync('pump.current_power', { val, ack: true });
|
|
41
41
|
this.adapter.log.debug(
|
|
42
|
-
`[pumpHelper]
|
|
42
|
+
`[pumpHelper] Monitoring power from ${this.currentPowerId} (initial value: ${val})`,
|
|
43
43
|
);
|
|
44
44
|
})
|
|
45
45
|
.catch(() => {
|
|
46
|
-
this.adapter.log.debug(`[pumpHelper]
|
|
46
|
+
this.adapter.log.debug(`[pumpHelper] Monitoring power from ${this.currentPowerId}`);
|
|
47
47
|
});
|
|
48
48
|
} else {
|
|
49
|
-
this.adapter.log.debug('[pumpHelper]
|
|
49
|
+
this.adapter.log.debug('[pumpHelper] No object ID configured for current power');
|
|
50
50
|
}
|
|
51
51
|
|
|
52
52
|
// Echte Steckdose beobachten (Status-Spiegelung)
|
|
53
53
|
if (this.deviceId) {
|
|
54
54
|
this.adapter.subscribeForeignStates(this.deviceId);
|
|
55
|
-
this.adapter.log.debug(`[pumpHelper]
|
|
55
|
+
this.adapter.log.debug(`[pumpHelper] Monitoring socket: ${this.deviceId}`);
|
|
56
56
|
|
|
57
57
|
// NEU: Initialwert übernehmen
|
|
58
58
|
this.adapter
|
|
@@ -61,20 +61,18 @@ const pumpHelper = {
|
|
|
61
61
|
if (s) {
|
|
62
62
|
const val = !!s.val;
|
|
63
63
|
this.adapter.setStateAsync('pump.pump_switch', { val, ack: true });
|
|
64
|
-
this.adapter.log.debug(`[pumpHelper]
|
|
64
|
+
this.adapter.log.debug(`[pumpHelper] Initial pump state adopted from socket: ${val}`);
|
|
65
65
|
}
|
|
66
66
|
})
|
|
67
|
-
.catch(err =>
|
|
68
|
-
this.adapter.log.warn(`[pumpHelper] Konnte initialen Pumpenstatus nicht laden: ${err.message}`),
|
|
69
|
-
);
|
|
67
|
+
.catch(err => this.adapter.log.warn(`[pumpHelper] Could not load initial pump state: ${err.message}`));
|
|
70
68
|
} else {
|
|
71
|
-
this.adapter.log.debug('[pumpHelper]
|
|
69
|
+
this.adapter.log.debug('[pumpHelper] No object ID configured for pump socket');
|
|
72
70
|
}
|
|
73
71
|
|
|
74
|
-
this.adapter.log.debug('[pumpHelper]
|
|
72
|
+
this.adapter.log.debug('[pumpHelper] initialized');
|
|
75
73
|
// Initialer Status
|
|
76
74
|
this._updateStatus().catch(err =>
|
|
77
|
-
this.adapter.log.warn(`[pumpHelper]
|
|
75
|
+
this.adapter.log.warn(`[pumpHelper] Initial status update failed: ${err.message}`),
|
|
78
76
|
);
|
|
79
77
|
},
|
|
80
78
|
|
|
@@ -98,7 +96,7 @@ const pumpHelper = {
|
|
|
98
96
|
const season = (await this.adapter.getStateAsync('status.season_active'))?.val;
|
|
99
97
|
if (!season) {
|
|
100
98
|
this.adapter.log.debug(
|
|
101
|
-
'[pumpHelper]
|
|
99
|
+
'[pumpHelper] Season inactive – skipping pump logic (frost protection runs separately)',
|
|
102
100
|
);
|
|
103
101
|
return;
|
|
104
102
|
}
|
|
@@ -121,7 +119,7 @@ const pumpHelper = {
|
|
|
121
119
|
|
|
122
120
|
// NEU: Filter gegen zyklische Fremdmeldungen ohne echten Zustandswechsel
|
|
123
121
|
if (current === val) {
|
|
124
|
-
this.adapter.log.debug('[pumpHelper]
|
|
122
|
+
this.adapter.log.debug('[pumpHelper] Foreign state reported identical value – ignored.');
|
|
125
123
|
return;
|
|
126
124
|
}
|
|
127
125
|
|
|
@@ -230,7 +228,7 @@ const pumpHelper = {
|
|
|
230
228
|
ack: true,
|
|
231
229
|
});
|
|
232
230
|
} catch (err) {
|
|
233
|
-
this.adapter.log.warn(`[pumpHelper]
|
|
231
|
+
this.adapter.log.warn(`[pumpHelper] Error while setting pump.status: ${err.message}`);
|
|
234
232
|
}
|
|
235
233
|
},
|
|
236
234
|
|
|
@@ -258,12 +256,12 @@ const pumpHelper = {
|
|
|
258
256
|
const now = Date.now();
|
|
259
257
|
|
|
260
258
|
if (active === true && this._lastPumpStart && now - this._lastPumpStart < graceOnMs) {
|
|
261
|
-
this.adapter.log.debug('[pumpHelper]
|
|
259
|
+
this.adapter.log.debug('[pumpHelper] Within start grace period – skipping error check');
|
|
262
260
|
return;
|
|
263
261
|
}
|
|
264
262
|
|
|
265
263
|
if (active === false && this._lastPumpStop && now - this._lastPumpStop < graceOffMs) {
|
|
266
|
-
this.adapter.log.debug('[pumpHelper]
|
|
264
|
+
this.adapter.log.debug('[pumpHelper] Within stop grace period – skipping error check');
|
|
267
265
|
return;
|
|
268
266
|
}
|
|
269
267
|
// --- Ende Kulanzzeiten ---
|
|
@@ -318,11 +316,11 @@ const pumpHelper = {
|
|
|
318
316
|
if (error && errorMsg) {
|
|
319
317
|
this.adapter.log.warn(`[pumpHelper] ${errorMsg}`);
|
|
320
318
|
} else if (!error && errorOld) {
|
|
321
|
-
this.adapter.log.info('[pumpHelper]
|
|
319
|
+
this.adapter.log.info('[pumpHelper] Pump error resolved');
|
|
322
320
|
}
|
|
323
321
|
}
|
|
324
322
|
} catch (err) {
|
|
325
|
-
this.adapter.log.warn(`[pumpHelper]
|
|
323
|
+
this.adapter.log.warn(`[pumpHelper] Error during error check: ${err.message}`);
|
|
326
324
|
}
|
|
327
325
|
},
|
|
328
326
|
|
|
@@ -34,7 +34,7 @@ const pumpHelper2 = {
|
|
|
34
34
|
*/
|
|
35
35
|
async init(adapter) {
|
|
36
36
|
this.adapter = adapter;
|
|
37
|
-
this.adapter.log.info('[pumpHelper2]
|
|
37
|
+
this.adapter.log.info('[pumpHelper2] Initialization started');
|
|
38
38
|
|
|
39
39
|
// Relevante States überwachen
|
|
40
40
|
this.adapter.subscribeStates('pump.current_power');
|
|
@@ -43,7 +43,7 @@ const pumpHelper2 = {
|
|
|
43
43
|
// Initialwerte berechnen
|
|
44
44
|
await this._updateLiveValues();
|
|
45
45
|
|
|
46
|
-
this.adapter.log.info('[pumpHelper2]
|
|
46
|
+
this.adapter.log.info('[pumpHelper2] Successfully initialized');
|
|
47
47
|
},
|
|
48
48
|
|
|
49
49
|
/**
|
|
@@ -70,11 +70,9 @@ const pumpHelper2 = {
|
|
|
70
70
|
const flowBeforeStop = this.lastKnownFlow;
|
|
71
71
|
if (flowBeforeStop > 0) {
|
|
72
72
|
await this._setIfChanged('pump.live.last_flow_lh', flowBeforeStop);
|
|
73
|
-
this.adapter.log.debug(
|
|
74
|
-
`[pumpHelper2] FIX: Letzter Durchflusswert gesichert: ${flowBeforeStop} l/h`,
|
|
75
|
-
);
|
|
73
|
+
this.adapter.log.debug(`[pumpHelper2] FIX: Last flow value stored: ${flowBeforeStop} l/h`);
|
|
76
74
|
} else {
|
|
77
|
-
this.adapter.log.debug('[pumpHelper2]
|
|
75
|
+
this.adapter.log.debug('[pumpHelper2] No stored flow value available.');
|
|
78
76
|
}
|
|
79
77
|
}
|
|
80
78
|
}
|
|
@@ -94,7 +92,7 @@ const pumpHelper2 = {
|
|
|
94
92
|
|
|
95
93
|
// Schutz gegen ungültige Werte
|
|
96
94
|
if (maxPower <= 0 || nominalFlow <= 0) {
|
|
97
|
-
this.adapter.log.debug('[pumpHelper2]
|
|
95
|
+
this.adapter.log.debug('[pumpHelper2] Invalid base values, calculation skipped');
|
|
98
96
|
return;
|
|
99
97
|
}
|
|
100
98
|
|
|
@@ -115,10 +113,10 @@ const pumpHelper2 = {
|
|
|
115
113
|
await this._setIfChanged('pump.live.flow_percent', flowPercent);
|
|
116
114
|
|
|
117
115
|
this.adapter.log.debug(
|
|
118
|
-
`[pumpHelper2]
|
|
116
|
+
`[pumpHelper2] Actual flow updated: ${flowCurrentLh} l/h (${flowPercent.toFixed(1)}%)`,
|
|
119
117
|
);
|
|
120
118
|
} catch (err) {
|
|
121
|
-
this.adapter.log.warn(`[pumpHelper2]
|
|
119
|
+
this.adapter.log.warn(`[pumpHelper2] Error in _updateLiveValues: ${err.message}`);
|
|
122
120
|
}
|
|
123
121
|
},
|
|
124
122
|
|
|
@@ -155,7 +153,7 @@ const pumpHelper2 = {
|
|
|
155
153
|
cleanup() {
|
|
156
154
|
// Derzeit keine Timer oder Intervalle vorhanden
|
|
157
155
|
// Platzhalter für zukünftige Erweiterungen
|
|
158
|
-
this.adapter?.log.debug('[pumpHelper2] Cleanup
|
|
156
|
+
this.adapter?.log.debug('[pumpHelper2] Cleanup executed.');
|
|
159
157
|
},
|
|
160
158
|
};
|
|
161
159
|
|