Skip to content

fix(ferroamp): force idle on zero target, do not delegate to auto - #290

Merged
frahlg merged 1 commit into
masterfrom
fix/ferroamp-force-idle-on-zero-target
May 24, 2026
Merged

frahlg merged 1 commit into
masterfrom
fix/ferroamp-force-idle-on-zero-target

Conversation

@frahlg

@frahlg frahlg commented May 24, 2026

Copy link
Copy Markdown
Member

Summary

  • drivers/ferroamp.lua published auto on power_w=0, handing control back to the EnergyHub's autonomous self-consumption. That silently overrode every planner slot that wanted the battery held idle for PV export — Ferroamp covered local load instead and discharged ~500 W against target 0.
  • Now publishes discharge with arg=0 — explicit forced-idle, equivalent to Sungrow's path from 7e59f93. Watchdog default-mode and cleanup still publish auto, so a stale EMS still falls back to autonomous.
  • Updated the existing zero-command test to assert forced-idle behaviour and idempotency.

Live evidence (2026-05-24, homelab-rpi)

mode: planner_self          plan_stale: false
grid_target_w: 0            bat_w: -526 W  ← discharge against target 0
dispatch.ferroamp.target_w: 0    dispatch.sungrow.target_w: 0
drivers.ferroamp.bat_soc: 0.45   drivers.sungrow.bat_soc: 0.975
today: pv_wh=60.5 kWh, export_wh=27.7 kWh, import_wh=4.5 kWh
       bat_charged_wh=13 kWh, bat_discharged_wh=1.3 kWh

Sungrow honoured target=0 (already fixed in 7e59f93). Ferroamp did not — it discharged 526 W. Plan slot wanted battery_w=0, reason: "idle — export PV surplus"; Ferroamp instead ran its own self-consumption.

Test plan

  • go test ./internal/drivers/ -run TestFerroamp -count=1
  • Full suite: go test ./... -count=1
  • Deploy to homelab-rpi and confirm bat_w follows target_w=0 within one dispatch tick
  • Confirm tomorrow's PV is absorbed into Ferroamp during planned idle/export slots

🤖 Generated with Claude Code

When the dispatch layer commanded power_w=0 the driver used to
publish `auto`, putting the EnergyHub into autonomous self-
consumption. That silently overrode every planner slot that wanted
the battery idle so PV surplus could export — Ferroamp kept covering
local load and discharged ~500 W against target 0. Live system on
2026-05-24 ran a planner_self plan with PV export windows while the
battery quietly discharged through them, exporting 27 kWh at low
prices and leaving Ferroamp at 45% SoC by evening.

Now publish `discharge` with arg=0 on zero target — equivalent to
Sungrow's forced-idle path (commit 7e59f93). The watchdog
default-mode and cleanup paths still publish `auto`, so a stale
EMS still falls back to autonomous self-consumption.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
@frahlg
frahlg merged commit 5ff1b83 into master May 24, 2026
1 check passed
@frahlg
frahlg deleted the fix/ferroamp-force-idle-on-zero-target branch May 24, 2026 17:55
frahlg added a commit that referenced this pull request Nov 30, 2026
…#2141)

A restart while no car was plugged in left the Easee charger's power
unknown until a car arrived (srcfl/device-drivers#289). Home use then went
unknown, History lost those hours and the daily saving went negative. The
pin moves to srcfl/device-drivers@f7102be (#290); no other bundled driver
changes.

Signed-off-by: Fredrik Ahlgren <[email protected]>
Co-authored-by: Claude Opus 5.5 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant