Commit Graph

220 Commits

Author SHA1 Message Date
Dusan Vojacek
29d854f23d Bazén vizualizace + EV Discord notifikace po příjezdu (fáze A)
Some checks failed
CI and deploy / deploy (push) Has been cancelled
CI and deploy / migration-check (push) Has been cancelled
- R__097: vw_latest_pool_pump + vw_pool_pump_day_energy (denní kWh z delty
  čítače, minuty běhu) + ems_anon granty
- PoolCard na Dashboardu: stav/W/dnešní kWh+hodiny/7denní mini sloupce
- _notify_ev_arrival_plan: po příjezdu EV Discord souhrn (SoC auta → cíl,
  deadline, nabíjecí okna shlukovaná ze slotů aktivního plánu, ø cena)
- docs/discord-ev-interaction.md: fáze B (bot s tlačítky přes gateway —
  žádný veřejný endpoint; čeká na DISCORD_BOT_TOKEN od uživatele)
- docs: pool-shelly + ev-charging aktualizovány (pravidlo docs 1:1)

První commit na dev větvi (nová kadence: deploy až s milníkovým merge).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-12 10:59:09 +02:00
Dusan Vojacek
ab17e86900 Dokumentace: noc 11.→12. 6. — v2 aktivní, robustnostní trojice, EV forecast, CI opravy
Some checks failed
CI and deploy / migration-check (push) Successful in 16s
CI and deploy / deploy (push) Has been cancelled
- planning-changelog.md: záznam 2026-06-12 (přepnutí na v2, noční polštář /
  PV front-load / denní rampa s tabulkou, EV usage forecast, zimní posouzení)
- planning.md: default PLANNING_ENGINE_VERSION=v2 + sekce robustnosti
- refactor-clean-planner.md: Fáze 3 = v2 AKTIVNÍ
- ev-charging.md: EV spotřební forecast (sběr/statistiky/aktivace)
- consumption.md: bazál odečítá bazén
- deployment-self-hosted.md: tři CI vady + self-install deploy.sh + stop před flyway

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-12 10:37:20 +02:00
Dusan Vojacek
02c35f8add Merge: bazénové čerpadlo přes Shelly (telemetrie + signal ovládání)
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-12 00:12:43 +02:00
Dusan Vojacek
60176fc7b2 Tesla Fleet API: čtení SoC po příjezdu k wallboxu
All checks were successful
CI and deploy / deploy (push) Successful in 58s
CI and deploy / migration-check (push) Successful in 16s
- services/tesla_client.py: access token s cache + ROTACE refresh tokenu do
  ems.tesla_token (env jen seed — Tesla refresh token je jednorázový),
  vehicles → vehicle_data?endpoints=charge_state, 408 (spící auto) = tiché
  přeskočení, výběr vozidla dle VIN / jediného na účtu (VIN se auto-naučí)
- hook _patch_session_from_tesla v _on_ev_arrival: PŘED replanem doplní
  soc_at_connect_pct (+ target z charge_limit_soc) do otevřené session přes
  fn_ev_session_apply_patch (rozšířena o soc_at_connect_pct) — energii si
  odvodí fn_planning_site_context (SQL-first); selhání neblokuje replan
- V086: asset_vehicle.vin, api_type='tesla' pro tesla-my (Model Y, home-01),
  singleton ems.tesla_token; R__095: fn_tesla_token_get/upsert,
  fn_tesla_arrival_context, fn_vehicle_set_vin
- config: TESLA_CLIENT_ID/SECRET/REFRESH_TOKEN (prázdné = vypnuto)
- testy parserů; plná sada beze změny

Aktivace: env do /opt/ems-deploy/.env + recreate backendu (docs/tesla-fleet-api.md §Stav).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-11 23:29:24 +02:00
Dusan Vojacek
620cea8b9b Tesla Fleet API: příprava domény ems.vojacek.eu (cert + public key + callback)
All checks were successful
CI and deploy / migration-check (push) Successful in 33s
CI and deploy / deploy (push) Successful in 1m30s
Doména slouží jen jako veřejná vizitka pro Tesla: Caddy blok vystavuje POUZE
.well-known public key a statickou OAuth callback stránku (zobrazí ?code=,
nic neodesílá), vše ostatní 404 — EMS zůstává na VPN. Certifikát Let's Encrypt
řeší hostovský Caddy automaticky.

