Dashboard: trackers en ledger 2 lignes, footer ancré, retrait Home Assistant

- Trackers: I/O + jetons fusionnés sur une ligne (↑↓), ratio en héros (40px)
- Footer: grid-rows minmax(0,1fr) + .pane overflow:hidden -> ne quitte plus le canevas
- Retire la section Maison (HA) du template + le fetch homeassistant de render.py
This commit is contained in:
jerem
2026-06-17 11:40:52 +02:00
parent c253ecf226
commit 6f7b2388f2
3 changed files with 11 additions and 28 deletions

View File

@@ -14,7 +14,7 @@ from playwright.async_api import async_playwright
from config import config
from fonts import font_face_css
from integrations import claude_usage, codex, homeassistant, kobo, nas, trackers, weather
from integrations import claude_usage, codex, kobo, nas, trackers, weather
TEMPLATES = Path(__file__).parent / "templates"
@@ -55,10 +55,9 @@ def _gauges(usage: claude_usage.ClaudeUsage) -> list[dict]:
async def build_context() -> dict:
"""Récupère toutes les sources en parallèle et assemble le contexte du template."""
usage, wx, ha, nas_status, codex_status, tracker_stats = await asyncio.gather(
usage, wx, nas_status, codex_status, tracker_stats = await asyncio.gather(
claude_usage.fetch_usage(),
weather.fetch_weather(),
homeassistant.fetch_states(),
nas.fetch_status(),
codex.fetch_status(),
trackers.fetch_all(),
@@ -75,7 +74,6 @@ async def build_context() -> dict:
"weather": wx,
"claude": usage,
"gauges": _gauges(usage),
"ha_states": ha,
"nas": nas_status,
"codex": codex_status,
"trackers": tracker_stats,

View File

@@ -28,11 +28,11 @@
padding: 46px 52px 0;
display: grid;
grid-template-columns: 560px 1fr;
grid-template-rows: 1fr auto;
grid-template-rows: minmax(0, 1fr) auto;
grid-template-areas: "left right" "foot foot";
column-gap: 52px;
}
.pane { grid-area: left; display: flex; flex-direction: column; min-width: 0; }
.pane { grid-area: left; display: flex; flex-direction: column; min-width: 0; overflow: hidden; }
.deck { grid-area: right; display: flex; flex-direction: column; min-width: 0;
padding-left: 52px; border-left: 4px solid var(--ink); }
@@ -45,6 +45,7 @@
.label .alarm { background: var(--ink); color: var(--paper); }
hr.div { border: 0; border-top: 4px solid var(--ink); margin: 22px 0; }
.pane hr.div { margin: 16px 0; }
/* ---- Météo : silhouette 1-bit + relevé mono ---- */
.wx { display: flex; align-items: center; gap: 30px; }
@@ -66,12 +67,13 @@
.ko { display: inline-block; padding: 0 8px; background: var(--ink); color: var(--paper); }
/* ---- Trackers (ratio + envoi/réception du compte, sous le NAS) ---- */
.trk { padding: 8px 0; border-bottom: 2px solid var(--ink); }
.trk { padding: 10px 0; border-bottom: 2px solid var(--ink); }
.trk:last-child { border-bottom: 0; }
.trk .top { display: flex; justify-content: space-between; align-items: baseline; gap: 16px; }
.trk .name { font-weight: 700; font-size: 28px; }
.trk .ratio { font-size: 38px; font-weight: 800; line-height: .9; }
.trk .io { font-size: 22px; font-weight: 500; line-height: 1.25; margin-top: 2px; }
.trk .name { font-weight: 700; font-size: 29px; }
.trk .ratio { font-size: 40px; font-weight: 800; line-height: .9; }
.trk .io { font-size: 22px; font-weight: 500; line-height: 1.2; margin-top: 3px;
white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
/* ============================ JAUGE (signature) ============================
Barre de progression intuitive : le noir se REMPLIT de gauche à droite avec la
@@ -215,23 +217,12 @@
{% if t.ok %}<span class="ratio num">{{ t.ratio_h }}</span>
{% else %}<span class="io"><span class="ko">{{ t.error }}</span></span>{% endif %}
</div>
{% if t.ok %}{% if t.has_io %}<div class="io num">envoyé {{ t.up_h }} · reçu {{ t.down_h }}</div>{% endif %}
{% if t.tokens is not none %}<div class="io num">{{ t.tokens_h }} {{ t.tokens_label }}</div>{% endif %}{% endif %}
{% if t.ok and (t.has_io or t.tokens is not none) %}<div class="io num">{% if t.has_io %}↑{{ t.up_h }} ↓{{ t.down_h }}{% endif %}{% if t.has_io and t.tokens is not none %} · {% endif %}{% if t.tokens is not none %}{{ t.tokens_h }} {{ t.tokens_label }}{% endif %}</div>{% endif %}
</div>
{% endfor %}
</div>
{% endif %}
{% if ha_states %}
<hr class="div">
<div class="label"><span class="t">Maison</span></div>
<div class="rows grid2">
{% for s in ha_states %}
<div class="row"><span class="k">{{ s.label }}</span><span class="v num">{{ s.display }}</span></div>
{% endfor %}
</div>
{% endif %}
<div class="space"></div>
</div>