fb38c297bd
The "grey box around the icons" report turned out not to be a defect: the box on "10.000 km"/"1 Jahr"/"15" is the wanted pattern, and every value the user can change should carry it. All .feld inputs and selects now get the grey iOS fill; inputs with their own visual language (checkbox/radio/range/file) keep the transparent base rule, so the switches are unaffected. Fuel stations are now displayed as "Shell, Pascalstr. 8, Ingolstadt" instead of the bare operator name. New _marke()/_ist_strasse()/_tankstelle() helpers are shared by both parser paths so Shell and non-Shell receipts format the same. The brand is only matched against the receipt header - searching the whole text would let "Total" hit a totals line. Missing parts are dropped instead of leaving empty comma slots, and without a known brand the operator name takes its place. station_address still carries the full street and postcode. test_bekannte_stationen updated to the new format; suite stays green. installationspaket/ is versioned from now on (user request). It contains no real vehicle data - only the example profile with empty FIN/plate placeholders. Keep it in sync whenever pyscript/ or www/ changes. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
48 lines
2.7 KiB
JavaScript
48 lines
2.7 KiB
JavaScript
/* ================================================================
|
|
Audi-Dashboard — Lade-Stub für panel_custom
|
|
================================================================
|
|
Diese Datei selbst ändert sich praktisch nie und bleibt deshalb auch mit
|
|
der langen Standard-Cache-Zeit von Home Assistant für /local/ (31 Tage,
|
|
Cache-Control: public, max-age=2678400 - an der Testinstanz nachgemessen,
|
|
nicht vermutet) unproblematisch: sie lädt bei jedem vollständigen
|
|
Seitenaufruf zuerst audi-dashboard-version.json mit cache:"no-store" -
|
|
das erzwingt eine echte Netzwerkanfrage, unabhängig vom HTTP-Cache -, und
|
|
reicht deren Versionsnummer als Query-Parameter an den eigentlichen
|
|
Code (audi-dashboard-app.js) weiter. Jede neue Versionsnummer ist aus
|
|
Sicht des Browsers eine neue URL und wird deshalb nie aus einem alten
|
|
Cache bedient.
|
|
|
|
Update-Ablauf ohne Neustart und ohne Cache-Probleme:
|
|
1. audi-dashboard-app.js und/oder audi-dashboard.css ersetzen
|
|
2. die Zahl in audi-dashboard-version.json um 1 erhöhen
|
|
3. im Browser einmal ganz normal neu laden (kein Hard-Refresh nötig)
|
|
Diese Datei hier (audi-dashboard-panel.js) bleibt dabei unangetastet -
|
|
configuration.yaml und damit ein HA-Neustart sind für Frontend-Updates
|
|
nicht mehr nötig, nur noch für den allerersten Einbau (§10 Punkt 1).
|
|
|
|
Bekannte HA-Eigenheit (an der Testinstanz reproduziert, nicht vermutet):
|
|
ha-panel-custom cached geladene Skripte nur für den alten js_url-Typ,
|
|
nicht für module_url (siehe dessen eigener Quellcode - für "js" gibt es
|
|
ein url-indiziertes Cache-Objekt, für "module" fehlt das komplett). Bei
|
|
einem direkten/harten Seitenaufruf (nicht bei SPA-interner Navigation)
|
|
kann das dazu führen, dass dieses Skript zweimal als <script type=module>
|
|
eingefügt wird, bevor das erste fertig geladen hat - beobachtet als zwei
|
|
Netzwerk-Requests für diese Datei und ein hängenbleibendes "Lädt …" ohne
|
|
Fehler in der eigentlichen App. Der Cache unten macht starten() robust
|
|
gegen so einen doppelten Aufruf: der zweite Aufruf wartet einfach auf das
|
|
Ergebnis des ersten, statt selbst nochmal zu fetchen/zu importieren. */
|
|
window.__audiDashboardStarten =
|
|
window.__audiDashboardStarten ||
|
|
(async () => {
|
|
let version = Date.now(); // Fallback, falls version.json nicht erreichbar ist
|
|
try {
|
|
const antwort = await fetch("/local/audi-dashboard-version.json", { cache: "no-store" });
|
|
const daten = await antwort.json();
|
|
version = daten.version;
|
|
} catch (e) {
|
|
console.warn("audi_dashboard: version.json nicht erreichbar, nutze Zeitstempel als Cache-Buster", e);
|
|
}
|
|
await import(`/local/audi-dashboard-app.js?v=${version}`);
|
|
})();
|
|
await window.__audiDashboardStarten;
|