Add DAILY_MAINS_POWER: on mains, a mains loss turns the day red at once
A station is on mains when its BusVoltage mean over the 3 days before the day is >= 14.0 V (solar never exceeds 13.50 V on VERMONT; mains stays >= 14.08 V). On mains, the mains loss decides the day color instead of the state x trend matrix: red as soon as an hour falls under 13.4 V (top of the OCV plateau; mains-on hours stay >= 13.65 V, mains-off hours are 13.1-13.3 V). On MISSISSIPPI the day turns red 1-2 h after the loss instead of 29-40 h with the matrix; WEISSHORN and NORDEND (mains) raise no false alert, VERMONT (solar) is unchanged (D-043). The matrix drawio gets the mains case, the site figure a third panel, and the support notification and the client Energy block header show "On mains" / "Not on mains" / "Mains unknown". Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
28ed86baba
commit
9177982de1
18 files changed
+359
-43
No files matched your search
@@ -1,6 +1,7 @@
|
||||
"""Maquette côté support « Home » : page d'accueil du site de monitoring (toutes les stations), avec en haut une section
|
||||
Status. Elle porte une notification par station et par domaine dont le dernier jour de la fenêtre est Orange ou Red
|
||||
(src/<domaine>/day_color.py : Energy, Storage, Cellular, Temperature ; D-025, D-030).
|
||||
(src/<domaine>/day_color.py : Energy, Storage, Cellular, Temperature ; D-025, D-030). Energy y ajoute son statut
|
||||
d'alimentation, sur secteur ou non (DAILY_MAINS_POWER, D-043).
|
||||
|
||||
La notification, comme la vignette de la station, mène à la vue client de la station (son menu principal) :
|
||||
out/maquette_user_<STATION>.html, écrite par maquettes/user/summary.py (à lancer avec les mêmes dates).
|
||||
@@ -61,22 +62,24 @@ for name in STATIONS:
|
||||
tiles.append(f'<a class="tile" href="{user_view(name)}"><div class="tile-head">{name}<span>{last:.2f}[V]</span>'
|
||||
f'</div>{svg}</a>')
|
||||
|
||||
def color_of(dc, station):
|
||||
"""Couleur du dernier jour de la fenêtre pour un domaine ; None si la station n'a pas ses mesures."""
|
||||
def facts_of(dc, station):
|
||||
"""Faits du dernier jour de la fenêtre pour un domaine, couleur comprise ; {} si la station n'a pas ses mesures."""
|
||||
try:
|
||||
points = dc.run(series[station])["points"]
|
||||
except KeyError: # série du domaine absente (VERMONT n'a ni disque ni modem)
|
||||
return None
|
||||
return {p["t"].date(): p["facts"]["color"] for p in points}.get(END)
|
||||
return {}
|
||||
return {p["t"].date(): p["facts"] for p in points}.get(END, {})
|
||||
|
||||
|
||||
notes = []
|
||||
for name in series:
|
||||
for domain, dc in DOMAINS.items():
|
||||
color = color_of(dc, name)
|
||||
facts = facts_of(dc, name)
|
||||
color = facts.get("color")
|
||||
power = f'<span class="power">{dc.POWER_LABEL[facts["power"]]}</span>' if "power" in facts else ""
|
||||
if color in NAME:
|
||||
notes.append((list(NAME).index(color), name, domain,
|
||||
f'<li><span class="status {color}">{NAME[color]}</span><b>{name}</b><span>{domain}</span>'
|
||||
f'<li><span class="status {color}">{NAME[color]}</span><b>{name}</b><span>{domain}</span>{power}'
|
||||
f'<span class="meta">{END.strftime("%a %d %b %Y")}</span><span>{dc.HEADLINE[color]}</span>'
|
||||
f'<a href="{user_view(name)}">Open {name} →</a></li>'))
|
||||
status = "".join(n[-1] for n in sorted(notes)) or '<li class="empty">No problem or point of attention.</li>'
|
||||
|
||||
@@ -52,6 +52,7 @@
|
||||
.status { padding: 2px 12px; border-radius: 999px; font-size: 13px; font-weight: bold; color: #fff; }
|
||||
.status.ORANGE { background: var(--orange); color: #1a1a1a; } .status.RED { background: var(--red); }
|
||||
.meta { color: var(--muted); font-size: 13px; }
|
||||
.power { padding: 1px 10px; border: 1px solid var(--line); border-radius: 999px; font-size: 13px; } /* Energy : secteur ou non (D-043) */
|
||||
|
||||
/* Vignettes des stations, comme sur le site : nom, dernière tension, courbe de la fenêtre. */
|
||||
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 16px 0; margin-bottom: 20px; }
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
Chaque bloc : couleur du dernier jour de la fenêtre et sa phrase (src/<domaine>/day_color.py), deux lignes en mots simples
|
||||
(Energy : échelle de batterie et tendance ; Storage : échelle de l'espace libre et date de saturation ; Cellular : envois
|
||||
du jour et échelle du signal ; Temperature : maximum des 24 h et limite), puis historique complet (src/<domaine>/final.py, D-021) et guide (partie 1), repliés.
|
||||
Energy affiche aussi, dans son en-tête, si la station est sur secteur ou non (DAILY_MAINS_POWER, D-043).
|
||||
Données réelles : une page par station de data/. Écrit out/maquette_user_<STATION>.html et les ouvre dans le navigateur.
|
||||
Usage : python3 maquettes/user/summary.py [AAAA-MM-JJ début] [AAAA-MM-JJ fin] (défaut : 2026-09-18 à 2026-09-28)
|
||||
"""
|
||||
@@ -38,7 +39,7 @@ DOMAINS = {"energy": (energy, energy_figure, "docs/energy/guide/diagnostic-energ
|
||||
IDENTIFIERS = ("SIM_CCID", "ip") # préfixes des identifiants de la station : jamais affichés (CLAUDE.md, data/)
|
||||
RULE = {"full_charge_v": bs.FULL_CHARGE_V, "min_rise_v": bs.MIN_RISE_V, "storage_floors": sts.FREE_PERCENT_FLOORS,
|
||||
"expected_sends": ls.SAMPLES_PER_HOUR * ls.HOURS_PER_DAY, "signal_classes": sgs.CLASSES,
|
||||
"gpu_limit_deg_c": gl.GPU_LIMIT_DEG_C}
|
||||
"gpu_limit_deg_c": gl.GPU_LIMIT_DEG_C, "power_label": energy.POWER_LABEL}
|
||||
|
||||
|
||||
def guide(path):
|
||||
|
||||
@@ -55,6 +55,7 @@
|
||||
.status.GREEN { background: var(--green); } .status.ORANGE { background: var(--orange); color: #1a1a1a; }
|
||||
.status.RED { background: var(--red); } .status.UNKNOWN { background: var(--unknown); }
|
||||
.meta { color: var(--muted); font-size: 13px; }
|
||||
.power { padding: 1px 10px; border: 1px solid var(--line); border-radius: 999px; font-size: 13px; color: var(--text); }
|
||||
.diag-item > summary .chev { margin-left: auto; width: 13px; height: 13px; transition: transform .15s; }
|
||||
.diag-item[open] > summary .chev { transform: rotate(180deg); }
|
||||
.diag-body { border-top: 1px solid var(--line); padding: 14px; }
|
||||
@@ -266,6 +267,9 @@ for (const [key, dom] of Object.entries(DATA.domains)) {
|
||||
el.id = key;
|
||||
el.querySelector(".name").textContent = name;
|
||||
el.querySelector(".status").outerHTML = chip(c);
|
||||
// Energy : sur secteur ou non, visible sans ouvrir le bloc (DAILY_MAINS_POWER, D-043) ; null = statut inconnu.
|
||||
if (key === "energy") el.querySelector(".status").insertAdjacentHTML("afterend",
|
||||
`<span class="power">${R.power_label[cur.power ?? null]}</span>`);
|
||||
el.querySelector(".meta").textContent = `${DATA.label} · ${ACTION[c] || "Check data"}`;
|
||||
el.querySelector(".headline").textContent = dom.headline[c] || `Not enough data to assess the station's ${what}.`;
|
||||
el.querySelector(".days").innerHTML = ROWS[key](cur).map(([k, x]) => `<tr><th>${k}</th><td>${x}</td></tr>`).join("");
|
||||
|
||||
Reference in new issue
Block a user