Jour faible : session HC midi et nuit engagee pour le chauffe-eau ; alerte « passe en BOOST » si pompe a chaleur en HC ; HANDOFF

This commit is contained in:
Tallagrand Thierry
2026-10-07 07:50:39 +02:00
parent b142429920
commit 9094984069
13 changed files with 199 additions and 13 deletions

View File

@@ -329,6 +329,36 @@ if (advisorEnabled && ecsNuit) {
reason.push('Jour normal : chauffe-eau remis sous tension (il chauffe au solaire)');
}
// =====================================================
// ALERTE « PASSE EN BOOST » (07/10/2026, proprietaire)
// =====================================================
// En heures creuses sur EDF, le ballon doit consommer AU MAXIMUM toute la
// fenetre : en AUTO il reste sur la pompe a chaleur (lent, 55 °C) et la douche
// ne sera pas a 65 °C (20 h apres la HC de midi, 06 h apres celle de nuit).
// Si, 15 min apres le debut de la fenetre, session engagee, contacteur ferme et
// ballon sous tension, il ne tire que la puissance de la pompe a chaleur
// (regime hp_low), on le SIGNALE : input_text.evcs_alerte_chauffe_eau (JSON,
// `since` = debut de la fenetre -> un seul message par fenetre, envoye par le
// concierge OpenClaw). 0 W = thermostat satisfait : pas d'alerte.
const ALERTE_DELAI_MIN = 15;
const minNow = Number.isFinite(now.minNow) ? now.minNow : null;
const fenetreHc = (normalized.hcWindows || []).find((w) => minNow !== null && (
w.debut <= w.fin ? (minNow >= w.debut && minNow < w.fin) : (minNow >= w.debut || minNow < w.fin)));
const depuisDebutMin = fenetreHc ? ((minNow - fenetreHc.debut + 1440) % 1440) : null;
const alerteBoost = !!fenetreHc && depuisDebutMin >= ALERTE_DELAI_MIN
&& hcSessionCommitted && gridIsOn && waterHeaterSwitchOn && observedRegime === 'hp_low';
let alerteChauffeEau = '';
if (alerteBoost) {
const h = String(Math.floor(fenetreHc.debut / 60)).padStart(2, '0') + ':' + String(fenetreHc.debut % 60).padStart(2, '0');
const jourFenetre = (fenetreHc.debut > fenetreHc.fin && minNow < fenetreHc.fin)
? new Date(nowMs - 86400000).toLocaleDateString('sv-SE', { timeZone: 'Europe/Paris' }) : now.date;
alerteChauffeEau = JSON.stringify({
active: true, since: `${jourFenetre} ${h}`, fenetre: fenetreHc.nom,
puissance_w: Math.round(observedPowerW),
message: `🚿 Heures creuses EDF : le chauffe-eau ne tire que ${Math.round(observedPowerW)} W (pompe a chaleur). Passe-le en BOOST pour avoir 65 °C a ${fenetreHc.douche}.`,
});
}
return [{
json: {
...root,
@@ -366,7 +396,8 @@ return [{
powerSwitchAction,
powerSwitchDesiredOn,
offJourFaible,
jourFaibleState
jourFaibleState,
alerteChauffeEau
}
}
}];

View File

@@ -33,6 +33,10 @@
"ecs_24h_kwh": states("sensor.evcs_chauffe_eau_24h_kwh"),
"ecs_jour_kwh": states("sensor.evcs_chauffe_eau_jour_kwh"),
"off_jour_faible_prev": states("input_boolean.victron_water_heater_off_jour_faible"),
"hc_midday_start": states("input_datetime.victron_evcs_hc_midday_start"),
"hc_midday_stop": states("input_datetime.victron_evcs_hc_midday_stop"),
"hc_night_start": states("input_datetime.victron_evcs_hc_night_start"),
"hc_night_stop": states("input_datetime.victron_evcs_hc_night_stop"),
"advisor_enabled": states("input_boolean.victron_water_heater_advisor_enabled"),
"notifications_enabled": states("input_boolean.victron_water_heater_notifications"),

View File

@@ -198,6 +198,12 @@ const ecs24hKwh = num(input.ecs_24h_kwh, NaN);
const ecsJourKwh = num(input.ecs_jour_kwh, NaN);
const offJourFaiblePrev = low(input.off_jour_faible_prev) === 'on';
const forecastSource = cleanStateText(input.forecast_source) || 'forecast_solar';
// Fenetres HC (« HH:MM:SS » des input_datetime du controleur), en minutes du jour.
const hhmm = (v) => { const m = cleanStateText(v).match(/^(\d{1,2}):(\d{2})/); return m ? Number(m[1]) * 60 + Number(m[2]) : null; };
const hcWindows = [
{ nom: 'midi', debut: hhmm(input.hc_midday_start), fin: hhmm(input.hc_midday_stop), douche: '20 h' },
{ nom: 'nuit', debut: hhmm(input.hc_night_start), fin: hhmm(input.hc_night_stop), douche: '06 h' },
].filter((w) => w.debut !== null && w.fin !== null);
return [{
json: {
@@ -246,7 +252,8 @@ return [{
ecs24hKwh,
ecsJourKwh,
offJourFaiblePrev,
forecastSource
forecastSource,
hcWindows
}
}
}];

View File

@@ -196,7 +196,8 @@ let {
protectionState,
powerSwitchAction,
powerSwitchDesiredOn,
offJourFaible = false
offJourFaible = false,
alerteChauffeEau = ''
} = finalDecision;
reason = Array.isArray(reason) ? [...reason] : [];
@@ -563,6 +564,15 @@ helper_budget_margin: {
datetime: forcedOffAtSafe
}
},
// Alerte « passe en BOOST » (07/10/2026), lue par le concierge OpenClaw.
helper_alerte_chauffe_eau: {
domain: 'input_text',
service: 'set_value',
data: {
entity_id: 'input_text.evcs_alerte_chauffe_eau',
value: alerteChauffeEau
}
},
// Jour faible (07/10/2026) : la coupure appartient a la regle « eau chaude en HC de nuit ».
helper_off_jour_faible: {
domain: 'input_boolean',