Chauffe-eau : Grafana « Le chauffe-eau », historisation (compteur rattrape depuis le 14/08), jour faible = aussi surplus solaire reel et securite douche de 20 h
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
#!/usr/bin/env node
|
||||
// Energie du chauffe-eau sur 24 h (07/10/2026). Usage : node tests/allers-retours/chauffe-eau.mjs
|
||||
import { energieSur24h } from '../../tools/chauffe-eau.mjs';
|
||||
import { energieSur24h, energieDepuis } from '../../tools/chauffe-eau.mjs';
|
||||
let ok = 0, ko = 0;
|
||||
const v = (n, a, b) => { if (a === b) { ok++; console.log(`✅ ${n}`); } else { ko++; console.log(`❌ ${n} : attendu ${b}, obtenu ${a}`); } };
|
||||
const s = (...x) => x.map((state) => ({ state: String(state) }));
|
||||
@@ -9,5 +9,8 @@ v('compteur-immobile-0-kwh', energieSur24h(s(18.254)), 0);
|
||||
v('indisponible-ignore', energieSur24h(s(10, 'unavailable', 11)), 1);
|
||||
v('remise-a-zero-sans-negatif', energieSur24h(s(10, 11, 0, 0.5)), 1.5);
|
||||
v('illisible-null', energieSur24h(s('unavailable')), null);
|
||||
const p = (iso, state) => ({ last_changed: iso, state: String(state) });
|
||||
const serie = [p('2026-10-06T20:00:00Z', 18.0), p('2026-10-07T05:00:00Z', 18.2), p('2026-10-07T06:00:00Z', 18.6), p('2026-10-07T08:00:00Z', 19.1)];
|
||||
v('depuis-07h24-reference-avant-la-borne', energieDepuis(serie, Date.parse('2026-10-07T05:24:00Z')), 0.9);
|
||||
console.log(ko ? `\n${ko} ECHEC(S)` : `\nCHAUFFE-EAU 24 H OK — ${ok}/${ok}`);
|
||||
process.exit(ko ? 1 : 0);
|
||||
|
||||
@@ -26,11 +26,11 @@ function executer(snapshot) {
|
||||
// Snapshot de base : matin d'un jour faible, contacteur ouvert, chauffe-eau sous tension.
|
||||
const BASE = {
|
||||
soc_percent: '45', battery_current_a: '-5', pv_power_w: '900', pv_power_10m_avg_w: '850',
|
||||
house_ac_power_w: '700', grid_power_w: '0', grid_state: 'off', victron_acin1_available: '0',
|
||||
house_ac_power_w: '2000', grid_power_w: '0', grid_state: 'off', victron_acin1_available: '0',
|
||||
today_remaining_kwh: '15', tomorrow_kwh: '25', forecast_source: 'vrm',
|
||||
advisor_enabled: 'on', notifications_enabled: 'off', hot_water_demand: 'normal',
|
||||
water_heater_switch: 'on', water_heater_energy_total_kwh: '18.25',
|
||||
ecs_nuit: 'on', hc_session_committed: 'off', ecs_24h_kwh: '5.5', off_jour_faible_prev: 'off',
|
||||
ecs_nuit: 'on', hc_session_committed: 'off', ecs_24h_kwh: '5.5', ecs_jour_kwh: '3', off_jour_faible_prev: 'off',
|
||||
evcs_priority_active: 'off', forced_off_by_advisor: 'off',
|
||||
};
|
||||
const cas = [
|
||||
@@ -43,6 +43,12 @@ const cas = [
|
||||
attendu: { action: 'turn_on', desired: true, etat: 'jour_faible_eau_froide', owner: true } },
|
||||
{ id: 'jour-faible-energie-illisible-aucune-restriction', snap: { ecs_24h_kwh: 'indisponible' },
|
||||
attendu: { action: 'none', etat: 'jour_faible_energie_illisible', owner: true } },
|
||||
{ id: 'jour-faible-surplus-solaire-chauffe', snap: { water_heater_switch: 'off', off_jour_faible_prev: 'on', pv_power_w: '3500', pv_power_10m_avg_w: '3400', house_ac_power_w: '900' },
|
||||
attendu: { action: 'turn_on', desired: true, etat: 'jour_faible_surplus_solaire', owner: true } },
|
||||
{ id: 'jour-faible-surplus-insuffisant-reste-coupe', snap: { water_heater_switch: 'off', off_jour_faible_prev: 'on', pv_power_w: '1500', house_ac_power_w: '900' },
|
||||
attendu: { action: 'none', etat: 'jour_faible_coupe', owner: true } },
|
||||
{ id: 'jour-faible-sous-tension-sur-batterie-coupe', snap: { water_heater_switch: 'on', pv_power_w: '1500', house_ac_power_w: '2100' },
|
||||
attendu: { action: 'turn_off', desired: false, etat: 'jour_faible_coupe', owner: true } },
|
||||
{ id: 'jour-normal-remise-sous-tension', snap: { ecs_nuit: 'off', water_heater_switch: 'off', off_jour_faible_prev: 'on' },
|
||||
attendu: { action: 'turn_on', desired: true, etat: 'jour_normal_remise_sous_tension', owner: false } },
|
||||
{ id: 'jour-normal-coupure-manuelle-respectee', snap: { ecs_nuit: 'off', water_heater_switch: 'off', off_jour_faible_prev: 'off' },
|
||||
|
||||
Reference in New Issue
Block a user