P11: reset du collant 'plein' au changement de véhicule (charging_time)

- incident 12/08: JEEP chargée -> débranchée -> VW branchée bloquée par le
  collant night_recovery_done_idle de la JEEP
- snapshot +evcs_charging_time, INPUT_PARSE parseChargingTimeToSec
- WINDOWS: sessionFresh (<=90s) neutralise vehicleChargeCompleted/
  dayVehicleFullIdle/departureChargeDone/evcsStatusCharged
- golden 36->39, validé live 05:00:30 (VW débloquée: recovery_done -> wait_grid_takeover)
- HANDOFF §23 + MANUEL reset collant
This commit is contained in:
Tallagrand Thierry
2026-08-12 05:01:26 +02:00
parent 819eafd4d4
commit 5bc9784583
7 changed files with 167 additions and 3 deletions

View File

@@ -158,6 +158,20 @@ function cleanText(v, fallback = '') {
return s;
}
// P11 (12/08/2026) : durée de charge EVCS "1h 49m 53s" / "8m 27s" / "0s"
// → secondes. Repart de 0 à chaque NOUVELLE connexion physique d'un véhicule
// (débranchement JEEP → branchement VW) → signal de reset du collant "plein".
function parseChargingTimeToSec(s) {
const t = (s ?? '').toString().toLowerCase();
if (!t) return null;
let sec = 0;
let matched = false;
const h = t.match(/(\d+)\s*h/); if (h) { sec += Number(h[1]) * 3600; matched = true; }
const m = t.match(/(\d+)\s*m/); if (m) { sec += Number(m[1]) * 60; matched = true; }
const s2 = t.match(/(\d+)\s*s/); if (s2){ sec += Number(s2[1]); matched = true; }
return matched ? sec : null;
}
// Advisor IA : input_text.evcs_advisor_last_run au format "DD/MM HH:mm"
// (pas d'année). On suppose l'année courante ; si le résultat est dans le
// futur (> 1 jour), c'est un passage d'année → on retire un an.
@@ -257,6 +271,7 @@ const parsed = {
evcsCurrentRealA: Math.max(0, num(input.evcs_current_a, 0)),
evcsAcPowerW: Math.max(0, num(input.evcs_ac_power_w, 0)),
evcsChargingTimeSec: parseChargingTimeToSec(input.evcs_charging_time),
evcsChargingSwitchOn: low(input.evcs_charging_switch || 'off') === 'on',
evcsAutoStartSwitchOn: low(input.evcs_auto_start_switch || 'off') === 'on',