Commit Graph
11 Commits
Author SHA1 Message Date
naps62andClaude Opus 4.7 7d0be3c70c feat: unit-aware power sensors + ceil() for max solar self-consumption
test / test (push) Has been cancelled
Two related fixes for v0.1.3:

1. _read_power_w() reads each power sensor's unit_of_measurement and
   converts kW to W. Before this, sensors reporting in kW (Tesla
   integration's leomobile_charger_power = "1" kW) were treated as raw
   watts, causing the leftover calculation to undercount by ~1000×.
   In practice the algorithm sent the EV charge rate that matched
   "what's exporting NOW" instead of "what's available if EV pulled
   everything" — leaving ~1 kW of solar exported instead of routed to
   the car.

2. round() → math.ceil() on the amp computation. Trade-off: up to
   ~VOLTAGE watts of grid import per tick, in exchange for zero solar
   export. Maximizes PV self-consumption, accepts small grid cost as
   rounding noise.

Tests added: kW conversion round-trip; ceil rounds up partial amps.
All 57 pass.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-28 15:47:31 +00:00
naps62 d73b4ec7a3 fix: lower MAX_AMPS to 14 for residential single-phase circuits
test / test (push) Has been cancelled
The hardcoded 16A ceiling was too high for a 14A circuit breaker.
Lowered the constant; tests updated accordingly. Making MAX_AMPS
configurable per install is a v0.1.3 follow-up — for now, anyone with
a different circuit rating will need to fork and edit the constant.
2026-05-27 21:11:50 +00:00
naps62 30a32eec0e chore: ruff cosmetic fix on test comment alignment 2026-05-27 15:51:28 +00:00
naps62andClaude Sonnet 4.6 4cf5afcc0f feat: safety-fallback decision helper
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-27 15:29:35 +00:00
naps62 244bb9e2da feat: sanitize anomalous EV consumption inputs 2026-05-27 15:27:36 +00:00
naps62andClaude Sonnet 4.6 c2afe026a3 feat: solar sub-mode forward calculation with target floor
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-27 15:25:51 +00:00
naps62 de77bf79b4 feat: night sub-mode with target SOC gate 2026-05-27 15:23:50 +00:00
naps62 d20930a91e feat: dinner sub-mode hard cap 2026-05-27 15:22:23 +00:00
naps62andClaude Sonnet 4.6 d325f43f7e feat: compute_decision gates and force-mode overrides
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-27 15:20:33 +00:00
naps62andClaude Sonnet 4.6 bc7bd7e86e feat: implement pick_submode resolver
Pure function resolving sub-mode from time-of-day and sun state; 9
parametrized test cases covering all boundary conditions.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-27 15:18:06 +00:00
naps62andClaude Sonnet 4.6 8a6b0037d5 feat: add algorithm dataclasses and enums
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-27 15:13:46 +00:00