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

View File

@@ -28,11 +28,11 @@
padding: 46px 52px 0; padding: 46px 52px 0;
display: grid; display: grid;
grid-template-columns: 560px 1fr; grid-template-columns: 560px 1fr;
grid-template-rows: 1fr auto; grid-template-rows: minmax(0, 1fr) auto;
grid-template-areas: "left right" "foot foot"; grid-template-areas: "left right" "foot foot";
column-gap: 52px; 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; .deck { grid-area: right; display: flex; flex-direction: column; min-width: 0;
padding-left: 52px; border-left: 4px solid var(--ink); } padding-left: 52px; border-left: 4px solid var(--ink); }
@@ -45,6 +45,7 @@
.label .alarm { background: var(--ink); color: var(--paper); } .label .alarm { background: var(--ink); color: var(--paper); }
hr.div { border: 0; border-top: 4px solid var(--ink); margin: 22px 0; } 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 ---- */ /* ---- Météo : silhouette 1-bit + relevé mono ---- */
.wx { display: flex; align-items: center; gap: 30px; } .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); } .ko { display: inline-block; padding: 0 8px; background: var(--ink); color: var(--paper); }
/* ---- Trackers (ratio + envoi/réception du compte, sous le NAS) ---- */ /* ---- 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:last-child { border-bottom: 0; }
.trk .top { display: flex; justify-content: space-between; align-items: baseline; gap: 16px; } .trk .top { display: flex; justify-content: space-between; align-items: baseline; gap: 16px; }
.trk .name { font-weight: 700; font-size: 28px; } .trk .name { font-weight: 700; font-size: 29px; }
.trk .ratio { font-size: 38px; font-weight: 800; line-height: .9; } .trk .ratio { font-size: 40px; font-weight: 800; line-height: .9; }
.trk .io { font-size: 22px; font-weight: 500; line-height: 1.25; margin-top: 2px; } .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) ============================ /* ============================ JAUGE (signature) ============================
Barre de progression intuitive : le noir se REMPLIT de gauche à droite avec la 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> {% if t.ok %}<span class="ratio num">{{ t.ratio_h }}</span>
{% else %}<span class="io"><span class="ko">{{ t.error }}</span></span>{% endif %} {% else %}<span class="io"><span class="ko">{{ t.error }}</span></span>{% endif %}
</div> </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.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 %}
{% if t.tokens is not none %}<div class="io num">{{ t.tokens_h }} {{ t.tokens_label }}</div>{% endif %}{% endif %}
</div> </div>
{% endfor %} {% endfor %}
</div> </div>
{% endif %} {% 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 class="space"></div>
</div> </div>

View File

@@ -72,12 +72,6 @@ CTX = {
{"ok": True, "label": "tr4ker", "ratio_h": "5233,52", "has_io": True, "up_h": "5,62 To", "down_h": "1 Go", "tokens": 223, "tokens_h": "223", "tokens_label": "Crédit"}, {"ok": True, "label": "tr4ker", "ratio_h": "5233,52", "has_io": True, "up_h": "5,62 To", "down_h": "1 Go", "tokens": 223, "tokens_h": "223", "tokens_label": "Crédit"},
{"ok": True, "label": "yggreborn", "ratio_h": "7,63", "has_io": True, "up_h": "60,55 Go", "down_h": "7,94 Go", "tokens": None}, {"ok": True, "label": "yggreborn", "ratio_h": "7,63", "has_io": True, "up_h": "60,55 Go", "down_h": "7,94 Go", "tokens": None},
], ],
"ha_states": [
{"label": "Salon", "display": "21°"},
{"label": "Chambre", "display": "19°"},
{"label": "Humidité", "display": "48 %"},
{"label": "Porte garage", "display": "Fermée"},
],
"kobo": {"ok": True, "percent": 63, "charging": False, "low": False, "stale": False}, "kobo": {"ok": True, "percent": 63, "charging": False, "low": False, "stale": False},
} }