deploy/tesla/setup_tesla_domain.sh (spustit NA SERVERU): EC keypair prime256v1
(privátní do /opt/ems-deploy/secrets 0600), public do .well-known, callback,
vypíše Caddy blok. docs/tesla-fleet-api.md: developer portál, partner
registrace, OAuth flow, plán EMS integrace (tesla_client + hook v _on_ev_arrival).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-11 22:58:28 +02:00
Dusan Vojacek
cf663ae417 Docs: pool-shelly — architektura, šablony seedů, návrh solver integrace
- šablona insertů endpoint/asset/signal_route (placeholdery IP, výkon, runtime)
- tok ovládání přes fn_signal_enqueue_bool a signal_service
- návrh pool[t] binárky analogicky hp[t] s denním runtime constraintem
- checklist oživení, otevřené otázky (sezónnost, bazál, UI)

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-06-11 22:37:57 +02:00
Dusan Vojacek
5239463699 EV telemetrie: skutečné čtení Teltonika TeltoCharge (konec stub-u)
Some checks failed
CI and deploy / migration-check (push) Failing after 23s
CI and deploy / deploy (push) Has been skipped
poll_ev_chargers četl placeholder ('available'/0 W) — EV spotřeba se nikdy
neodečítala z bazálu a session detekce nefungovala. Nyní: blok registrů 0-40
jedním FC 3 (oficiální protokol rev 0.5), parse_teltocharge_frame (status z
reg 6 → available/preparing/charging/..., výkon reg 38, energie session reg 39,
proud max L1-L3 reg 3-5). Při selhání čtení se vzorek NEzapisuje (fabrikovaný
available by falešně ukončoval session).

fn_telemetry_ev_charger_sample: + p_current_a (drop staré 7-arg signatury).
6 nových testů parseru; plná sada beze změny. Docs: modbus-registers-teltocharge.md.

Po deployi: home-01 ev-charger-1/2 začnou posílat reálná data; bazál se začne
čistit od EV (EMA 00:30); rebuild stats má smysl až po ~2 týdnech čisté historie.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-11 22:10:46 +02:00
Dusan Vojacek
53e9afb513 Investiční studie v2: POTENCIÁLNÍ výroba místo telemetrie (škrcení 81 %!)
Klíčová oprava (postřeh uživatele): při sell<0 lokality škrtí výrobu
(reg 340 / GEN cutoff) — telemetrie ukázala 357 kWh, predikce 1879 kWh
(96 % minut v derating). Studie nyní používají max(skutečnost, kanonický
forecast per pole) v sell<0 slotech.

Nové výsledky (horní meze): BA81 32 kWh +35/+46 Kč/den (výkon 6.25/12 kW);
KV1 25 kWh +20/+22 Kč/den (stará smlouva); HU1 fixní: 75 Kč/den bez sdílení,
149 Kč/den s EDC sdílením @1.5 Kč distribuce (sdílitelných ~49 kWh/den!);
HU1 spot: 372 Kč/den, sdílení +0. + docs/onboarding-wallbox-tc-2026-06.md.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-11 17:24:49 +02:00
Dusan Vojacek
ad4b52c9ce Dokumentace refaktoru a delta-triage skill
- docs/refactor-clean-planner.md: plán Fází 0-4, stav, závazná pravidla
  (golden gate), návod nasazení v2 (shadow → vyhodnocení → přepnutí)
