Skip to content

feat: CircuitMeter subpanel current limiting (#106)#117

Merged
basmeerman merged 4 commits intomasterfrom
work/plan-14-circuit-meter
Mar 25, 2026
Merged

feat: CircuitMeter subpanel current limiting (#106)#117
basmeerman merged 4 commits intomasterfrom
work/plan-14-circuit-meter

Conversation

@basmeerman
Copy link
Copy Markdown
Owner

@basmeerman basmeerman commented Mar 24, 2026

Summary

  • Add CircuitMeterImeasured and MaxCircuitMains to evse_ctx_t
  • Clamp IsetBalanced by subpanel circuit headroom in evse_calc_balanced_current()
  • Guard rails, hard shortage detection for circuit overload
  • 5 native tests with SbE annotations (REQ-CIR-001 through REQ-CIR-005)
  • Plan 14, Increment 1 of 6 (state machine only — meter instantiation in Increment 2)

Closes #106

Test plan

  • All 45 native test suites pass (incl. 5 new circuit meter tests)
  • Address + UB sanitizers clean
  • ESP32 firmware build passes
  • CH32 firmware build passes
  • CI pipeline validates on push

🤖 Generated with Claude Code

basmeerman and others added 4 commits March 25, 2026 23:35
…ment 1) (#106)

Add CircuitMeterImeasured and MaxCircuitMains to evse_ctx_t. Clamp
IsetBalanced by subpanel circuit headroom in evse_calc_balanced_current().
5 native tests with SbE annotations.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…4, Inc 2-3) (#107, #108)

Add third Meter instance for subpanel metering. Poll via Modbus when
enabled, sync to evse_ctx_t via bridge, persist settings in NVS.

- meter.h: extern Meter CircuitMeter declaration
- main.h: CIRCUIT_METER, CIRCUIT_METER_ADDRESS, MAX_CIRCUIT_MAINS defaults
- main.cpp: CircuitMeter instantiation, MaxCircuitMains global, Modbus
  polling states 23 (current) and 24 (energy) in ModbusRequestLoop
- modbus.cpp: route CircuitMeter responses in HandleModbusResponse
- evse_bridge.cpp: sync CircuitMeter.Irms max and MaxCircuitMains to ctx
- esp32.cpp: NVS read/write with settings cache for 3 new keys

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
#109)

Publish circuit current/power/energy via MQTT with HA auto-discovery.
Add Set/MaxCircuitMains and Set/CircuitMeter topics. REST /settings
integration for circuit meter configuration.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…ment 5) (#110)

Add circuit_energy_wh to session_record_t. When CircuitMeter is active,
session JSON includes circuit_kwh field for ERE compliance verification.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@basmeerman basmeerman force-pushed the work/plan-14-circuit-meter branch from 4caf9a5 to d701d27 Compare March 25, 2026 22:43
@basmeerman basmeerman merged commit 9fda8c0 into master Mar 25, 2026
13 checks passed
basmeerman added a commit that referenced this pull request Mar 25, 2026
- Add Capacity Tariff, CircuitMeter, SoC Injection to Key Features table
- Add Plans 13-15 to Roadmap table (PRs #115, #116, #117)
- Update test stats: 47 suites, 1,046 native tests, 1,200+ total
- Add Plans 13-15 sections to upstream-differences.md
- Update quality.md test metrics
- Update CLAUDE.md priority table and test infrastructure count

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
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.

[Plan-14] Increment 1: State machine — circuit current limiting

1 participant