sensor.evcs_import_jour_kwh : energie importee d'EDF depuis minuit (le « Depuis reseau » de VRM)
Le proprietaire veut que l'agent vocal lui evite d'ouvrir VRM. « Combien ai-je importe » est une quantite : delta des compteurs cumules AC-in du MultiPlus (vers ac_out + vers inverter) depuis leur valeur a minuit, lue une fois par jour dans l'historique HA. Compteur EDF publie en recoupement. Remise a zero -> indetermine, jamais d'import negatif. Les trois compteurs entrent aussi dans la table mesure (manque note au HANDOFF §76). Tests diagnostics 48 -> 54, deux mutations qui mordent. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_011xd7aRDEChdShwsECohnDN
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
// Les cas PV reprennent les gammes du banc OpenClaw (HANDOFF §77) : G3, G4, G5, G7.
|
||||
// node tests/diagnostics-agent/run.mjs
|
||||
import fs from 'node:fs';
|
||||
import { diagnosticPv, etatCellules, productionJour, chargeSolaire, bilanNuit, etatReseau, MPPT_MODES, ORIGINE_PAR_SOURCE } from '../../tools/diagnostics-agent.mjs';
|
||||
import { diagnosticPv, etatCellules, productionJour, chargeSolaire, bilanNuit, etatReseau, importJour, COMPTEURS_IMPORT, COMPTEUR_EDF, MPPT_MODES, ORIGINE_PAR_SOURCE } from '../../tools/diagnostics-agent.mjs';
|
||||
|
||||
const LIM = 'voltage_current_limited', ACT = 'mppt_active';
|
||||
function st({ pv, conso, reseau, soc = 80, courant = 0, edf = 'off', modes }) {
|
||||
@@ -223,6 +223,31 @@ for (const [nom, r, test] of res) {
|
||||
console.log(`${ok ? 'OK ' : 'KO '} ${nom}`);
|
||||
}
|
||||
|
||||
const n = cas.length + cel.length + prod.length + charge.length + 1 + bn.length + res.length;
|
||||
// Import depuis minuit. Valeurs de minuit fictives, deltas du 26/09 (0,8 kWh VRM).
|
||||
const [OUT, INV] = COMPTEURS_IMPORT;
|
||||
const mn = { [OUT]: 1200.00, [INV]: 845.00, [COMPTEUR_EDF]: 3082.00 };
|
||||
const imp = [
|
||||
['26/09 : 0,5 vers maison + 0,3 vers batterie -> 0,8 complet, recoupe EDF',
|
||||
importJour({ [OUT]: 1200.5, [INV]: 845.3, [COMPTEUR_EDF]: 3082.83 }, mn),
|
||||
(r) => r.etat === 0.8 && r.attributs.statut === 'complet' && r.attributs.compteur_edf_kwh === 0.8
|
||||
&& r.attributs.detail_kwh.vers_ac_out === 0.5 && r.attributs.detail_kwh.vers_inverter === 0.3],
|
||||
['journee sans reseau -> 0, pas indisponible',
|
||||
importJour({ [OUT]: 1200, [INV]: 845, [COMPTEUR_EDF]: 3082 }, mn), (r) => r.etat === 0 && r.attributs.statut === 'complet'],
|
||||
['compteur remis a zero -> indetermine, jamais un import negatif',
|
||||
importJour({ [OUT]: 3.2, [INV]: 845.3 }, mn), (r) => r.etat === 'indetermine'],
|
||||
['un compteur illisible -> partiel, au moins',
|
||||
importJour({ [OUT]: 1200.5, [INV]: null }, mn), (r) => r.etat === 0.5 && r.attributs.statut === 'partiel'],
|
||||
['valeur de minuit inconnue -> indisponible',
|
||||
importJour({ [OUT]: 1200.5, [INV]: 845.3 }, {}), (r) => r.etat === 'indisponible'],
|
||||
['compteur EDF absent : le total ne change pas, recoupement null',
|
||||
importJour({ [OUT]: 1200.5, [INV]: 845.3 }, mn), (r) => r.etat === 0.8 && r.attributs.compteur_edf_kwh === null],
|
||||
];
|
||||
for (const [nom, r, test] of imp) {
|
||||
const ok = test(r);
|
||||
if (!ok) { ko++; console.log(JSON.stringify(r)); }
|
||||
console.log(`${ok ? 'OK ' : 'KO '} ${nom}`);
|
||||
}
|
||||
|
||||
const n = cas.length + cel.length + prod.length + charge.length + 1 + bn.length + res.length + imp.length;
|
||||
console.log(`\n${n - ko}/${n}`);
|
||||
process.exit(ko ? 1 : 0);
|
||||
|
||||
Reference in New Issue
Block a user