- docs/planning-changelog.md: záznam 2026-06-11 (Fáze 0-3 kompletní)
- docs/04-modules/planning.md: sekce Verze enginu v1/v2 + env flagy
- docs/audits/*: stav implementace FE fixů
- .claude/skills/ems-delta-triage: postup triáže neekonomického chování
  (realita vs plán vs shadow peer vs oracle, verdikt s Kč)
- CLAUDE.md: ukazatele na refaktor, solver_v2 a delta-triage v 'Kde hledat co'

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-11 14:45:16 +02:00
Dusan Vojacek
368291e562 Audity frontendu: výkon + responsivita (2026-06-11)
Výkon: dominují DB read-modely — fn_plan_current_bundle 3.8 s,
fn_site_full_status 1.7 s (měřeno na živé DB); dále payloady, polling,
chybějící virtualizace Planning tabulky, bundle 1.2 MB bez chunking.
Responsivita: pevné výšky grafů, tooltip × StatePanel/tabulka kolize na touch,
StatePanel grid, breakpointy. Plné detaily a fixy v docs/audits/.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-11 14:15:02 +02:00
Dusan Vojacek
edc8ae9774 prej final final v2 verze
Some checks failed
CI and deploy / migration-check (push) Failing after 15s
CI and deploy / deploy (push) Has been skipped
2026-06-07 00:05:46 +02:00
Dusan Vojacek
50ac40868d fakt me to nebavi furt jsou tam chyby
Some checks failed
CI and deploy / migration-check (push) Failing after 12s
CI and deploy / deploy (push) Has been skipped
2026-06-06 23:58:01 +02:00
Dusan Vojacek
b7903db714 dasli fix
Some checks failed
CI and deploy / migration-check (push) Failing after 23s
CI and deploy / deploy (push) Has been skipped
2026-06-06 23:47:12 +02:00
Dusan Vojacek
3ad5bec76b aa zas oprava
Some checks failed
CI and deploy / migration-check (push) Failing after 13s
CI and deploy / deploy (push) Has been skipped
2026-06-06 23:25:36 +02:00
Dusan Vojacek
37df01d43c dalsi fix
Some checks failed
CI and deploy / migration-check (push) Failing after 15s
CI and deploy / deploy (push) Has been skipped
2026-06-06 23:12:08 +02:00
Dusan Vojacek
3161421d5c skill pro debug
Some checks failed
CI and deploy / migration-check (push) Failing after 15s
CI and deploy / deploy (push) Has been skipped
2026-06-06 22:41:56 +02:00
Dusan Vojacek
36cb06b9d0 Branch 5: dynamický terminal SoC factor při future neg buy
Some checks failed
CI and deploy / migration-check (push) Failing after 15s
CI and deploy / deploy (push) Has been skipped
2026-06-06 22:38:05 +02:00
Dusan Vojacek
0f7dc6ed94 Branch 4: BA81 GEN cutoff audit + exekuce při sell<0
Some checks failed
CI and deploy / migration-check (push) Failing after 14s
CI and deploy / deploy (push) Has been skipped
2026-06-06 22:36:27 +02:00
Dusan Vojacek
a7879f1141 Branch 3: charge-slot-budget v R__063 + odstranit v58 pro BA81/KV1 + fixed evening push
Some checks failed
CI and deploy / migration-check (push) Failing after 25s
CI and deploy / deploy (push) Has been skipped
2026-06-06 22:32:48 +02:00
Dusan Vojacek
09bca0a903 Branch 2: home-01 neg-večer — export k reserve_soc, fix pos_sell_pre_neg_buy + oddělit evening_push od prep relax
Some checks failed
CI and deploy / migration-check (push) Failing after 13s
CI and deploy / deploy (push) Has been skipped
2026-06-06 22:28:48 +02:00
Dusan Vojacek
2a963c9793 Branch 1: failed run journal + bisect Infeasible + granulární relaxace (bez vypnutí evening push)
Some checks failed
CI and deploy / migration-check (push) Failing after 14s
CI and deploy / deploy (push) Has been skipped
2026-06-06 22:23:59 +02:00
Dusan Vojacek
1429d402e5 zdokumentovani noveho pohleud na planovani nabijeni
Some checks failed
CI and deploy / migration-check (push) Failing after 13s
CI and deploy / deploy (push) Has been skipped
2026-06-01 19:53:04 +02:00
Dusan Vojacek
d44a2cbb44 dalsi
Some checks failed
CI and deploy / migration-check (push) Failing after 22s
CI and deploy / deploy (push) Has been skipped
2026-06-01 19:20:27 +02:00
Dusan Vojacek
96adbff9ea nakup ve spicce aby prodal lenvneji, ale nemam jak otestovat poac uz bude po slotu (home01)
Some checks failed
CI and deploy / migration-check (push) Failing after 34s
CI and deploy / deploy (push) Has been skipped
2026-06-01 19:17:55 +02:00
Dusan Vojacek
63eff96c5f zas oprava KV1 a BA81
Some checks failed
CI and deploy / migration-check (push) Failing after 41s
CI and deploy / deploy (push) Has been skipped
2026-06-01 19:04:11 +02:00
Dusan Vojacek
0dcf11d471 oprava ranniho nenabijeni
Some checks failed
CI and deploy / migration-check (push) Failing after 50s
CI and deploy / deploy (push) Has been skipped
2026-06-01 18:50:03 +02:00
Dusan Vojacek
430e081841 oprave vercerniho nevyprodeje
Some checks failed
CI and deploy / migration-check (push) Failing after 26s
CI and deploy / deploy (push) Has been skipped
2026-06-01 18:24:57 +02:00
Dusan Vojacek
5d06f49d2b oprava
Some checks failed
CI and deploy / migration-check (push) Failing after 12s
CI and deploy / deploy (push) Has been skipped
2026-05-31 00:13:44 +02:00
Dusan Vojacek
111f51c06c zas oprava
Some checks failed
CI and deploy / migration-check (push) Failing after 15s
CI and deploy / deploy (push) Has been skipped
2026-05-31 00:07:43 +02:00
Dusan Vojacek
8950fafba2 oprava home-01: Infeasible při rolling hysteréze push (v53)
Some checks failed
CI and deploy / migration-check (push) Failing after 14s
CI and deploy / deploy (push) Has been skipped
2026-05-31 00:00:47 +02:00
Dusan Vojacek
578cf315e2 urpava KV1 vyliti v maxu v noci
Some checks failed
CI and deploy / migration-check (push) Failing after 19s
CI and deploy / deploy (push) Has been skipped
2026-05-30 23:47:44 +02:00
Dusan Vojacek
a03b45d4a9 oprava zbytecneho curtailu A
Some checks failed
CI and deploy / migration-check (push) Failing after 10s
CI and deploy / deploy (push) Has been skipped
2026-05-30 23:23:17 +02:00
Dusan Vojacek
830aa7a4cc oprava nevyberu maximalnich sell slotu (sahal i na zitejsi vecer)
Some checks failed
CI and deploy / migration-check (push) Failing after 13s
CI and deploy / deploy (push) Has been skipped
2026-05-30 22:56:28 +02:00
Dusan Vojacek
4f67aad4d8 a dalsi pokus o opravu
Some checks failed
CI and deploy / migration-check (push) Failing after 19s
CI and deploy / deploy (push) Has been skipped
2026-05-30 22:15:40 +02:00
Dusan Vojacek
96d0d52b07 oprava battery hold
Some checks failed
CI and deploy / migration-check (push) Failing after 12s
CI and deploy / deploy (push) Has been skipped
2026-05-30 22:11:03 +02:00
Dusan Vojacek
5208e035a4 a dalsi oprava
Some checks failed
CI and deploy / migration-check (push) Failing after 24s
CI and deploy / deploy (push) Has been skipped
2026-05-30 22:02:02 +02:00
Dusan Vojacek
d3e9caf0fb dalsi
Some checks failed
CI and deploy / migration-check (push) Failing after 23s
CI and deploy / deploy (push) Has been skipped
2026-05-29 23:34:16 +02:00
Dusan Vojacek
308c24f029 dalsi
Some checks failed
CI and deploy / migration-check (push) Failing after 15s
CI and deploy / deploy (push) Has been skipped
2026-05-29 23:24:03 +02:00
Dusan Vojacek
b73c3323e1 oprava
Some checks failed
CI and deploy / migration-check (push) Failing after 28s
CI and deploy / deploy (push) Has been skipped
2026-05-29 23:04:27 +02:00
Dusan Vojacek
877f5b6180 tuning prodeje
Some checks failed
CI and deploy / migration-check (push) Failing after 18s
CI and deploy / deploy (push) Has been skipped
2026-05-29 22:45:02 +02:00
Dusan Vojacek
230351b38a oprava
Some checks failed
CI and deploy / migration-check (push) Failing after 36s
CI and deploy / deploy (push) Has been skipped
2026-05-29 22:26:52 +02:00
Dusan Vojacek
88df09640c Use observed SoC for neg-prep cushion and evening drain (v40).
Some checks failed
CI and deploy / migration-check (push) Failing after 26s
CI and deploy / deploy (push) Has been skipped
Pre-neg forecast cushion and evening push before negative-sell days now use telemetry SoC instead of chaining LP targets across days, so the planner does not stop discharging early when BMS is higher than the model.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-05-29 00:20:05 +02:00
Dusan Vojacek
a7dff75e58 Add export plan guard to block Deye export against plan.
Some checks failed
CI and deploy / migration-check (push) Failing after 39s
CI and deploy / deploy (push) Has been skipped
Force PASSIVE/no-export when sell is negative or export_mode is NONE,
and alert NEG_SELL_EXPORT in plan_actual_slot_guard when export still occurs.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-05-29 00:14:52 +02:00
Dusan Vojacek
620a557a89 Align evening push with peak-band candidates and dynamic Wh budget.
Some checks failed
CI and deploy / migration-check (push) Failing after 23s
CI and deploy / deploy (push) Has been skipped
Restore _evening_peak_export_indices filter so push slots are chosen from
profitable peak-band nights, then ranked by sell until the Wh budget is
exhausted—not all profitable night slots and not a fixed top-3. Docs and
tests match v39 SoC balance tag.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-05-29 00:10:27 +02:00
Dusan Vojacek
ba0b55bf10 Fix SoC balance on battery export and improve evening push (v39).
Some checks failed
CI and deploy / migration-check (push) Failing after 38s
CI and deploy / deploy (push) Has been skipped
SoC continuity now deducts only bd (ge_bat was double-counted via energy
balance), which stopped the plan from draining ~2× faster than BMS during
evening BATTERY_SELL. Also ships dynamic evening push budget + rolling
hysteresis (v38), drops unused fn_soc_tracking_bundle, and adds tests/docs.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-05-29 00:04:48 +02:00
Dusan Vojacek
52e4b68789 ski battery charge u sell
Some checks failed
CI and deploy / migration-check (push) Failing after 26s
CI and deploy / deploy (push) Has been skipped
2026-05-28 23:22:57 +02:00
Dusan Vojacek
4e5de5df90 dalsi oprava
Some checks failed
CI and deploy / migration-check (push) Failing after 17s
CI and deploy / deploy (push) Has been skipped
2026-05-27 07:45:50 +02:00
Dusan Vojacek
8c7072da07 oprava BA ranni export
Some checks failed
CI and deploy / migration-check (push) Failing after 23s
CI and deploy / deploy (push) Has been skipped
2026-05-27 07:30:08 +02:00
Dusan Vojacek
19108002ca oprava KV 1
Some checks failed
CI and deploy / migration-check (push) Failing after 13s
CI and deploy / deploy (push) Has been skipped
2026-05-26 14:57:52 +02:00
Dusan Vojacek
96b16b9ff9 oprava vecerniho nevybijei
Some checks failed
CI and deploy / migration-check (push) Failing after 26s
CI and deploy / deploy (push) Has been skipped
2026-05-26 14:34:39 +02:00