Capteurs production du jour et relais de charge pour l'agent vocal (G1/G9, G6/G7)

sensor.evcs_production_jour_kwh (somme des 3 yield_today, remises a zero
decalees gerees) et sensor.evcs_charge_solaire (relais de la decision du
controleur, pas un second arbitre). Tests 26/26 + mutations.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011uJ47NxgfpGnuuMr3f2n7Z
This commit is contained in:
Tallagrand Thierry
2026-09-25 01:18:35 +02:00
parent 83c790d9b3
commit 30193a1d27
4 changed files with 202 additions and 4 deletions

View File

@@ -30,7 +30,7 @@ import path from 'node:path';
import { fileURLToPath } from 'node:url';
import pg from 'pg';
import { texteRapport, envoyer } from './rapport-nuit.mjs';
import { diagnosticPv, etatCellules } from './diagnostics-agent.mjs';
import { diagnosticPv, etatCellules, productionJour, chargeSolaire } from './diagnostics-agent.mjs';
const ROOT = path.resolve(path.dirname(fileURLToPath(import.meta.url)), '..');
const ONCE = process.argv.includes('--once');
@@ -1834,6 +1834,17 @@ async function publierDiagnosticPv(st) {
friendly_name: 'EVCS — diagnostic production PV', icon: 'mdi:solar-power-variant', ...d,
calcule_a: new Date().toISOString(),
});
// Production du jour (G1/G9) et relais de la decision de charge (G6/G7) :
// memes proprietes, ne dependent que de HA.
const prod = productionJour(st);
await publierCapteur('sensor.evcs_production_jour_kwh', prod.etat, {
friendly_name: 'EVCS — production PV reelle du jour', icon: 'mdi:solar-power',
unit_of_measurement: typeof prod.etat === 'number' ? 'kWh' : undefined, ...prod.attributs,
});
const ch = chargeSolaire(st);
await publierCapteur('sensor.evcs_charge_solaire', ch.etat, {
friendly_name: 'EVCS — charge voiture (decision du controleur)', icon: 'mdi:ev-station', ...ch.attributs,
});
return 1;
}