Files
goodwe-addon/goodwe_controller/DECISIONS/OPT-11-battery-modes.md
T
adminandClaude Opus 5.5 c664e38ef4 OPT-11 P2 review: refusals stay counted, removals survive a start with no broker
- A refusal past the log-once set or the 32 cap is counted in the log at
  1, 10, 100 and so on, so a repeated attack stays visible.
- The logged topic is printable only (no forged log lines).
- mode_announcement(): the start-up store logic, now tested with a real
  Store. A removed config topic stays stored, so a start with no broker
  cannot forget it (rename case tested).
- A test ties each HA mode option to the page's English name.
- packmode.enabled() is tested for "true", 1 and "false".
- Retained-command text, DOCS and DECISIONS updated to match.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-28 23:58:34 +02:00

2.1 KiB

OPT-11 - battery modes, per battery

A battery's mode (on/off, Solar first, Leftover solar) is a soft unit limit at P_MODE = 35 that always holds 0 W. A SET above 35 (a safety stop) overrides it; a limit above 35 (the peak guard) makes it give way only as far as that limit needs, and a battery its mode holds back then carries only what the others cannot (arbiter._unit_modes(), _site_mode()). Design and owner answers: goodwe-session/OPT-11-design.md (2026-09-27); P1 is its section 6 P1, and the pull request lists what was measured.

  • Off by default (battery_modes_enabled); off, commands are byte-identical to a5dddad (test_modes.py part 1).
  • Off is a mode range, so the peak guard can still use an Off battery when the others cannot cover the floor (design sections 2-3). Whether Off should be absolute is an open owner question.
  • Review (PR #149): releasing only when the peak floor bound S let a trade won above the floor keep the modes and place less than the floor, and let a capped grid charge release an Off battery. Both are graded in test_arbiter.py part 11. The loop bound leaves a side that reaches the rail to the rail, so SAFETY-03 still flags a loop winding into it.
  • P2 (HA entities): a select and a switch per battery, only while modes are on; commands go through handle_action(), the page's path. A retained command is dropped, not applied: the store already holds the last choice, and a replay after a restart could otherwise undo a newer one. The config topics announced are kept in the store (mqtt_mode_configs), so turning modes off removes exactly those, and an install that never turned them on publishes what ed739d4 did (test_mqtt.py part 10). A removed topic stays in that list and its empty config is re-sent on each start, so a start with no broker cannot lose it; re-sending is harmless. The HA options are the page's English names, pinned by a test, and are not renamed with the page: automations send them.
  • In P1 only Off closes a direction; Leftover solar differs by charging last. Price runs, selling (pack_sell, reserved) and the forecast are P3/P4.