Commit graph

16 commits

Author SHA1 Message Date
oskar 09624e008e feat(ha/ken): porzadki po audycie — pimirror z archiwum, konwencje, backlog
Odtworzone graceful shutdown pimirror (audyt pkt 14, jedyna realna strata
migracji): nowa automatyzacja "Pimirror: graceful shutdown przed odcieciem
zasilania" (1785164185794.yaml) wciska przycisk shutdown przed twardym
cieciem zasilania o 23:35, dajac istniejacemu ACK-flow ("Magic Mirror OFF on
ACK") szanse zamknac Pi grzecznie zamiast zawsze odcinac prad na sile.
Zaadaptowane wzgledem legacy: entity_id zamiast device automation, oryginalna
encja button.rpi_pimirror_* jest dziś unavailable — uzyto aktualnej
button.rpi_pimirror2_* (potwierdzone w storage-export/ken).

Spisana konwencja na przyszlosc (audyt pkt 17) w DESIGN.md: entity_id zamiast
device automations, alias PL z prefiksem funkcjonalnym, description z
"managed-by: repo" — bez hurtowej migracji istniejacych automatyzacji.

Backlog: deploy.sh --delete (kasacje wspolnym torem dry-run/LIVE zamiast
recznych curl DELETE) i brakujacy trigger na zmiane input_number.klima_salon_tolerancja
w automatyzacji ON klimy.

Walidacja: normalizator round-trip (byte-identical), 4 pakiety testow offline
(normalize/split/deploy_api/import_api) pass, dry-run deploy.sh na zywym ken
(check_config valid, brak driftu) — bez LIVE deployu.
2026-07-27 17:51:39 +02:00
oskar 36b43e5c9c drift(ken): kasacje po audycie pkt 10 — para Tymka, powitanie test, notify router, para prototyp 2026-07-27 16:51:30 +02:00
oskar f09dcbf10d fix(ha/ken): fix-pack 1 po audycie — alerty wodne, respekt manual, 3am punktowo, klima OFF za auto
Zmiany wyłącznie w repo (config/ken/ automations), deploy LIVE robi operator.

- 1752086407230 "dry in Kuchnia": trigger moist -> not_moist (kopiuj-wklej z
  "moist in Kuchnia", "sucho" nigdy nie przyjdzie).
- 1752085965483 "dry in Lazienka": literówka mesaage -> message (skrypt
  notify_email_ntfy dostawał niezdefiniowane message, akcja się wykładała).
- 1764190493305 "after 15 minutes anyway": dodany warunek stanu
  automation.turn_off_lights_in_kuchania == on, żeby respektować ręczne
  "Disable AUTO off" (double-click) zamiast unieważniać je po 15 minutach.
- 1700832676138 "unconditionally at 3am": time_pattern hours: '3' (60
  odpaleń/noc) -> punktowy trigger time: 03:00:00, zgodnie z intencją aliasu.
- 1784804668795 "Klima salon: wyłącz...": dodany warunek
  input_boolean.klima_salon_auto == on dla gałęzi sunset/balkon (automat
  ubija tylko chłodzenie, którym sam zarządza — ręczne chłodzenie przy
  zgaszonym auto zostaje nietknięte). Trigger auto_off (zgaszenie
  klima_salon_auto) ma osobną gałąź choose bez tego warunku — graceful
  shutdown suszenia parownika działa nawet gdy przełącznik właśnie zgasł.
  Zweryfikowano na żywym ken: helpery klimy istnieją (input_boolean.
  klima_salon_auto=off, input_number.klima_salon_temp_docelowa=24.0,
  input_number.klima_salon_tolerancja=3.0).

DESIGN.md: nowa sekcja "Decyzje operatora po audycie 2026-07-23" — co
zaimplementowane, co świadomie odłożone (enforcer sleep mode + konsolidacja
nocnych wyłączników -> projekt night_mode; OwnTracks / Leave batch 02 / alerty
on-leave -> bez zmian).

docs/backlog.md: cztery nowe wpisy w Aktywne — guard TRV przed sezonem
grzewczym, przycisk graceful shutdown klimy na dashboard, diagnoza wspólnej
awarii sprzętowej 2026-07-17 (czujniki ruchu + pilot 4button + xiaomi_miot),
projekt architektura night_mode.

Walidacja: round-trip scripts/ha/lib/normalize.py na wszystkich 5 zmienionych
plików (stabilny), 4 zestawy testów offline scripts/ha/tests/*.sh (wszystkie
PASS), dry-run scripts/ha/deploy.sh ken --dry-run per plik na żywym ken
(wszystkie: check_config valid, brak driftu, brak abortu).

Choinkowe automatyzacje (audyt 4.2) celowo nietknięte w plikach — disable to
stan runtime, nie config; operator wyłączy je przez UI.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-07-23 17:17:38 +02:00
oskar f0e9533025 docs(ha): audyt automatyzacji ken 2026-07-23
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-23 16:16:58 +02:00
oskar f3328d2c75 drift(ken): helpers klimy salonowej (input_* utworzone w UI) + swieze fixtures 2026-07-23 16:12:52 +02:00
oskar faa2e2a60b fix(ha/ken): klima salon — gałąź start sprawdza próg temperatury, nie tylko trigger
Trigger progowy (template) był jedynym miejscem sprawdzania progu; każdy
inny trigger brzegowy (balkon > salon, sunrise, input_boolean on, koniec
suszenia) omijał go i startował cool poniżej progu. Dowód z produkcji
2026-07-23 ~14:57: start w cool przy 23.6°C (próg 27). Gałąź start dostaje
warunek template będący lustrem triggera progowego.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-23 15:03:07 +02:00
oskar 050be7f922 fix(ha/ken): klima salon — domkniecie po suszeniu + 15min karencja balkonowa 2026-07-23 13:49:33 +02:00
oskar e49ae9055f feat(ha/ken): automatyka klimy w salonie (prog + suszenie parownika) 2026-07-23 13:06:08 +02:00
oskar 57a5f66d0d fix(ha/ken): alias Gniadka -> Gniazdka 2026-07-23 12:35:56 +02:00
oskar 4366cdb871 drift(ken): HA znormalizowal legacy schema (trigger->triggers, service->action) po pierwszym pelnym deployu 2026-07-22 18:48:31 +02:00
oskar adeed6b902 feat(ha): deploy.sh — api write path with drift-abort and verify 2026-07-22 18:31:22 +02:00
oskar 1b48fad451 feat(ha): initial import of ken instance config
First production run of the api adapter against ken (192.168.31.7,
HAOS): 118 automations, 5 scripts, 3 scenes, 7 dashboards (default + 6
named — one registered dashboard was never configured, config_not_found,
reported not fatal), area/entity registries, and 5 input_* helper
domains present on this instance.
2026-07-22 18:07:26 +02:00
oskar 5b9111afa7 feat(ha): api adapter for import.sh
ken is HAOS (no SSH/docker exec path), so it needs a REST/WebSocket-only
adapter: automations/scripts/scenes via one GET per
/api/config/<domain>/config/<id>, dashboards/area+entity registries/
input_* helpers via the HA WebSocket API (read-only commands only).

scripts/ha/lib/ha_api.py and ha_ws.py never take a token as a value —
only a token_path, read from disk in-process — so the bearer token never
touches a subprocess argv or a log line. ha_ws.py depends on the optional
websocket-client package and raises a clear, actionable ImportError if
it's missing rather than a raw traceback; import.sh still completes the
REST-only part of the import in that case.

Automations/scripts/scenes reuse split.write_split() so both adapters
produce byte-identical config/<instance>/ layouts and the same
idempotent stale-file cleanup on re-run.

docker-exec adapter logic is untouched.
2026-07-22 18:07:26 +02:00
oskar 970b8cc023 feat(ha): archival import of ken-legacy config
Read-only import of the pre-migration homeassistant5 container (piha),
per DESIGN.md phase-0 scope: 60 automations (split one-file-per-id),
5 scenes, 1 script, plus curated .storage/* export (area/entity
registries, input_boolean/input_text, lovelace dashboards).

No token at ~/.config/ha-deploy/ken-legacy.token — fixtures step
fail-softed as designed, no repo import.sh changes needed. Verified:
gitignore-excluded paths (secrets.yaml, *.db*, logs, .storage/auth*,
core.restore_state, tts/, deps/, backups/, .cloud/) correctly stripped
from the pull; three consecutive import.sh runs produced byte-identical
output under config/ken-legacy/ and storage-export/ken-legacy/
(idempotent); automation count matches the 2026-07-22 recon estimate
(~60) exactly. README.md only touched to note the import date.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-07-22 16:49:09 +02:00
oskar 77d55caf07 feat(ha): cutover ken to 31.7 HAOS, archive legacy container instance
instances.yaml pointed "ken" at the piha container (homeassistant5), a
pre-migration instance that never actually stopped running — it kept
firing automations in parallel with the real home instance (HAOS on a
dedicated RPi4, 192.168.31.7), causing duplicate triggers on shared
buttons/scenes. Repoint ken to the real instance (api adapter),
demote the container to ken-legacy (archived, import-only, never a
deploy target), and log the incident in DESIGN.md.
2026-07-22 16:17:18 +02:00
oskar ee48319a86 feat(ha): skeleton for Home Assistant configs-as-code subproject
Structure only, no deploy path: DESIGN.md decision registry (phasing,
per-instance adapter, bidirectional sync with drift-abort on deploy,
reload-vs-restart gating, token handling), instances.yaml (ken/piha via
docker-exec, chelsty-ha via api), config/storage-export/fixtures dirs,
and a read-only scripts/ha/import.sh (docker-exec adapter only) with a
canonical YAML normalize+split library and an offline determinism test.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-07-21 15:29:39 +02:00