Add real Audi CI battery/edit icons, manual km-correction for tire sets

Replaced the hand-drawn placeholder battery icon with the real Audi CI
battery-12v-l/-s (user supplied the actual SVGs) next to "Ruhespannung",
matching the existing poi-l/poi-s size-variant convention.

Added a km-correction control to the Sommerräder/Winterräder tiles: a
pencil icon (Audi CI edit-s) opens an inline field to manually correct
the tire-set's accumulated km. The tricky part was persistence -
configCarZuProfil() deliberately never writes km back (a stale browser
copy could otherwise clobber a since-elapsed automatic increment), so
this needed its own backend service, audi_dashboard_reifen_km_setzen,
that overwrites only the stored counter and leaves referenz_odo_km
alone - the existing odometer-delta tracking in reifenzaehler.py then
continues accumulating from the corrected value on its own, no other
backend change required.

Co-Authored-By: Claude Opus 5 <[email protected]>
This commit is contained in:
2026-08-16 23:16:08 +02:00
co-authored by Claude Opus 5
parent 8b3e5b2b8f
commit 6bf7435434
7 changed files with 273 additions and 10 deletions
+45
View File
@@ -1037,6 +1037,51 @@ wraps the web app for iPhone; a PWA home-screen install is the accepted intermed
left:auto` (added last round to right-align it under its old block-flow parent) was removed since
`.radkopf-row`'s flex layout does that job now. Deployed to `audi_ha_test`, confirmed live via
screenshot for both Sommerräder (mounted) and Winterräder (unmounted) tiles.
- [x] Ninth round the same day (2026-08-16) — "Mein Audi" image-cycle tap, still broken after the
seventh round's `bildWeiter()` crash fix: reproduced with a genuine mouse click (not a JS
`.click()` call) via screenshot and found the actual cause was one level upstream. This docker
test container has zero uploaded car photos, so every gallery image is in `bild-fehlt` state,
and `.bildbox.bild-fehlt img{display:none}` makes the `<img id="carimg">` itself un-hit-testable
— a real tap lands on the `.platzhalter` div instead, which the old handler
(`e.target.id === "carimg"`) never matched, so nothing happened. First fix wrapped the gallery
image in a `data-bildgalerie` container that opened the upload picker when empty and advanced
when a photo was loaded; the user then clarified uploads should stay exclusively in Einstellungen
("Bild der Übersicht") — Mein Audi should only ever cycle. Settled on: the wrapper stays (needed
so taps land on something clickable regardless of `bild-fehlt` state) but always calls
`bildWeiter()`, no upload branch. Verified live with a real click (screenshot → click → recheck
`.dots`): the active dot correctly advances, no console errors beyond this environment's
pre-existing service-worker/404 noise.
Also this round: replaced the "Farbskala Ladezustand (AGM, Ruhespannung)" text-only label above
the battery voltage color scale with a small battery icon + "Ruhespannung" (new `.bv-skala-kopf`
flex row, same geometry as the header's `.sync` icon+text pattern). First attempt hand-drew a
generic outline battery glyph since no "battery" icon exists in this repo's local CI subset
(`design/assets/icons/`); the user then supplied the real `battery-12v-l.svg`/`battery-12v-s.svg`
files from the actual Audi CI icon set (not something this session has fetch access to — asked
the user rather than guessing a URL or fabricating an icon and calling it authentic). Added both
as `CI.battery12vL`/`CI.battery12vS` (verbatim paths, `l` on the 48-grid, `s` on the 24-grid,
matching the existing `poi-l`/`poi-s` size-variant convention); only the `s` variant is used here
via `ciSVG()` since this is a small 15px inline label icon.
Deployed to `audi_ha_test`, confirmed live via screenshot.
Also this round (user then supplied the real `edit-l.svg`/`edit-s.svg` too): added a manual
km-correction control to the Reifen tiles, per explicit request — a small pencil icon (Audi CI
`edit-s`, new `CI.editS`/`CI.editL`) to the left of each Sommerräder/Winterräder km figure, "the
counter shall add continuously to these km even if the user changes the km". The tricky part
was persistence: `configCarZuProfil()` *deliberately* strips `km` before every profile write
(see its own comment - km is "vom Backend fortgeschrieben", a stale browser copy must never
clobber a since-elapsed automatic increment), so simply mutating `CAR.reifen[k].km` and calling
`profilSpeichern()` like every other Reifen field does would silently drop the edit. Added a
dedicated backend service instead, `audi_dashboard_reifen_km_setzen(satz, km)` in
`reifenzaehler.py`, that only overwrites the stored counter itself and leaves
`reifen.referenz_odo_km` (the last-processed odometer reference) untouched - the existing
`kilometerstand_geaendert()` trigger always reads the counter fresh off disk before adding the
next delta, so continuing to accumulate from the corrected value required no other backend
change at all. New `kmOffen` state (which satz's correction field is open, mirroring the
existing `nmOffen`/`bildMenuOffen` single-open-popup pattern) plus `data-kmauf`/
`data-kmspeichern` handlers, styled like the existing `.montiert`/`.zahnrad` controls (44×44pt
invisible tap target via `::before`). Verified end-to-end: edited Sommerräder from 150→4200 km,
confirmed the pyscript service ran via the container's HA log, then did a full page reload
(forces a real backend re-fetch, not just optimistic local UI state) and the corrected value
was still there.
- [ ] Fix remaining documentation drift (statistics claim, README gaps, obsolete TODO comment) —
text-only changes; INSTALL.md's WLAN/TommiG1 drift and stale variable names were fixed
2026-08-12 (see section B); `DESIGN_REVIEW_2026-08-13.md` and `REVIEW_main_2026-08-13.md`