fix(ferroamp): read per-phase grid current from iext not il - #161
Merged
Conversation
The driver was reading `il` (inverter AC current) for meter.l*_a while meter.w came from `pext` (service-entrance CT power). In Ferroamp's ehub JSON `il` only sees what flows through the inverter; any load behind the main fuse but outside the inverter path — the common case being an EV charger on a separate breaker — is invisible to `il` but visible to `pext`/`iext`. Symptom: fuse bars and fuse_over_limit detection under-read by the EV share of total import (measured ~12× at 11 kW EV-charging during grid import). Fix: read `iext` for the phase-current fields. pext (W) stays; it was already correct. After this sum(l*_a) × V agrees with w for any load mix. Sim-ferroamp now emits both `iext` and `il` at W/V for compatibility — driver prefers iext, but anything downstream that still inspects il keeps working. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #160.
Summary
Why
On a live Ferroamp install with CTs at the service entrance and an 11 kW EV charger on a separate breaker, the dashboard showed `grid_w = 11 kW` but fuse bars summed to `≈ 874 W` — a ~12× under-read. `il` only sees what flows through the Ferroamp inverter; the EV charger is invisible to it but visible to `pext` / `iext`. Same bug fed into the `fuse_over_limit` notification rule added in #159, so that would also miss EV-driven overloads.
Test plan
🤖 Generated with Claude Code