Setup-Menü für Sensor-Zuordnung + Umstellung von WLAN/VAG-Integration auf FMM003
Setup-Menü (Einstellungen -> Fahrzeug einrichten -> Setup): ordnet alle von der App genutzten Sensor-Rollen echten HA-Entitäten zu, statt sie in einstellungen.py von Hand einzutragen - durchsuchbares Dropdown je Feld, Vorauswahl aus vorhandenen Entitäten, Schalter für "nur passende Sensoren". Neues Modul entitaeten.py (Katalog + JSON-Override, zur Laufzeit über setattr() auf einstellungen angewendet, kein Neustart nötig außer für die drei trigger-gebundenen Felder). Zusätzlich: Fahrzeug-WLAN-Erkennung und alle Entity-IDs der nicht mehr genutzten TommiG1/HA_VAG-EU-Data-Act-Integration entfernt. Fahrterkennung läuft jetzt über den Zündungs-/ACC-Status des neu angebundenen Teltonika FMM003 (ersetzt die WLAN-Verbindungserkennung); Standort und 12V- Batteriespannung kommen ebenfalls vom FMM003. Kilometerstand, Tankfüllstand, Reichweite, Türen/Fenster/Schlösser sowie Ölwechsel-/Inspektionsdaten haben dadurch vorerst keine Quelle mehr und zeigen "unbekannt" - die Funktionen selbst bleiben erhalten und lassen sich über das neue Setup-Menü jederzeit neu zuordnen. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
# AGENTS.md — Project state, review findings, open items, and working rules
|
||||
|
||||
**Last updated: 2026-08-11** (full-repo review). This file is the entry point for every new agent
|
||||
**Last updated: 2026-08-12**. This file is the entry point for every new agent
|
||||
session: what this repo is, what is finished, what is missing, and how to work here. Detail lives in
|
||||
the linked documents — this file points, it does not duplicate.
|
||||
|
||||
@@ -119,16 +119,24 @@ capacitor/iframe/browser (`umgebung.ts`), types + entity table (`types.ts`), fac
|
||||
|
||||
### HA panel — known gaps (most also in SPECIFICATION.md §7)
|
||||
|
||||
- **GPS is dead schema:** `start_lat/lon`, addresses, `route`, `avg_speed_kmh` never populated.
|
||||
The trip-detail map draws a **fabricated** line via `fakeTrack()`
|
||||
(`audi-dashboard-app.js:414`) — not a real track.
|
||||
- **GPS is dead schema for trip records specifically:** `start_lat/lon`, addresses, `route`,
|
||||
`avg_speed_kmh` on individual trips never populated. The trip-detail map draws a **fabricated**
|
||||
line via `fakeTrack()` (`audi-dashboard-app.js:414`) — not a real track. (Unrelated: the
|
||||
Übersicht's live Standort-Kachel is no longer in this state — `STANDORT_TRACKER` now points at
|
||||
a real `device_tracker`, see section B/C. This item is only about per-trip route data, which
|
||||
nothing currently populates.)
|
||||
- **No GPS fallback in trip completion:** trips without an odometer match stay `status="offen"`
|
||||
forever (`modules/fahrtabschluss_logik.py:16-20`).
|
||||
- **RAM-only state:** running trip (`_fahrt_start_ts`) and fuel low-water-mark
|
||||
(`_tiefststand_pct`) do not survive an HA restart. Deliberately deferred hardening.
|
||||
- **Inactive features:** `BATTERIE_SENSOR = ""` (entire battery-history feature is a no-op) and
|
||||
`UPDATE_REPO_URL = ""` (self-update inactive), both in `pyscript/modules/einstellungen.py`.
|
||||
`www/bilder/` has no vehicle photos (all slots show placeholders); `steuer.faellig` unset.
|
||||
- **Inactive features:** `UPDATE_REPO_URL = ""` (self-update inactive) in
|
||||
`pyscript/modules/einstellungen.py`. `www/bilder/` has no vehicle photos (all slots show
|
||||
placeholders); `steuer.faellig` unset. (`BATTERIE_SENSOR` was the same kind of gap until
|
||||
2026-08-12 — now wired to the FMM003's `external_power_voltage`, see section B/C below. Several
|
||||
*other* fields are newly inactive since the same date for a different reason — the
|
||||
`TommiG1/HA_VAG-EU-Data-Act` integration they depended on was dropped: `KM_SENSOR`,
|
||||
`TANK_SENSOR`, `RANGE_SENSOR`, `REFRESH_BUTTON`, all door/window/lock sensors, oil-change/
|
||||
inspection sensors. All are configurable again via the new Setup menu, see section C.)
|
||||
- **Robustness:** `profil_lesen()` in `modules/profil.py` does not handle a missing/corrupt
|
||||
`fahrzeugprofil.json` — all callers throw.
|
||||
- **Tests:** only the receipt parser is tested (`data/tests/test_shell_beleg_parser.py`, 10 real
|
||||
@@ -144,6 +152,12 @@ capacitor/iframe/browser (`umgebung.ts`), types + entity table (`types.ts`), fac
|
||||
- `INSTALL.md` step 4 names variables that no longer exist (`DOORS_SENSOR`, `WINDOWS_SENSOR`,
|
||||
`LOCK_ENTITY`, `BATTERY_VOLTAGE_SENSOR`) — actual names: `TUER_SENSOREN`/`FENSTER_SENSOREN`/
|
||||
`TUERSCHLOSS_SENSOREN`/`BATTERIE_SENSOR`.
|
||||
- **(worse than drift, since 2026-08-12)** `INSTALL.md` step 4 and its troubleshooting table
|
||||
still walk through configuring `WLAN_SENSOR` and the `TommiG1/HA_VAG-EU-Data-Act` entities
|
||||
(`KM_SENSOR`, `TANK_SENSOR`, etc.) — both are gone (see section B). A fresh install following
|
||||
this doc today would configure settings that no longer exist and skip `ZUENDUNG_SENSOR`/
|
||||
`STANDORT_TRACKER`, which now actually matter. Needs a real rewrite, not a find-replace — not
|
||||
done yet, flagging so it isn't mistaken for accurate.
|
||||
- `homeassistant/README.md:110` mentions the removed 97% full-tank rule (removal documented in
|
||||
`belegverarbeitung.py:18-20`); the README file list omits 5 pyscript files.
|
||||
- Obsolete comment `belegverarbeitung.py:41` ("TODO: Datei ablegen" — file has long existed).
|
||||
@@ -234,8 +248,33 @@ capacitor/iframe/browser (`umgebung.ts`), types + entity table (`types.ts`), fac
|
||||
self-hosted broker is picked back up later.
|
||||
- [ ] Capture the first real Codec JSON message (`mosquitto_sub`/MQTT Explorer) and build the
|
||||
field mapping from it — **do not guess beforehand** (explicit decision)
|
||||
- [ ] Move trip detection to FMM003 ignition (reuse the `fahrterkennung.py` pattern, keep pause
|
||||
tolerance); then remove `sensor.iphone_wifi_connection` from `einstellungen.py`
|
||||
- [x] Move trip detection to FMM003 ignition — done 2026-08-12. `fahrterkennung.py` rewritten:
|
||||
trigger is now `einstellungen.ZUENDUNG_SENSOR`
|
||||
(`binary_sensor.testzone_fmm003_engine_ignition_or_acc_status`, on = trip running) instead
|
||||
of the iPhone WLAN sensor; same `task.unique()` pause-tolerance pattern kept unchanged.
|
||||
`sensor.iphone_wifi_connection` and the `fahrzeug.wlan_name` profile field are fully removed
|
||||
(backend and frontend). At the same time, all entity IDs sourced from the now-abandoned
|
||||
`TommiG1/HA_VAG-EU-Data-Act` HACS integration were blanked in `einstellungen.py`
|
||||
(`KM_SENSOR`, `TANK_SENSOR`, `RANGE_SENSOR`, `REFRESH_BUTTON`, door/window/lock sensors,
|
||||
oil-change/inspection sensors) — the consuming features (Übersicht tiles, Reifenzähler,
|
||||
automatic Tankerkennung, Fahrtabschluss-Screening) are untouched and degrade gracefully to
|
||||
"unbekannt"/inactive per the existing `zustand_oder_none()` convention, rather than being
|
||||
deleted; `fahrtabschluss.py`/`tankerkennung.py`/`reifenzaehler.py` now guard their
|
||||
`@state_trigger(f"{einstellungen.KM_SENSOR}")`-style decorators with
|
||||
`if einstellungen.KM_SENSOR:` (untested previously whether pyscript tolerates an empty
|
||||
trigger string — not worth relying on). `STANDORT_TRACKER` now points at the real
|
||||
`device_tracker.testzone_fmm003` and `BATTERIE_SENSOR` at
|
||||
`sensor.testzone_fmm003_external_power_voltage` (the vehicle's 12V bus voltage as measured
|
||||
by the tracker — NOT `sensor.testzone_fmm003_battery_voltage`, which is the tracker's own
|
||||
internal backup cell and unrelated to the car). Real entity list for this device: the user's
|
||||
`Entiaeten.csv` export (OneDrive, not in this repo). Verified in `audi_ha_test`: pyscript
|
||||
reload (`pyscript.reload`) produced no errors/warnings for any of the changed files; the
|
||||
Übersicht correctly shows "Status unbekannt" and em-dash placeholders for the now-blank VAG
|
||||
fields instead of crashing (that container itself has no `device_tracker.testzone_fmm003`
|
||||
registered, so Standort still shows "Kein GPS-Signal" there — expected, the real HA instance
|
||||
has it). **Follow-up still needed:** `INSTALL.md` step 4 and its troubleshooting table still
|
||||
document the old WLAN/TommiG1 entity list — now actively wrong, not just stale (see
|
||||
Documentation drift below).
|
||||
|
||||
### C) Maintain the existing HA panel (low priority — being replaced)
|
||||
|
||||
@@ -276,6 +315,36 @@ capacitor/iframe/browser (`umgebung.ts`), types + entity table (`types.ts`), fac
|
||||
a few seconds in the `audi_ha_test` container (no crash, stays on "Adresse wird ermittelt …"
|
||||
indefinitely) — likely just that container's outbound network to Nominatim specifically;
|
||||
unconfirmed whether this reproduces on the real HA instance.
|
||||
- [x] Setup menu (Einstellungen → Fahrzeug einrichten → last item when expanded) — done
|
||||
2026-08-12. Lets the user map every sensor role the app uses (~18 roles, 3 of them 4-item
|
||||
door/window/lock lists) to real HA entities from a searchable dropdown, instead of hand-
|
||||
editing `einstellungen.py`. New backend module `pyscript/modules/entitaeten.py`: a
|
||||
`FELDER` catalog (label, hint, expected domain/device_class/unit, keywords, whether it's
|
||||
one of the trigger-bound fields) plus JSON override I/O (`data/entitaeten.json`, same
|
||||
atomic-write pattern as `profil.py`) and `overrides_anwenden()`, which does
|
||||
`setattr(einstellungen, key, value)` on the already-imported `einstellungen` module — every
|
||||
existing consumer does `import einstellungen` + live attribute access (verified: none use
|
||||
`from einstellungen import X`), so this needs no changes to any consumer file. New service
|
||||
`audi_dashboard_entitaeten_schreiben` (`frontend_api.py`) and publication
|
||||
`entitaeten_veroeffentlichen()` (`frontend_veroeffentlichung.py`) follow the project's
|
||||
existing read-via-state/write-via-service pattern. Frontend: new popup (`vSetupPopup()`,
|
||||
modeled on the existing `.sheet` pattern) with a from-scratch searchable-combobox component
|
||||
(none existed in the repo before) — client-side only, built directly from `HASS.states`, no
|
||||
new backend read service; a global "Nur passende Sensoren anzeigen" switch hard-filters
|
||||
candidates by domain/unit, a keyword+domain+unit score ranks and auto-suggests for empty
|
||||
fields. Deliberately does NOT auto-apply changes for the three trigger-bound fields
|
||||
(`ZUENDUNG_SENSOR`/`KM_SENSOR`/`TANK_SENSOR` — `@state_trigger` bakes the entity ID in at
|
||||
module-load time) — the UI shows an inline "wirkt erst nach Neustart" hint instead of
|
||||
attempting a risky self-`pyscript.reload()` from inside a running service call. Two real
|
||||
bugs found and fixed during live verification, both now also pushed to the Claude Design
|
||||
project: (1) a full popup re-render on every keystroke fought the search input for focus —
|
||||
fixed by patching just the candidate-list DOM node on `input`, matching the same fix the
|
||||
existing `data-tankpreisfeld` handler already uses for the identical reason; (2) the popup
|
||||
background used `--tile-2`, which Design had since changed to a translucent
|
||||
`rgba(255,255,255,.1)` in the night theme (for the frosted-glass tile look elsewhere) — made
|
||||
the whole popup partially see-through against the app content behind it. Fixed by switching
|
||||
to `--tile-deckend` (Design's own opaque-surface token, already used by `.standortmenu` for
|
||||
the same reason), with `var(--canvas)` as a defensive fallback.
|
||||
- [ ] Fix documentation drift (statistics claim, INSTALL variable names, README gaps, obsolete
|
||||
TODO comment) — text-only changes
|
||||
- [ ] Harden `profil_lesen()` against missing/corrupt `fahrzeugprofil.json`
|
||||
|
||||
Reference in New Issue
Block a user