Trackers: section ratio/envoi/réception sous le NAS (c411, extensible)
Nouveau module integrations/trackers.py : pour chaque tracker configuré (env MONITORINK_TRACKERS + bloc par clé), récupère ratio/uploaded/downloaded. Type unit3d_nuxt (c411) : login session (CSRF meta + /api/auth/login) car le ratio n'est pas lisible au token API ; session réutilisée, résultat caché (TTL 30 min). Section dashboard sous le NAS, style instrument 1-bit. Architecture par type pour ajouter d'autres trackers ensuite.
This commit is contained in:
@@ -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, weather
|
||||
from integrations import claude_usage, codex, homeassistant, kobo, nas, trackers, weather
|
||||
|
||||
TEMPLATES = Path(__file__).parent / "templates"
|
||||
|
||||
@@ -55,12 +55,13 @@ 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 = await asyncio.gather(
|
||||
usage, wx, ha, 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(),
|
||||
)
|
||||
|
||||
now = datetime.now(ZoneInfo(config.timezone))
|
||||
@@ -77,6 +78,7 @@ async def build_context() -> dict:
|
||||
"ha_states": ha,
|
||||
"nas": nas_status,
|
||||
"codex": codex_status,
|
||||
"trackers": tracker_stats,
|
||||
"kobo": kobo.current(),
|
||||
"updated": now.strftime("%H:%M"),
|
||||
"stale": False,
|
||||
|
||||
Reference in New Issue
Block a user