Fahrgestellnummer: expliziter "automatisch"-Schalter statt Nur-wenn-leer-Heuristik

- Neues Profilfeld fahrzeug.fin_automatisch (Standard: an).
- identitaet.py: bei "aus" läuft die Ableitung (samt Mehrfach-Sensor-Abgleich)
  gar nicht erst; bei "an" überschreibt der abgeleitete Wert auch einen
  vorher von Hand eingetragenen - der Schalter selbst entscheidet jetzt, statt
  aus einem leeren Feld zu raten.
- dienste.py: profil_schreiben löst die Ableitung jetzt auch aus, damit das
  Umschalten des Schalters selbst sofort wirkt.
- Panel: Schalter "automatisch" zwischen Label und Textfeld in der
  Fahrgestellnummer-Zeile, Feld wird bei "an" deaktiviert.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
2026-08-28 12:01:10 +02:00
parent c0acc836f0
commit 6b35de458d
7 changed files with 94 additions and 17 deletions
+38
View File
@@ -4444,6 +4444,44 @@ needed either - the "Fahrgestellnummer (FIN)" field in "Fahrzeug einrichten" alr
profile field, so it now simply arrives pre-filled instead of blank, and stays fully editable/correctable by
hand same as before.
**Same-day follow-up (2026.8.28.16): an explicit "automatisch" switch, per owner request** ("make a Slider
next to 'Fahrgestellnummer (FIN)' ... automatisch turns on/off the auto-grab VIN from Sensor-Database ...
and also deactivates the sanity-check if VIN matches between sensors"). The original design's "only fill an
empty field, never touch a set one" heuristic is gone - replaced by an explicit, user-visible mode:
- New profile field `fahrzeug.fin_automatisch` (bool, default `true` - added to `vorlage/fahrzeugprofil.json`
and defaulted in `profilZuCar()` via `!== false` for profiles from before this field existed).
- `identitaet.fin_ableiten_und_uebernehmen()` rewritten: returns immediately if `fin_automatisch` is `false`
- **before** even calling `fin_kandidaten_ermitteln()`, so the multi-sensor comparison/mismatch-warning
never runs either, exactly as asked. When `true`, the derived value is now treated as authoritative and
**overwrites** whatever is currently in `fin` (including a previously hand-typed value) whenever a single
clear candidate is found - this is the whole point of an explicit toggle: no more guessing from emptiness,
the human's chosen mode decides. A `fin == kandidat` check avoids a pointless rewrite/republish when
nothing actually changed.
- Panel (`vEinst()`): a `<label class="switch">` reading "automatisch" placed between the "Fahrgestellnummer
(FIN)" label and the text input, in the same `.feld` row (owner's exact layout request) - the input gets
`disabled` whenever automatic is on (`.feld input:disabled{opacity:.5;cursor:not-allowed}`, new rule) and
a title tooltip explaining why, and re-enables the moment automatic is switched off. Wired via the same
`data-*`/central-`change`-listener idiom as every other switch in this file (mirrors `data-steuerlast`).
`CAR.finAutomatisch`/`p.fahrzeug.fin_automatisch` added to both directions of the profile↔CAR mapping.
- `dienste.py`'s `profil_schreiben` handler (not just `entitaeten_schreiben`) now also calls
`identitaet.fin_ableiten_und_uebernehmen()` after writing - this is the actual mechanism that makes
flipping the switch itself take effect immediately: toggling it goes through the ordinary profile-save
path (same as every other "Fahrzeug einrichten" field), so the just-written `fin_automatisch` flag is
what the very next derivation attempt reads.
**Verified live end-to-end, all four transitions, not just read from source**: (1) automatic on, empty
underlying state → real VIN appears, log line fires; (2) toggled off → input's `disabled`/`opacity`
computed style confirmed `false`/`1` (genuinely editable, not just visually similar - the app's normal
`.feld input` background already looks grey by design, so a screenshot alone wasn't proof); (3) typed a
fake value while off, saved → persisted to disk exactly as typed, confirmed via direct file read, log
stayed silent (sanity-check correctly skipped); (4) toggled back on → immediately overwrote the fake value
back to the real derived VIN, both the on-disk file and a fresh log line (`Fahrgestellnummer automatisch
... übernommen: WUAZZZF48PA902804`) confirmed within seconds, no manual save/reload needed. Layout also
confirmed clean at both a real 1400px desktop width and the default phone-width layout - no overflow at
either. `node --check` clean, manifest bumped to `2026.8.28.16`, `audi_ha_test` restarted and confirmed
clean via log.
Verified live in `audi_ha_test` at every step (`.6` then `.7`), each time reading the actual rendered Setup
popup fresh after a real restart (not a stale tab - confirmed via `performance.getEntriesByType('resource')`
showing the new `?v=` served with a nonzero transfer size each time). Final state (`.7`), all 20 single-value