Alerte d'expiration des certificats HTTPS du reverse proxy (sensor.evcs_certificats)
This commit is contained in:
@@ -34,6 +34,7 @@ import { texteRapport, envoyer, donneesNuit, texteDepuis } from './rapport-nuit.
|
||||
import { donneesRevue, constatsRevue } from './revue-jour.mjs';
|
||||
import { detecterSituation, lireChoix, DUREE_MIN as ARBITRAGE_DUREE_MIN } from './arbitrage.mjs';
|
||||
import { pilesAAlerter } from './piles.mjs';
|
||||
import { DOMAINES, lireCertificat, certificatsAAlerter } from './certificats.mjs';
|
||||
import { diagnosticPv, etatCellules, productionJour, chargeSolaire, bilanNuit, etatReseau, importJour, minuitLocal, COMPTEURS_IMPORT, COMPTEUR_EDF, consoJour, COMPTEURS_CONSO, projectionSoir, previsionNuit, vrmVersCourbes, nuitMaisonPrevue } from './diagnostics-agent.mjs';
|
||||
import { transitionsDansSerie } from './allers-retours.mjs';
|
||||
import { energieSur24h, energieDepuis, COMPTEUR_CHAUFFE_EAU } from './chauffe-eau.mjs';
|
||||
@@ -2133,6 +2134,26 @@ async function appliquerOrdreAirtria(sql, client, st) {
|
||||
// WhatsApp. input_text.evcs_piles_ignorees (liste separee par des virgules)
|
||||
// pour faire taire un appareil.
|
||||
let pilesPubliees = false;
|
||||
|
||||
// ---------------------------------------------------------------------
|
||||
// CERTIFICATS HTTPS DU REVERSE PROXY .50 (13/10/2026, tools/certificats.mjs)
|
||||
// sensor.evcs_certificats = nombre d'alertes (expire, < 14 j, mauvais nom,
|
||||
// illisible) ; attributs alertes, certificats, prochaine, texte. Lu au
|
||||
// demarrage puis toutes les heures (minute 8). SPARK previent par WhatsApp.
|
||||
// ---------------------------------------------------------------------
|
||||
let certificatsPublies = false;
|
||||
async function publierCertificats() {
|
||||
const lectures = [];
|
||||
for (const d of DOMAINES) lectures.push(await lireCertificat(d));
|
||||
const c = certificatsAAlerter(lectures, Date.now());
|
||||
await publierCapteur('sensor.evcs_certificats', c.alertes.length, {
|
||||
friendly_name: 'Certificats HTTPS du reverse proxy', icon: 'mdi:certificate-outline',
|
||||
alertes: c.alertes, certificats: c.certificats, prochaine: c.prochaine, texte: c.texte,
|
||||
lu_a: new Date().toISOString(),
|
||||
});
|
||||
certificatsPublies = true;
|
||||
return 1;
|
||||
}
|
||||
async function publierPiles() {
|
||||
const r = await fetch(`${HA_URL}/api/states`, { headers: { Authorization: `Bearer ${HA_TOKEN}` }, signal: AbortSignal.timeout(15000) });
|
||||
if (!r.ok) throw new Error(`HA ${r.status}`);
|
||||
@@ -2727,6 +2748,9 @@ async function cycle(client) {
|
||||
piles: (DRY || (pilesPubliees && new Date().getMinutes() % 15 !== 6)) ? 0 : await publierPiles().catch((e) => {
|
||||
console.error('piles :', e.message); return 0;
|
||||
}),
|
||||
certificats: (DRY || (certificatsPublies && new Date().getMinutes() !== 8)) ? 0 : await publierCertificats().catch((e) => {
|
||||
console.error('certificats :', e.message); return 0;
|
||||
}),
|
||||
arbitrage: DRY ? 0 : await arbitrer(sql, client, st).catch((e) => {
|
||||
console.error('arbitrage :', e.message); return 0;
|
||||
}),
|
||||
|
||||
Reference in New Issue
Block a user