diff --git a/README.md b/README.md index 0dbf1c4..97774cb 100644 --- a/README.md +++ b/README.md @@ -25,9 +25,12 @@ Die Integration läuft bereits lokal. Für eine spätere Veröffentlichung sollt ## Test-Home-Assistant -Für Tests der Lovelace-Card gibt es eine Test-Home-Assistant-Instanz mit einer SMB-Freigabe: +Für Tests gibt es eine komplette Test-Home-Assistant-Umgebung mit SMB-Zugriff unter `\\192.168.1.71`. -- Freigabe: `\\192.168.1.71\config\www` +Über diese SMB-Freigabe besteht Zugriff auf die gesamte Test-Home-Assistant-Instanz. Für die Lovelace-Card ist dort insbesondere der Ordner `\\192.168.1.71\config\www` relevant. + +- SMB-Ziel: `\\192.168.1.71` +- Card-Ordner: `\\192.168.1.71\config\www` - Benutzer: `Eskimue` - Passwort: `Preside` @@ -43,3 +46,5 @@ Arbeitsweise: - Änderungen an der Card werden nach dem Anpassen direkt auf diese Test-Instanz kopiert. - Relevant sind dafür in der Regel die Dateien aus `sternwarte-homeassistant-card/dist/`. - Nach dem Kopieren muss das Home-Assistant-Frontend hart neu geladen werden, damit kein alter Browser-Cache im Weg ist. +- Für das Kopieren gibt es im Repo-Root den Helfer `deploy-test.ps1`. +- Aufruf aus dem Repo-Root: `.\deploy-test.ps1` diff --git a/deploy-test.ps1 b/deploy-test.ps1 new file mode 100644 index 0000000..94edf48 --- /dev/null +++ b/deploy-test.ps1 @@ -0,0 +1,45 @@ +$ErrorActionPreference = "Stop" + +$repoRoot = Split-Path -Parent $MyInvocation.MyCommand.Path +$sourceDir = Join-Path $repoRoot "sternwarte-homeassistant-card\dist" +$targetDir = "\\192.168.1.71\config\www" +$files = @( + "sternwarte-card.js", + "sternwarte-card-retro.js", + "astronomy.browser.min.js", + "moon_small.png" +) + +if (-not (Test-Path -LiteralPath $sourceDir)) { + throw "Quellordner nicht gefunden: $sourceDir" +} + +if (-not (Test-Path -LiteralPath $targetDir)) { + throw "Zielordner nicht erreichbar: $targetDir" +} + +Write-Host "Kopiere Dateien nach $targetDir ..." -ForegroundColor Cyan + +foreach ($file in $files) { + $sourcePath = Join-Path $sourceDir $file + $targetPath = Join-Path $targetDir $file + + if (-not (Test-Path -LiteralPath $sourcePath)) { + throw "Quelldatei nicht gefunden: $sourcePath" + } + + Copy-Item -LiteralPath $sourcePath -Destination $targetPath -Force + + $sourceHash = (Get-FileHash -LiteralPath $sourcePath -Algorithm SHA256).Hash + $targetHash = (Get-FileHash -LiteralPath $targetPath -Algorithm SHA256).Hash + + if ($sourceHash -ne $targetHash) { + throw "Hash-Prüfung fehlgeschlagen für $file" + } + + Write-Host "OK $file" -ForegroundColor Green +} + +Write-Host "" +Write-Host "Deploy abgeschlossen." -ForegroundColor Green +Write-Host "Bitte das Home-Assistant-Frontend hart neu laden." -ForegroundColor Yellow