Files
audi-app/homeassistant/installationspaket/update.ps1
T
tobias fb38c297bd Station name as "brand, street, city", grey box on all editable fields
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>
2026-08-16 12:52:31 +02:00

91 lines
4.2 KiB
PowerShell

<#
.SYNOPSIS
Spielt Code-Updates (pyscript + Frontend) in eine laufende Home-Assistant-
Installation ein, ohne Neustart und ohne Cache-Probleme im Browser.
.BESCHREIBUNG
Kopiert nur Code, nie Daten:
- pyscript/* -> <Ziel>/pyscript/ (pyscript lädt das automatisch neu,
siehe Kopfkommentar dort - an
einer Testinstanz bestätigt: eine
geänderte Datei war innerhalb von
Millisekunden aktiv, ganz ohne
Neustart)
- www/*.js, www/*.css, www/badges/*, www/bilder/* -> <Ziel>/www/
(audi-dashboard-ios.css nicht vergessen: die App hängt sich dieses
Overlay-Stylesheet selbst per JS in den Shadow-Root - ohne es fehlt
nur der optische Feinschliff, kein Fehler, aber ein veralteter Stand)
- www/audi-dashboard-version.json wird IMMER neu geschrieben, mit der
aktuellen Uhrzeit als Versionsnummer - der Lade-Stub
(audi-dashboard-panel.js) liest diese Datei bei jedem Seitenaufruf
ohne Cache und lädt den eigentlichen Code darüber immer frisch nach
(siehe Kopfkommentar in www/audi-dashboard-panel.js).
Absichtlich NICHT kopiert: die Datenbestände in data/ - das würde ein
bereits laufendes Fahrzeugprofil, die Fahrten- und Tankvorgänge-Archive
sowie die Sensor-Zuordnung überschreiben. Diese Dateien sind nur die
Erstbefüllung für die einmalige Installation (siehe INSTALL.md Schritt 2).
Eine Ausnahme davon ist shell_beleg_parser.py: die Datei liegt zwar in
data/, ist aber Code, kein Datenbestand - belegverarbeitung.py ruft sie
als Unterprozess aus /config/audi_dashboard/ auf. Ohne diese Ausnahme
käme jede Änderung am Belegleser (dem einzigen getesteten Teil des
Projekts) auf keiner Instanz an.
.PARAMETER Ziel
Pfad zum config-Verzeichnis von Home Assistant, z. B. ein per Samba
eingebundenes Laufwerk (\\<HA-IP>\config) oder ein lokal gemounteter Pfad.
.BEISPIEL
.\update.ps1 -Ziel "\\homeassistant.local\config"
#>
param(
[Parameter(Mandatory = $true)]
[string]$Ziel
)
$ErrorActionPreference = "Stop"
$hier = $PSScriptRoot
if (-not (Test-Path $Ziel)) {
throw "Ziel nicht erreichbar: $Ziel — Samba-Share verbunden? Pfad korrekt?"
}
Write-Host "Kopiere pyscript/ ..." -ForegroundColor Cyan
robocopy "$hier\pyscript" "$Ziel\pyscript" /MIR /NFL /NDL /NJH /NJS | Out-Null
Write-Host "Kopiere www/ (ohne bilder/ und badges/, die separat behandelt werden) ..." -ForegroundColor Cyan
New-Item -ItemType Directory -Force -Path "$Ziel\www" | Out-Null
Copy-Item "$hier\www\audi-dashboard-app.js" "$Ziel\www\audi-dashboard-app.js" -Force
Copy-Item "$hier\www\audi-dashboard-panel.js" "$Ziel\www\audi-dashboard-panel.js" -Force
Copy-Item "$hier\www\audi-dashboard.css" "$Ziel\www\audi-dashboard.css" -Force
Copy-Item "$hier\www\audi-dashboard-ios.css" "$Ziel\www\audi-dashboard-ios.css" -Force
# Code, der in data/ liegt (siehe Kopfkommentar) - der Ordner selbst wird
# bewusst nicht gespiegelt, diese eine Datei aber schon.
if (Test-Path "$Ziel\audi_dashboard") {
Copy-Item "$hier\data\shell_beleg_parser.py" "$Ziel\audi_dashboard\shell_beleg_parser.py" -Force
Write-Host " Belegleser aktualisiert"
}
if (Test-Path "$hier\www\bilder") {
Write-Host "Kopiere www/bilder/ ..." -ForegroundColor Cyan
New-Item -ItemType Directory -Force -Path "$Ziel\www\bilder" | Out-Null
Copy-Item "$hier\www\bilder\*" "$Ziel\www\bilder\" -Force -Recurse
}
if (Test-Path "$hier\www\badges") {
Write-Host "Kopiere www/badges/ ..." -ForegroundColor Cyan
New-Item -ItemType Directory -Force -Path "$Ziel\www\badges" | Out-Null
Copy-Item "$hier\www\badges\*" "$Ziel\www\badges\" -Force -Recurse
}
$version = [DateTimeOffset]::UtcNow.ToUnixTimeSeconds()
"{ ""version"": $version }" | Out-File -FilePath "$Ziel\www\audi-dashboard-version.json" -Encoding utf8 -NoNewline
Write-Host ""
Write-Host "Fertig. Version $version." -ForegroundColor Green
Write-Host "pyscript-Änderungen sind bereits aktiv (Auto-Reload, kein Neustart nötig)."
Write-Host "Frontend-Änderungen: im Browser einmal ganz normal neu laden (F5) reicht -"
Write-Host "kein Hard-Refresh, kein HA-Neustart."