Files
audi-app/homeassistant/installationspaket/Installieren.cmd
T
tobias 484f2ffe6d Add one-click installer to installationspaket
Installieren.cmd (double-click) wraps install.ps1, which automates steps 1-3
of ANLEITUNG.md: find the HA config share, copy pyscript/, data/ ->
audi_dashboard/ and www/, merge the configuration.yaml snippet, optionally
write ha_token.txt. The .cmd wrapper exists because double-clicking a .ps1
opens it in an editor and the execution policy blocks it; the bypass applies
to that one call only.

Designed to be safe to re-run:
- Never overwrites fahrzeugprofil.json, fahrten.jsonl, tankvorgaenge.jsonl,
  entitaeten.json or ha_token.txt, so re-running on a live install keeps the
  vehicle profile, trips, fills and sensor mapping.
- configuration.yaml is backed up to .bak first; the inserted part sits
  between marker lines and gets replaced instead of appended twice.
- If pyscript: or panel_custom: are already there from another source, the
  file is left untouched and the script prints what to merge by hand -
  duplicate top-level keys would be invalid YAML and HA would not start.
- Aborts before writing if the target has no configuration.yaml.

Steps that cannot be automated from a Windows share (HA restart, pip install
pypdf, sensor mapping) are collected into a closing to-do list. -Pruefen shows
what would happen without writing.

install.ps1 is stored UTF-8 *with* BOM - PowerShell 5.1 reads scripts as ANSI
otherwise and mangles the umlauts; the files it writes stay BOM-less.

Verified against a fake config tree: fresh install, re-run idempotency,
existing-data preservation, foreign-key refusal, wrong-directory abort, and
the merged configuration.yaml parses as valid YAML.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-08-16 13:02:02 +02:00

27 lines
1.0 KiB
Batchfile

@echo off
REM ---------------------------------------------------------------------------
REM Mein Audi (DataMetric360) - Installation per Doppelklick.
REM
REM Existiert, weil ein Doppelklick auf eine .ps1 sie NICHT ausfuehrt, sondern
REM im Editor oeffnet - und die Ausfuehrungsrichtlinie sie zusaetzlich blockt.
REM Dieser Wrapper startet install.ps1 mit -ExecutionPolicy Bypass, gilt aber
REM nur fuer diesen einen Aufruf: die Einstellung des Systems bleibt, wie sie
REM ist. Deshalb hier -File und kein Herunterschrauben per Set-ExecutionPolicy.
REM ---------------------------------------------------------------------------
setlocal
cd /d "%~dp0"
powershell -NoProfile -ExecutionPolicy Bypass -File "%~dp0install.ps1" %*
set FEHLER=%ERRORLEVEL%
echo.
if not "%FEHLER%"=="0" (
echo Die Installation wurde mit einem Fehler abgebrochen ^(Code %FEHLER%^).
echo Die Meldung darueber sagt, woran es lag.
echo.
)
REM Fenster offen halten - sonst ist die Ausgabe beim Doppelklick sofort weg.
pause
endlocal
exit /b %FEHLER%